運行yolov5 train.py報錯:AssertionError: Image Not Found ../data/images/xxx.png
運行環境
????一開始在筆記本上用顯卡跑訓練是可以正常運行的,后來隨著資料量越來越大,筆記本顯卡顯存不夠用了,改用學校的浪潮服務器來跑,但出現了報錯,
報錯詳情
????當時報錯時忘記截圖了,這里就大概描述一下報錯發生的位置和內容,報錯發生在終端輸出接下來這句之后,
Optimizer groups: 62 .bias, 62 conv.weight, 59 other
train: Scanning 'data/train.cache' images and labels... 2590 found, 0 missing, 335 empty, 0 corrupted: 100%|##########| 2590/2590 [00:00<?, ?it/s]
????在走完上面這個進度條之后就會出現如標題所示的報錯,我這個專案在本地是可以跑通的,只是如果不減小batch-size會之后因為顯存不足報錯,可見圖片訓練集的位置沒有問題,不會引起報錯,
解決方案
????在國內搜索引擎上似乎沒有找到相關解決方案,在谷歌后在yolov5 github的issues里找到了可能的解決方案,鏈接在本文底部,其中有一位評論
I've opened PR #2042 to fix this issue. This runs an additional check on the actual image format using PIL img.format. For this check to actually run you'd need to delete your existing *.cache files in your dataset directories, which will trigger a new caching.
Verified update works correctly. I added a GIF to COCO128 and renamed it with a .jpg extension. The new check caught the file, removed it from the training images, and then trains correctly.
????考慮到報錯的位置本應該是要加載'data/val.cache'的,可能是這位提到的cache的問題,我試著將之前在本機訓練生成的.cache檔案洗掉,重新在服務器運行train.py,順利運行,開始訓練,

????如圖,洗掉train.cache和val.cache后再重新在服務器上運行即可,
參考
https://github.com/ultralytics/yolov5/issues/195
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/285825.html
標籤:其他
下一篇:資訊熵和條件熵
