Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FasterRCNN improved weights #5763

Merged
merged 4 commits into from
Apr 6, 2022
Merged

Conversation

datumbox
Copy link
Contributor

@datumbox datumbox commented Apr 6, 2022

Fixes #5307

Adds new pre-trained weights for FasterRCNN + ResNet50 + FPN for the v2 variant with post-paper optimizations (no FrozenBN + c5 instead of p5 input on extra layers + heavier RPN/Box Heads with BNs). It improves the previous baseline by +9.7 mAP.

Trained with:

python -u run_with_submitit.py --ngpus 8 --nodes 4 --dataset coco --model fasterrcnn_resnet50_fpn_v2 \
--epochs 400 --lr-steps 352 384 --lr 0.1 --batch-size 2 --weight-decay 0.00004 --sync-bn \
--data-augmentation lsj 

Verified with:

torchrun --nproc_per_node=1 train.py --test-only --weights FasterRCNN_ResNet50_FPN_V2_Weights.COCO_V1 \
--model fasterrcnn_resnet50_fpn_v2 -b 1

IoU metric: bbox
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.467
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.673
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.511
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.303
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.506
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.602
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.366
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.579
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.609
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.441
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.645
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.754

@datumbox datumbox marked this pull request as ready for review April 6, 2022 12:55
Copy link
Contributor

@YosuaMichael YosuaMichael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@datumbox datumbox merged commit 3f62b5c into pytorch:main Apr 6, 2022
@datumbox datumbox deleted the modes/fasterrcnn branch April 6, 2022 16:28
facebook-github-bot pushed a commit that referenced this pull request May 5, 2022
Summary:
* Add FasterRCNN improved weights

* Add recipe URL

* Update publication_year field

(Note: this ignores all push blocking failures!)

Reviewed By: jdsgomes, NicolasHug

Differential Revision: D36095675

fbshipit-source-id: e8513c22da8e14419de0749b8085ee587ff11d84
@santhoshnumberone
Copy link

@datumbox
Does this mean that the current best pre trained model available on pytorch is Faster R-CNN ResNet-50 FPN version 2 with mAP of 46.7 surpassing the previous best FCOS ResNet-50 FPN of 39.2?

Could you please provide the link to the code and the pre-trained of Faster R-CNN ResNet-50 FPN version 2

@datumbox
Copy link
Contributor Author

datumbox commented May 11, 2022

@santhoshnumberone Yes but keep in mind that the FCOS was not retrained. It's likely we can do better with it as well if we review the training recipe but that will be reviewed on the future.

Could you please provide the link to the code and the pre-trained of Faster R-CNN ResNet-50 FPN version 2

The description of this PR gives you all this info. Use the latest main of TorchVision.

@santhoshnumberone
Copy link

@datumbox off the topic

Can't wait to see this DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection paper retrained by you in future
Screenshot 2022-05-11 at 4 56 39 PM

@datumbox
Copy link
Contributor Author

@santhoshnumberone We have a dedicated issue for getting such requests at #2707

I strongly recommend commenting the same thing there so that you get visibility and consider it on the future. Having this discussion here is likely to be forgotten/lost.

@pvti
Copy link

pvti commented Sep 17, 2024

Hi @datumbox, I'm trying to reproduce this result (fasterrcnn_resnet50_fpn_v2, mAP=46.7) with torchvision 0.19.1. I have two questions:

  1. Here (Add FasterRCNN improved weights #5763 (comment)) you mention using run_with_submitit.py, but this script doesn’t seem to be included. Should I substitute it with train.py instead?

  2. I’m training on a single machine with 8xV100 GPUs, whereas your configuration uses 4 nodes with 2 GPUs each. How should I adjust the hyperparameters, particularly the learning rate and batch size? The default values in train.py (

    parser.add_argument(
    ) differ from those in your setup.

Thank you for your help and clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve the accuracy of Detection & Segmentation models by using SOTA recipes and primitives
5 participants