Train on other dataset?
TCforgood opened this issue · 10 comments
First of all, thanks for sharing the great work! I am working on object detection on my own dataset but struggle a bit with some dimension parameter in .prototxt. Is is possible to can point out what are the related parameters to "number of classes" in .protxt. (Like https://github.com/deboc/py-faster-rcnn/tree/master/help)
Thank you
@THTCheng
-
Change the det_cls_score_7/det_cls_score_6/det_cls_score_5/det_cls_score_4‘s layer num_output from 210 to other values. For example, if you have k classes, the value will be 10*k.
-
Change the det_cls_score_reshape_7/det_cls_score_reshape_6/det_cls_score_reshape_5/det_cls_score_reshape_4's second dim from 21 to your class number.
-
Change the last parameter in param_str of layer det-data_7/det-data_6/det-data_5/det-data_4 from 21 to your class number.
-
Change the data-input layer's num_classes from 21 to your class number.
Hope this will help you.
Thanks for the detailed instructions. I am able to train on my own dataset now.
And for test net, change the last parameter in param_str of layer det_scorebbox_7/det_scorebbox_6/det_scorebbox_5/det_scorebbox_4 from 21 to your class number.
Thanks for sharing the great work @taokong After I changed the parameters above, and changed the number of classes in the "pascal_voc.py" ('background', 'car','bus','truck'), I got the following results:
AP for car = 0.8665
/home/daye/Desktop/duankaiwen/RON_4classes/tools/../lib/datasets/voc_eval.py:192: RuntimeWarning: invalid value encountered in divide
rec = tp / float(npos)
RuntimeWarning: invalid value encountered in divide
rec = tp / float(npos)
/home/daye/Desktop/duankaiwen/RON_4classes/tools/../lib/datasets/voc_eval.py:41: RuntimeWarning: invalid value encountered in greater_equal
if np.sum(rec >= t) == 0:
AP for bus = 0.0000
AP for truck = 0.0000
Mean AP = 0.2888
hlep please! @TCforgood @luuuyi @taokongcn
@Duankaiwwen
You should evaluate the detection results according to your datasets, not voc.
@taokong ,Hey, much thanks for your great work. During the train, I have some questions if you don't mind.
when i change the batchszie=10, I got the following problem:
F1112 11:28:33.865924 8866 eltwise_layer.cpp:34] Check failed: bottom[i]->shape() == bottom[0]->shape()
*** Check failure stack trace: ***
./train_voc.sh: line 7: 8866 Aborted (core dumped) python tools/train_net.py --gpu 0 --solver models/pascalvoc/VGG16/solver.prototxt --imdb voc_2007_trainval --weights data/ImageNet_models/VGG16_layers_fully_conv.caffemodel --batchsize 10 --iters 120000
Can you give me some advise?Thank you!
Thanks for your reply! but I just evaluated the detection results on dataset, I only changed my dataset to the same format as voc. @taokong
@taokong ,Hey, much thanks for your great work. After I trained the network and while test the model , I have some questions if you don't mind.
After loading the model, i got the following model:
Traceback (most recent call last):
File "./tools/test_net.py", line 77, in
test_net(net, imdb)
File "/home/babychen/Downloads/RON-ORI/tools/../lib/fast_rcnn/test.py", line 146, in test_net
batch_scores, batch_boxes = im_detect(net,ims)
File "/home/babychen/Downloads/RON-ORI/tools/../lib/fast_rcnn/test.py", line 70, in im_detect
blobs_out = net.forward(data=blobs['data'].astype(np.float32, copy=False))
File "/home/babychen/Downloads/RON-ORI/tools/../caffe-ron/python/caffe/pycaffe.py", line 121, in _Net_forward
self._forward(start_ind, end_ind)
File "/home/babychen/Downloads/RON-ORI/tools/../lib/ron_layer/det_layer.py", line 88, in forward
all_scores = np.hstack((all_scores_rpn, all_scores_det)).reshape((self._ndim, -1, self._numclasses))
File "/usr/local/lib/python2.7/dist-packages/numpy/core/shape_base.py", line 293, in hstack
return _nx.concatenate(arrs, 1)
ValueError: all the input array dimensions except for the concatenation axis must match exactly
I print the shape of all_scores_rpn, all_scores_det and find the shape of all_scores_rpn is (0,1)
I print the source data which produce all_scores_rpn called bottom[0] data and find it value is NaN.But the code in this project has not give value to bottom[0] data.
I wonder if i have trained the model correctly.
Can you give me some advise?Thank you! @TCforgood @taokong @luuuyi
@taokong My datasets only have two types of objects (backgroud car). Objectness prior and bbox regressing are all OK. I have one question, for my tense, Objectness prior can make me know foreground(car), Do I need class-detection layer?
I think adding the class-detection module could further boost performance, you can have a comparison.