Install
Clone repo and install requirements.txt in a Python>=3.7.0 environment, including PyTorch>=1.7.
cd YOLOv5
pip install -r requirements.txt # install
將欲檢測之照片放入 YOLOv5\data\images
資料夾中
大小為 640 x 640
Open your terminal/command prompt from your project directory and run the detect.py file by executing the command python detect.py
.
cd YOLOv5
python detect.py
預設路徑放於 YOLOv5\runs\detect
\exp
開頭之資料夾下
(如欲更改資料夾名稱可於 detect.py 下之第 72 行進行修改)
Validation
路徑 YOLOv5\runs\train\PCBDetect
下可看到其他結果
- Here I select YOLOv5s, the smallest and fastest model available. See YOLOv5 README table for a full comparison of all models.
- 其實資料前處理無疑是最麻煩的一部分
- DeepPCB 原始資料集只給了測試照片與 Defect 位置座標
- 這邊我大概說明一下我進行的前處理步驟
- 按照 VOC 格式創建資料集文件夾
- 資料集格式轉換 - 轉換出 xml 檔
- 訓練集資料劃分 - (train,val,test 按照 8:1:1 比例隨機劃分)
- 生成 YOLO 格式的 Label - 依照 xml 檔,轉換出適用 YOLO 格式的 label.txt 檔
- 修改配置文件、路徑與參數
- 修改 train.py 等參數,開始訓練與測試。
聲明:如欲進行所有商業合作用途,請事先告知。
如果有漏洞與功能或其他問題,歡迎與我聯繫。
by FreeAaron