本博客的運行環境爲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
運行結果如下: