facebookresearch / detectron2

Detectron2 is a platform for object detection, segmentation and other visual recognition tasks.
https://detectron2.readthedocs.io/en/latest/
Apache License 2.0
30.54k stars 7.49k forks source link

Beginner trying to train a model #1364

Closed pollyMath closed 4 years ago

pollyMath commented 4 years ago

After completing the balloons tutorial, I tried to use the same structure to train a model for a different use case.

However, there are some things which I don't understand why they work the way they do, so if anyone can kindly explain them to me, would be greatly appreciated!

  1. To test if code structure was okay I tried using the same small set of data (about 6 files) for both training and testing. I expected that after the training (even after 1 iteration), if I evaluate the model on the same data, it will have recall and precision of 1. But I got 0s, and -100 for APm and APl and I don't understand why. If I use the model on one of the files for test, nothing is recognised. If I increase iterations, I get values different from 0 for the other APs but still -100 APm and APl This happen whether I use some pretrained weights from the detectron2 or training from scratch. Shouldn't I get recall and precision of 1 no matter the iterations if using same data for training and testing and why?

  2. My dataset uses boxes only, so no mask. I have set in my yaml config mask_on to False. However, I am using COCO-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_3x as starting weights config. I tried using COCO-Detection/faster_rcnn_X_101_32x8d_FPN_3x.yaml but it got stuck during training for even for 1 iteration only. I am not really sure whether using mask_rcnn with dataset with boxes only has any impact as opposed to using faster_rcnn.

  3. I couldn't find a good place to find detailed information for the yaml config. I don't understand what is SOLVER.STEPS and how to modify config file to get better results.

  4. There is a DefaultTrainer and Trained. As far as I understand, the latter has build_evaluator method implemented. How does it impact when u train data? Is this evaluator used after the training is done (i.e. you don't have to explicitly called the evaluator as in the balloons tutorial) or does it play some special role during the training?

Sorry if some of the questions are nooby ^^''

ppwwyyxx commented 4 years ago

Shouldn't I get recall and precision of 1 no matter the iterations

No. This question is not related to detectron2.

whether using mask_rcnn with dataset with boxes only has any impact

It has no impact as long as MASK_ON was set False.

a good place to find detailed information for the yaml config.

The documentation: https://detectron2.readthedocs.io/modules/config.html#config-references

Is this evaluator used after the training is done (i.e. you don't have to explicitly called the evaluator as in the balloons tutorial) or does it play some special role during the training?

It's used after training, unless you have set cfg.TEST.EVAL_PERIOD.