Faster RCNN 訓練自己的資料集遇到的一些問題
阿新 • • 發佈:2019-01-04
1. xml標籤格式問題
原本的標籤是yaml格式的,需要轉換成xml格式。
在製作xml標籤時,有些資訊是比較重要的不能省略
<?xml version="1.0" encoding="utf-8"?> <annotation> <folder>VOC2007</folder> <filename>00200000141.jpg</filename> <size> #圖片的大小 <width>480</width> <height>640</height> <depth>3</depth> </size> <segmented>0</segmented> #標籤是否分割 <object> <name>hand</name> #目標的名稱 <pose>Unspecified</pose> #目標的姿態 <truncated>0</truncated> #是否被遮擋>15% <difficult>0</difficult> #是否為難識別的物體,主要指要結體背景才能判斷出類別的物體,一般忽略 <bndbox> #物體在影象中的位置 <xmin>64</xmin> <ymin>279</ymin> <xmax>201</xmax> <ymax>397</ymax> </bndbox> </object> </annotation>
2. 出現rpn_loss_box=NAN的問題
遇到過好多次這個問題,最後發現都是標籤有問題,因此在出現NAN的地方,對應著trainval.txt去查詢。看看是哪個標籤出了問題,快速檢查的方法是:刪除對應的標籤,重新訓練,看看在原來的地方還會不會有問題,如果沒有那就一定是標籤出現了問題。再對標籤進行修改!
3. 訓練之前需要安裝的一些包
pip install pyyaml pip install cython pip install opencv-python pip install easydict==1.6 pip install matplotlib pip install Pillow pip install scipy
4. 按照https://github.com/endernewton/tf-faster-rcnn的命令進行訓練,最後出現FileNotFoundError的錯誤
這是因為沒有建立對應路徑的資料夾的原因,在提示的路徑下以此建立對應資料夾即可:
tf-faster-rcnn/data/VOCdevkit2007/results/VOC2007/Main/
5. 按照https://github.com/endernewton/tf-faster-rcnn的命令進行訓練,最後出現TypeError的錯誤:
pickle.dump(recs, f)
write() argument must be str, not bytes
找到對應的位置:
改為二進位制方式開啟:
with open(cachefile, 'wb+') as f:
pickle.dump(recs, f)