Closed Asif6511 closed 5 years ago
You need to prepare the VOC data as mentioned here. You would then need to call the inference step with --dataset voc2007/12
option (as mentioned in the Readme).
Hi! Thanks for the reply. I did prepare the VOC dataset in the way mentioned. However in Infer_simple.py,
if args.dataset.startswith("coco"): dataset = datasets.get_coco_dataset() cfg.MODEL.NUM_CLASSES = len(dataset.classes) elif args.dataset.startswith("keypoints_coco"): dataset = datasets.get_coco_dataset() cfg.MODEL.NUM_CLASSES = 2 else: raise ValueError('Unexpected dataset name: {}'.format(args.dataset))
So we cannot use datasets other than COCO and KEYPOINT COCO?
Also, I would like to know if it is possible to evaluate training results on VOC2007 using "python tools/test_net.py --dataset coco2017 --cfg config/baselines/e2e_mask_rcnn_R-50-FPN_1x.yaml --load_ckpt {path/to/your/checkpoint} " The modelZOO in detectron checkpoints are trained by COCO dataset and cannot be used on VOC2007?
The test script does accept VOC data (refer these lines). Please make sure that you are running the script as : python tools/test_net.py --dataset voc2007 --cfg config/baselines/e2e_mask_rcnn_R-50-FPN_1x.yaml --load_ckpt {path/to/your/checkpoint}
, note --dataset voc2007
option in the command above.
By the way, pre-trained models are trained for COCO dataset only and not for VOC dataset. This may lead to sub-optimal performance (ideally you would either want to train only on VOC trainval or VOC trainval + COCO). So it is recommended that you train your own model first.
When I tried to use pre-trained models of COCO dataset on the test script with VOC, I received this error: RuntimeError: The expanded size of the tensor (21) must match the existing size (81) at non-singleton dimension 0. Target sizes: [21, 1024]. Tensor sizes: [81, 1024]
I am guessing this is a mismatch between number of classes in VOC dataset and the pretrained weight?? Am I right about this ? and is there a way around this or should I train the network?
Yes. The pretrained models will have 81 output classes (corresponding to the COCO classes) whereas the VOC based model would expect 21 classes. You would need to train the model from scratch (using ImageNet pretrained backbone).
For training from scratch, please follow the instructions given in the Readme.
Ok! Thanks @adityaarun1!
Hi! I am trying to use voc dataset to infer test images. It works fine with the coco dataset! I am exploring the code and its abilities as I ultimately want to use a custom dataset and classes! So, I was trying to visualize the training performance of VOC2007 on the infer_simple.py. But its not possible as the infer_simple.py only accepts coco or keypoints coco as the acceptable dataset. Am I doing something wrong here?