facebookresearch / Detectron

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

Why its result is very poor using faster-rcnn-rpn with my own dataset? #497

Open songzenghui opened 6 years ago

songzenghui commented 6 years ago

I use faster-rcnn-50-rpn to train my own dataset which only has one class ,but the result is very poor.I use the test_net.py to get the mAP score,and it got zero!!! The figure's size is all 1069*500.Train dataset 's size is 10,000+. I run the model for 200,000 iters. Here is my yaml file: MODEL: TYPE: generalized_rcnn CONV_BODY: FPN.add_fpn_ResNet50_conv5_body NUM_CLASSES: 2 FASTER_RCNN: True NUM_GPUS: 1 SOLVER: WEIGHT_DECAY: 0.0001 LR_POLICY: steps_with_decay BASE_LR: 0.0025 GAMMA: 0.1 MAX_ITER: 200000 STEPS: [0, 30000, 40000] FPN: FPN_ON: True MULTILEVEL_ROIS: True MULTILEVEL_RPN: True FAST_RCNN: ROI_BOX_HEAD: fast_rcnn_heads.add_roi_2mlp_head ROI_XFORM_METHOD: RoIAlign ROI_XFORM_RESOLUTION: 7 ROI_XFORM_SAMPLING_RATIO: 2 TRAIN: WEIGHTS: /tmp/detectron-download-cache/ImageNetPretrained/MSRA/R-50.pkl DATASETS: ('coco_2014_train',) SCALES: (500,) MAX_SIZE: 833 BATCH_SIZE_PER_IM: 256 RPN_PRE_NMS_TOP_N: 2000 # Per FPN level OUTPUT_DIR: .

And i modify the dataset_catalog.py to point my dataset

lxq2t commented 6 years ago

Inference is show anything on image? I also have some issue, mask and rcnn shows up zero or related mAP, but inference seems good.

lilichu commented 6 years ago

where is the TEST in the yaml file?

songzenghui commented 6 years ago

Here is my dataset path in dataset_catalog.py : 'coco_2014_train': { _IM_DIR: _DATA_DIR + '/car-1w/train_1w', _ANN_FN: _DATA_DIR + '/car-1w/train_1w.json' }, 'coco_2014_val': { _IM_DIR: _DATA_DIR + '/car/images', _ANN_FN: _DATA_DIR + '/car/annotations/train.json' }, And here is my total yaml file including TEST: TEST: DATASETS: ('coco_2014_val',) SCALE: 500 MAX_SIZE: 833 NMS: 0.5 RPN_PRE_NMS_TOP_N: 1000 # Per FPN level RPN_POST_NMS_TOP_N: 1000

And here is my result of test_net.py: INFO json_dataset_evaluator.py: 222: ~~~~ Mean and per-category AP @ IoU=[0.50,0.95] ~~~~ INFO json_dataset_evaluator.py: 223: 0.0 INFO json_dataset_evaluator.py: 231: 0.0 INFO json_dataset_evaluator.py: 232: ~~~~ Summary metrics ~~~~ Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.000 INFO json_dataset_evaluator.py: 199: Wrote json eval results to: ./test/coco_2014_val/generalized_rcnn/detection_results.pkl INFO task_evaluation.py: 62: Evaluating bounding boxes is done! INFO task_evaluation.py: 181: copypaste: Dataset: coco_2014_val INFO task_evaluation.py: 183: copypaste: Task: box INFO task_evaluation.py: 186: copypaste: AP,AP50,AP75,APs,APm,APl INFO task_evaluation.py: 187: copypaste: 0.0000,0.0000,0.0000,0.0000,0.0000,0.0000

songzenghui commented 6 years ago

Should i modify some parameters? Like max-iters, max-size,lr??? and so on?

songzenghui commented 6 years ago

Here is result of inference: 选区_005.png

lilichu commented 6 years ago

STEPS: [0, 30000, 40000] I guess whether the STEPS is too small so the LR updates too early.

songzenghui commented 6 years ago

Thanks to your reply.Could u tell me the meaning of STEPS? WHY it is a list and WHAT is the meaning of the number in the list? @lilichu

lilichu commented 6 years ago

the LR will update when the iters reach the STEPS.

BASE_LR: 0.0025
GAMMA: 0.1
MAX_ITER: 200000
STEPS: [0, 30000, 40000]

For example, it will change to 0.00025 after 30000 iters and 0.000025 after 40000 iters in your example above. @songzenghui

songzenghui commented 6 years ago

Thank you @lilichu I will try

Jerry3062 commented 6 years ago

@songzenghui Hi: I guess your data format is wrong.

JoshuaLelon commented 6 years ago

In your config file, dumb question:

Is WEIGHTS is under TRAIN? Like this:

TRAIN: ---- WEIGHTS: /tmp/detectron-download-cache/ImageNetPretrained/MSRA/R-50.pkl

Or is it under TEST?

vitasomus commented 6 years ago

hey guys i met same problems on my own datasets, almost got zero map Did u solve it? wish your reply

lssily commented 6 years ago

@songzenghui Hello! I also run test_net.py on COCO dataset. However, when the process finished, I didn't get the meric(AP or AR), just got a .pkl file. Could you tell me how do you get AP?