1 建立yolo环境
conda creat -n yolo python=3.6
更换conda源,下载软件的时候会快些python
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
建立后进入yolo环境,并安装Keras和tensorflow,我这块安装的是gpu版本的tensorflowgit
source activate yolo
pip install keras==2.1.5
pip install tensorflow-gpu==1.6.0 #若是是gpu版本
pip install tensorflow==1.6.0 #若是是cpu版本
注意,这两个是二选一
2 安装依赖
在训练的过程当中,会有不少依赖,因此提早安装一遍github
pip install Pillow
pip install matplotlib
conda install ffmpeg
pip install opencv-contrib-python
pip install opencv-pythonide
pip install h5pyurl
一、下载yolov3代码:https://github.com/qqwweee/keras-yolo3 ,并解压缩以后用pycharm打开。blog
二、下载权重:https://pjreddie.com/media/files/yolov3.weights并将权重放在keras-yolo3的文件夹下。以下图所示:ip
三、执行以下命令将darknet下的yolov3配置文件转换成keras适用的h5文件。pycharm
python convert.py yolov3.cfg yolov3.weights model_data/yolo.h5input
运行:
python yolo_video.py --gpu_num=1 –input=test.mp4 --output=2.mp4it
若是出现Failed to load the native TensorFlow runtime.
则,
解决办法就是:pip install --upgrade --ignore-installed tensorflow
更新一下tensorflow就行了