facebookresearch / Detectron

FAIR's research platform for object detection research, implementing popular algorithms like Mask R-CNN and RetinaNet.
Apache License 2.0
26.23k stars 5.45k forks source link

perform training on negative samples (images with no annotation) #869

Open gcheron opened 5 years ago

gcheron commented 5 years ago

@ir413 , @JiYuanFeng , this allows the use of negative samples in training when setting TRAIN.INCLUDE_BKG_IMAGES = True (related to #697 )

facebook-github-bot commented 5 years ago

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

facebook-github-bot commented 5 years ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

pkhigh commented 5 years ago

@gcheron I have tried to train a RETINANET model with your pr_negative_samples branch. But I get the following error while loading the data :

[I net_dag_utils.cc:102] Operator graph pruning prior to chain compute took: 0.000376701 secs INFO train.py: 180: Outputs saved to: /home/roadzen/ParasWork/MobileData/v4/RETINA_MODELS/train/coco_2014_train/retinanet INFO loader.py: 230: Pre-filling mini-batch queue... INFO loader.py: 235: [0/64] Traceback (most recent call last): File "/home/roadzen/ParasWork/Detectron/detectron/utils/coordinator.py", line 50, in stop_on_exception yield File "/home/roadzen/ParasWork/Detectron/detectron/roi_data/loader.py", line 101, in minibatch_loader_thread blobs = self.get_next_minibatch() File "/home/roadzen/ParasWork/Detectron/detectron/roi_data/loader.py", line 134, in get_next_minibatch blobs, valid = get_minibatch(minibatch_db) File "/home/roadzen/ParasWork/Detectron/detectron/roi_data/minibatch.py", line 81, in get_minibatch blobs, im_scales, roidb, im_width, im_height File "/home/roadzen/ParasWork/Detectron/detectron/roi_data/retinanet.py", line 109, in add_retinanet_blobs 'Empty ground truth empty for image is not allowed. Please check.' AssertionError: Empty ground truth empty for image is not allowed. Please check. INFO loader.py: 113: Stopping mini-batch loading thread INFO loader.py: 113: Stopping mini-batch loading thread INFO loader.py: 113: Stopping mini-batch loading thread INFO loader.py: 113: Stopping mini-batch loading thread CRITICAL train.py: 98: roi_data_loader failed Traceback (most recent call last): File "tools/train_net.py", line 132, in main() File "tools/train_net.py", line 114, in main checkpoints = detectron.utils.train.train_model() File "/home/roadzen/ParasWork/Detectron/detectron/utils/train.py", line 64, in train_model handle_critical_error(model, 'roi_data_loader failed') File "/home/roadzen/ParasWork/Detectron/detectron/utils/train.py", line 100, in handle_critical_error raise Exception(msg) Exception: roi_data_loader failed

pkhigh commented 5 years ago

It looks like you have done changes for RPN.py i.e. models which use RPNs will only be able to use this feature. There are on changes in "roi_data/retinanet.py" therefore this error occurs. Can you suggest the changes to be made in roi_data/retinanet.py so that I can train it with background images?