【超快超輕YOLO】YOLO-Fastest從Darknet源碼編譯、測試再到訓練完整圖文教程!

最輕的YOLO算法出來了!這是個模型很是小、號稱目前最快的YOLO算法——大小隻有1.3MB,單核每秒148幀,移動設備上也能輕易部署。並且,這個YOLO-Fastest算法知足全部平臺的須要。不管是PyTorch,仍是Tensorflow,又或者是Keras和Caffe,能夠說是全平臺通用。此外,做者還推出了超輕YOLO的「加大版」,一樣只須要3.5MB,就能實現比YOLOv3更好的目標檢測效果。那麼,這麼輕的網絡,檢測效果怎麼樣?node

一、模型編譯、測試和訓練

1.一、YOLO-Fastest編譯

  • 第一步
git clone https://github.com/dog-qiuqiu/Yolo-Fastest
  • 第二步
下載安裝opencv:https://github.com/opencv/opencv/releases/tag/4.4.0
  • 第三步
    打開cmake,選擇 Yolo-Fastest文件夾爲 source code路徑, Yolo-Fastest文件夾爲目標文件夾;而後點擊 configure,再選擇 opencv.exe解壓縮後的 build文件夾爲 OPENCV_DIR的路徑;
  • 第四步
    打開 Visual Studio2017(具體根據你在configure時選擇的編譯環境,最好選擇2017),選擇 release,而後 生成解決方案
  • 第五步
    編譯完成後在 Yolo-Fastest目錄下會有 Release文件夾,把裏面編譯完成的 darknet.dll和darknet.exe複製到 Yolo-Fastest/build/darknet/x64目錄下;
  • 第六步
    Yolo-Fastest目錄下的除 README.MD之外的4個文件複製到 Yolo-Fastest/build/darknet/x64/cfg目錄下;

1.二、YOLO-Fastest視頻和圖片測試

  • 一、 視頻測試
    輸入以下指令既可測試視頻檢測並輸出檢測的結果,CPU檢測能夠達到14FPS/s,比同等條件下使用GPU檢測的YOLO-V4快不少:
 ./darknet detector demo ./cfg/voc.data ./cfg/yolo-fastest.cfg ./cfg/yolo-fastest.weights ./data/test_car.mp4 -i 1 -thresh 0.25 -out_filename ./data/car_output.mp4

注意,測試視頻能夠爲任意你本身想檢測的視頻文件,這裏小編只用了手上有的視頻進行了測試git


  • 二、 圖片測試
    輸入以下指令既可測試視頻檢測並輸出檢測的結果,CPU檢測用時爲
 ./darknet detector test ./cfg/voc.data ./cfg/yolo-fastest.cfg ./cfg/yolo-fastest.weights ./data/person.jpg -i 1 -thresh 0.25 -out_filename ./data/person_output.jpg

二、YOLO-Fastest訓練

  • 一、 根據voc數據集的形式標註本身的數據集;github

  • 2 、生成一個預先訓練好的模型,用於初始化模型主幹:web

 ./darknet partial yolo-fastest.cfg yolo-fastest.weights yolo-fastest.conv.109 109
  • 3 、Train:
 ./darknet partial yolo-fastest.cfg yolo-fastest.weights yolo-fastest.conv.109 109

如下是原做者所獲得的結果算法

References

[1] https://github.com/dog-qiuqiu/Yolo-Fastest
[2] https://github.com/AlexeyAB/darknet微信

本文分享自微信公衆號 - 計算機視覺CV(jsjsjcv)。
若有侵權,請聯繫 support@oschina.cn 刪除。
本文參與「OSC源創計劃」,歡迎正在閱讀的你也加入,一塊兒分享。網絡

相關文章
相關標籤/搜索