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.46k stars 7.48k forks source link

Logs are printed twice while using plain_train_net.py #691

Closed ghost closed 4 years ago

ghost commented 4 years ago

Instructions To Reproduce the Issue:

  1. Changes made
    
    Copy the cfg parameters to def setup in plain_train_net.py. Used the same balloon dataset. Using Cascade RCNN for object detection from model zoo

cfg = get_cfg() cfg.merge_from_file(model_zoo.get_config_file("Misc/cascade_mask_rcnn_R_50_FPN_3x.yaml")) cfg.DATASETS.TRAIN = ("balloon_train",) cfg.DATASETS.TEST = () cfg.DATALOADER.NUM_WORKERS = 2 cfg.MODEL.WEIGHTS = 'https://dl.fbaipublicfiles.com/detectron2/Misc/cascade_mask_rcnn_R_50_FPN_3x/144998488/model_final_480dd8.pkl' # Let training initialize from model zoo cfg.SOLVER.IMS_PER_BATCH = 2 cfg.SOLVER.BASE_LR = 0.00025 # pick a good LR cfg.SOLVER.MAX_ITER = 300 # 300 iterations seems good enough for this toy dataset; you may need to train longer for a practical dataset cfg.MODEL.ROI_HEADS.BATCH_SIZE_PER_IMAGE = 128 # faster, and good enough for this toy dataset (default: 512) cfg.MODEL.ROI_HEADS.NUM_CLASSES = 1 # only has one class (ballon)

2. Command Run: !python /content/detectron2_repo/tools/plain_train_net.py
3. what you observed (including the full logs):

![twice1](https://user-images.githubusercontent.com/30231581/72261127-43b28f00-363a-11ea-9f18-5b7aa1b1a244.png)
![twice2](https://user-images.githubusercontent.com/30231581/72261757-7446f880-363b-11ea-95a6-80b477fac211.png)

Similarly, environment info, model architecture, and other outputs follow the same behavior. This issue is also seen in log.txt file which is generated.


## Expected behavior:

Outputs should be printed only once.

## Environment info

![env](https://user-images.githubusercontent.com/30231581/72262065-27175680-363c-11ea-9925-9a0238b767bf.png)
ppwwyyxx commented 4 years ago

Changes made ...

I think you made more changes than that, e.g., setup the logger.

The script already setups up the logger by calling https://detectron2.readthedocs.io/modules/engine.html#detectron2.engine.defaults.default_setup