本博客的运行环境为ubuntu 18.04
环境配置
注意!所有的下载都使用的pip3,因为该文件仅支持python3
1、下载keras
pip3 install keras==2.2.5
或使用国内源会快一些
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple keras==2.2.5
2、下载tensorflow,注意版本要与keras对应
pip3 install tensorflow==1.14.0
或使用国内源会快一些
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow==1.14.0
3、下载python-opencv
pip3 install python-opencv
或使用国内源会快一些
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple python-opencv
编译与运行
克隆keras-yolo4包
git clone https://github.com/Ma-Dan/keras-yolo4
修改test.py中model_path为你的权重文件
分享两个权重文件的下载:
链接:https://pan.baidu.com/s/1NCbjy65fP5xWWRXWtXauIQ
提取码:4lgg
命令行里进入keras-yolo4文件夹
cd ~/keras-yolo4
使用python3运行该文件
python3 test.py
输入该文件夹中你放入的图片名字,我的图片命名为timg.jpg
运行结果如下: