-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Feature] Support TTA #9452
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
Merged
Merged
[Feature] Support TTA #9452
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
bc399c9
update
zytx121 30c7af3
update
zytx121 0c7842f
add TwoStageTestTimeAugModel
zytx121 4d5dc5d
update
zytx121 fbce281
update
zytx121 ad5bb46
support dataset wrapper
zytx121 0c0b508
update
zytx121 0818991
update
zytx121 221aa26
add UT
zytx121 0ced7f6
Update test_tta.py
zytx121 8a24cbb
update config
zytx121 7517f84
update
zytx121 a296829
Update det_tta.py
zytx121 a609618
update doc
zytx121 aaa75b0
Update test.md
zytx121 5425bab
update
zytx121 9322d0a
update doc
zytx121 2a509cc
move tta config
zytx121 cf4384f
fix
zytx121 8aa8194
Update docs/en/user_guides/test.md
RangiLyu 63a68ab
Update docs/en/user_guides/test.md
zytx121 00876dd
update
zytx121 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
configs/centernet/centernet_r18-dcnv2_8xb16-crop512-140e_coco.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # This is different from the TTA of official CenterNet. | ||
|
|
||
| tta_model = dict( | ||
| type='DetTTAModel', | ||
| tta_cfg=dict(nms=dict(type='nms', iou_threshold=0.5), max_per_img=100)) | ||
|
|
||
| tta_pipeline = [ | ||
| dict( | ||
| type='LoadImageFromFile', | ||
| to_float32=True, | ||
| file_client_args=dict(backend='disk')), | ||
| dict( | ||
| type='TestTimeAug', | ||
| transforms=[ | ||
| [ | ||
| # ``RandomFlip`` must be placed before ``RandomCenterCropPad``, | ||
| # otherwise bounding box coordinates after flipping cannot be | ||
| # recovered correctly. | ||
| dict(type='RandomFlip', prob=1.), | ||
| dict(type='RandomFlip', prob=0.) | ||
| ], | ||
| [ | ||
| dict( | ||
| type='RandomCenterCropPad', | ||
| ratios=None, | ||
| border=None, | ||
| mean=[0, 0, 0], | ||
| std=[1, 1, 1], | ||
| to_rgb=True, | ||
| test_mode=True, | ||
| test_pad_mode=['logical_or', 31], | ||
| test_pad_add_pix=1), | ||
| ], | ||
| [ | ||
| dict( | ||
| type='PackDetInputs', | ||
| meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', | ||
| 'flip', 'flip_direction', 'border')) | ||
| ] | ||
| ]) | ||
| ] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| tta_model = dict( | ||
| type='DetTTAModel', | ||
| tta_cfg=dict(nms=dict(type='nms', iou_threshold=0.5), max_per_img=100)) | ||
|
|
||
| img_scales = [(1333, 800), (666, 400), (2000, 1200)] | ||
| tta_pipeline = [ | ||
| dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')), | ||
| dict( | ||
| type='TestTimeAug', | ||
| transforms=[[ | ||
| dict(type='Resize', scale=s, keep_ratio=True) for s in img_scales | ||
| ], [ | ||
| dict(type='RandomFlip', prob=1.), | ||
| dict(type='RandomFlip', prob=0.) | ||
| ], | ||
| [ | ||
| dict( | ||
| type='PackDetInputs', | ||
| meta_keys=('img_id', 'img_path', 'ori_shape', | ||
| 'img_shape', 'scale_factor', 'flip', | ||
| 'flip_direction')) | ||
| ]]) | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| tta_model = dict( | ||
| type='DetTTAModel', | ||
| tta_cfg=dict(nms=dict(type='nms', iou_threshold=0.6), max_per_img=100)) | ||
|
|
||
| img_scales = [(640, 640), (320, 320), (960, 960)] | ||
| tta_pipeline = [ | ||
| dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')), | ||
| dict( | ||
| type='TestTimeAug', | ||
| transforms=[ | ||
| [ | ||
| dict(type='Resize', scale=s, keep_ratio=True) | ||
| for s in img_scales | ||
| ], | ||
| [ | ||
| # ``RandomFlip`` must be placed before ``Pad``, otherwise | ||
| # bounding box coordinates after flipping cannot be | ||
| # recovered correctly. | ||
| dict(type='RandomFlip', prob=1.), | ||
| dict(type='RandomFlip', prob=0.) | ||
| ], | ||
| [ | ||
| dict( | ||
| type='Pad', | ||
| size=(960, 960), | ||
| pad_val=dict(img=(114, 114, 114))), | ||
| ], | ||
| [ | ||
| dict( | ||
| type='PackDetInputs', | ||
| meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', | ||
| 'scale_factor', 'flip', 'flip_direction')) | ||
| ] | ||
| ]) | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| tta_model = dict( | ||
| type='DetTTAModel', | ||
| tta_cfg=dict(nms=dict(type='nms', iou_threshold=0.65), max_per_img=100)) | ||
|
|
||
| img_scales = [(640, 640), (320, 320), (960, 960)] | ||
| tta_pipeline = [ | ||
| dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')), | ||
| dict( | ||
| type='TestTimeAug', | ||
| transforms=[ | ||
| [ | ||
| dict(type='Resize', scale=s, keep_ratio=True) | ||
| for s in img_scales | ||
| ], | ||
| [ | ||
| # ``RandomFlip`` must be placed before ``Pad``, otherwise | ||
| # bounding box coordinates after flipping cannot be | ||
| # recovered correctly. | ||
| dict(type='RandomFlip', prob=1.), | ||
| dict(type='RandomFlip', prob=0.) | ||
| ], | ||
| [ | ||
| dict( | ||
| type='Pad', | ||
| pad_to_square=True, | ||
| pad_val=dict(img=(114.0, 114.0, 114.0))), | ||
| ], | ||
| [ | ||
| dict( | ||
| type='PackDetInputs', | ||
| meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', | ||
| 'scale_factor', 'flip', 'flip_direction')) | ||
| ] | ||
| ]) | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| # Copyright (c) OpenMMLab. All rights reserved. | ||
| from .det_tta import DetTTAModel | ||
| from .merge_augs import (merge_aug_bboxes, merge_aug_masks, | ||
| merge_aug_proposals, merge_aug_results, | ||
| merge_aug_scores) | ||
|
|
||
| __all__ = [ | ||
| 'merge_aug_bboxes', 'merge_aug_masks', 'merge_aug_proposals', | ||
| 'merge_aug_scores', 'merge_aug_results' | ||
| 'merge_aug_scores', 'merge_aug_results', 'DetTTAModel' | ||
| ] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.