1 創建yolo環境
conda creat -n yolo python=3.6
更換conda源,下載軟件的時候會快些
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版本的tensorflow
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 安裝依賴
在訓練的過程中,會有很多依賴,所以提前安裝一遍
pip install Pillow
pip install matplotlib
conda install ffmpeg
pip install opencv-contrib-python
pip install opencv-python
pip install h5py
1、下載yolov3代碼:https://github.com/qqwweee/keras-yolo3 ,並解壓縮之后用pycharm打開。
2、下載權重:https://pjreddie.com/media/files/yolov3.weights並將權重放在keras-yolo3的文件夾下。如下圖所示:
3、執行如下命令將darknet下的yolov3配置文件轉換成keras適用的h5文件。
python convert.py yolov3.cfg yolov3.weights model_data/yolo.h5
運行:
python yolo_video.py --gpu_num=1 –input=test.mp4 --output=2.mp4
如果出現Failed to load the native TensorFlow runtime.
則,
解決辦法就是:pip install --upgrade --ignore-installed tensorflow
更新一下tensorflow就好了