一、出現的問題
1、錯誤使用 containers.Map/values,此容器中不存在指定的鍵。出錯 roidb_from_voc>attach_proposals (line 172)
gt_classes = class_to_id.values({voc_rec.objects(valid_objects).class})
答:你標註的目標種類與datasets/VOCdevkit2007/VOCcode/VOC2007/VOCiniy.m中指定的目標種類不匹配。比如你只在VOCinit.m中寫了一個目標類型標籤‘car',但你標記結果Annotations/中某個.xml中不小心標註兩種對象object如'car'和'person’。這樣機會報錯,解決方法是重新標記那個.xml對應的圖片,去掉多餘的目標種類。
2、錯誤使用 proposal_prepare_image_roidb>scale_rois (line 110),兩個輸入數組的非單一維度必須相互匹配。
答:可能有如下原因:
①一是要識別的是plane並且標註的xml文件中目標名稱也是plane,但VOCinit.m中寫的目標類型標籤是‘car',兩者不匹配所以出問題,將VOCinit.m中的label改爲'plane'即可;
②二是圖片有問題,不是指.jpg或.png圖片格式的問題,而是指圖片本身存在問題。我是原因是:圖片尺寸有問題,一般要求500*375或375*500,例如標準VOC數據集中基本都是這兩種大小或者接近這兩種大小的圖片。我從百度圖片上拷貝下來的圖片尺寸千差萬別,沒有對尺寸進行修正直接訓練,所以出錯。
③可能是Annotations/中的xml文件文字格式有問題,我開始使用labelImg標註訓練沒問題,後來因爲需要對xml文件內容做一定修改,就編寫了一個matlab程序對所有的xml批量修改,然後就出錯了。原因是修改後:緊湊型xml變爲常規型,是的讀取時多了幾個空格節點。具體表現如下:
1°、xml開頭多了一個xml聲明格式語句:<?xml version="1.0" encoding="utf-8"?>;
2°、因爲上述1中開頭的格式設置,修改後的xml每行之間的空格也變大了。
4。有可能是因爲緩存沒有清理乾淨,imdb下和output都要清理
錯誤詳細如下:
錯誤使用 proposal_prepare_image_roidb>scale_rois (line 110)
兩個輸入數組的非單一維度必須相互匹配。
出錯proposal_prepare_image_roidb>@(x,y)compute_targets(conf,scale_rois(gt_rois,im_size,y),gt_labels,x,image_roidb_cell{i},y) (line 61)
compute_targets(conf, scale_rois(gt_rois, im_size, y), gt_labels, x, image_roidb_cell{i}, y), ...
出錯 proposal_prepare_image_roidb>append_bbox_regression_targets (line 53)
parfor i = 1:num_images
出錯 proposal_prepare_image_roidb (line 43)
[image_roidb, bbox_means, bbox_stds] = append_bbox_regression_targets(conf, image_roidb, bbox_means, bbox_stds);
出錯 proposal_train (line 77)
= proposal_prepare_image_roidb(conf, opts.imdb_train, opts.roidb_train);
出錯 Faster_RCNN_Train.do_proposal_train (line 7)
model_stage.output_model_file = proposal_train(conf, dataset.imdb_train, dataset.roidb_train, ...
出錯 script_faster_rcnn_VOC2007_ZF (line 45)
model.stage1_rpn = Faster_RCNN_Train.do_proposal_train(conf_proposal, dataset, model.stage1_rpn, opts.do_val);
3.
錯誤使用 caffe_
glog check error, please check log and clear mex
出錯 caffe.Net/forward_prefilled (line 109)
caffe_('net_forward', self.hNet_self);
出錯 caffe.Net/forward (line 142)
self.forward_prefilled();
出錯 fast_rcnn_test>check_gpu_memory (line 208)
caffe_net.forward(net_inputs);
出錯 fast_rcnn_test (line 67)
max_rois_num_in_gpu = check_gpu_memory(conf, caffe_net);
出錯 Faster_RCNN_Train.do_fast_rcnn_test (line 6)
mAP = fast_rcnn_test(conf, imdb, roidb, ...
出錯 script_faster_rcnn_VOC2007_VGG16 (line 78)
opts.final_mAP = Faster_RCNN_Train.do_fast_rcnn_test(conf_fast_rcnn, model.stage2_fast_rcnn, dataset.imdb_test, dataset.roidb_test);
1、顯存不足,需要改小batchsize
2、model裏面的prototxt文件沒有改好
3、如果在final test階段出現這個問題,應該還是顯存不足的問題,因爲裏面有一句話:出錯 fast_rcnn_test>check_gpu_memory (line 208)
我的1080跑zf網絡沒有問題但是跑vgg16就算batchsize改小了也會報錯。考慮可不可以final test階段用cpu來跑,但是不知道從哪裏改
二、.如何檢查標籤中的錯誤
1.格式有問題
刪掉所有文件中utf8那一行(第一行):sed -i‘(匹配的字符串)’*.xml
2.標籤有問題
把所有的標籤都找出來:grep '<name>' *.xml >> serach.txt
用vim刪除掉正確的標籤 例如::g/ofo/d
那麼剩下的標籤就是錯誤標籤