jshtok / RepMet

Few-shot detection for visual categories
Apache License 2.0
108 stars 18 forks source link

How to train on an own dataset? #13

Closed duynn912 closed 4 years ago

duynn912 commented 4 years ago

Dear @jshtok,

Could you mind share your setting up to train on an own dataset. I replace Pascal VOC by my own dataset following the setup of Pascal and ImagenetLOC. During training, I have a value error like this one: image Do you know why this is a case. Could you please help me out! Btw, in the yaml file, there is a line named "max_num_extra_classes", my question is the value of this parameter must be identical to NUM_CLASSES or not? Thank you so much!

jshtok commented 4 years ago

dear @duynn912, this seems to be a small issue related possibly to the content of the list of class indices in the roidb entry. In general, roidb[0]['gt_classes'] is an np.array containing the list of ground truth class indices for the relevant image. You can find more information about the issue if you put a breakpoint at the line gt_inds = np.where(roidb[0]['gt_classes'] != 0)[0] and track the dimensions of gt_inds, roidb[0]['gt_classes'], gt_boxes

Please update me on this info if you dont find the solution yet. Also, does the failure occure on the print command? It is not in my code, so can you publish the whole get_rpn_batch() function?

duynn912 commented 4 years ago

Dear @jshtok, Yes it is, this is not an error caused by your code. I think it is caused by my setup. Here is whole get_rpn_batch() function. image And this is all infor I print in the command line: image

So if roidb[0]['gt_classes'] is the list of ground truth class indices for the relevant image. Does it contain the id class of background '0' because in your code, you only get the indices that is not zero. If so, roidb[0]['boxes'].shape[0] will have more dimensions caused by the background like my issue.

jshtok commented 4 years ago

well, the error is clear, and it is actually, a vulnerability in the original code. The dimensions of gt_boxes don`t match anymore because there is a zero class in the list gt_classes: roidb[0]['gt_classes']=[0,4,6,6]. There should not be a zero, because zero means 'background'. Please take care of this.