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 assert #8982

Merged
merged 3 commits into from
Oct 12, 2022
Merged

add assert #8982

merged 3 commits into from
Oct 12, 2022

Conversation

MambaWong
Copy link
Contributor

When key is not in results may raise an exception.

pipeline = [
    dict(type='LoadImageFromFile', file_client_args=file_client_args),
    dict(type='LoadAnnotations', with_bbox=True),
    dict(
        type='mmdet.PackDetInputs',
        meta_keys=('test'))
]

KeyError: 'test'

MambaWong and others added 2 commits October 11, 2022 13:13
Co-authored-by: RangiLyu <lyuchqi@gmail.com>
Copy link
Collaborator

@BIGWangYuDong BIGWangYuDong left a comment

Choose a reason for hiding this comment

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

LGTM

@ZwwWayne ZwwWayne merged commit aa268b2 into open-mmlab:dev-3.x Oct 12, 2022
@MambaWong MambaWong deleted the PackDetInputs branch October 12, 2022 08:03
@ZwwWayne ZwwWayne added this to the 3.0.0rc2 milestone Oct 21, 2022
@captainIT
Copy link
Contributor

@MambaWong
Copy link
Contributor Author

MambaWong commented Aug 5, 2023

@captainIT
因为通过下面的方式,可以精确的指定想要的key。

dict(
  type='mmdet.PackDetInputs',
  meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
             'scale_factor', 'flip', 'flip_direction')
)

而且大多数情况下,并不需要将result中的key全部包含进来(如你给的链接中的方式)。
直接报错不好吗?用了一个不存在的key,报错够直接。

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

Successfully merging this pull request may close these issues.

6 participants