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

where I need to change the code #2463

Closed
Jeyakumar-johnny-jonathan opened this issue Jan 8, 2021 · 4 comments
Closed

where I need to change the code #2463

Jeyakumar-johnny-jonathan opened this issue Jan 8, 2021 · 4 comments

Comments

@Jeyakumar-johnny-jonathan

hi this is my error , do you know how to solve it?

detectron2.data.detection_utils.SizeMismatchError: Mismatched (W,H) for image /content/data/Images/137.jpg, got (3264, 2448), expect (2448, 3264)

Originally posted by @morestart in #194 (comment)

@farazk86
Copy link

farazk86 commented Jan 8, 2021

Its best to give more info related to your problem. How are you calling the function? Show your code.

Just from this error, its clear that you have your H and W mixed up. But would need more info to give proper response.

@morestart
Copy link

change another annotation tool and retry

@ppwwyyxx ppwwyyxx added the needs-more-info More info is needed to complete the issue label Jan 9, 2021
@github-actions
Copy link

Requested information was not provided in 7 days, so we're closing this issue.

@github-actions github-actions bot removed the needs-more-info More info is needed to complete the issue label Jan 16, 2021
@CarlBhy
Copy link

CarlBhy commented Mar 19, 2021

hi,i have solved this problem.This bad code is in the detectron2-master/detectron2/data/detection_utils.py line 186 to 209,I will post my modified code later.I think this error will not affect our training model, so I commented out part of the code and successfully solved the problem.

`def check_image_size(dataset_dict, image):
"""
Raise an error if the image does not match the size specified in the dict.
"""
if "width" in dataset_dict or "height" in dataset_dict:
image_wh = (image.shape[1], image.shape[0])
# expected_wh = (dataset_dict["width"], dataset_dict["height"])
# if not image_wh == expected_wh:
# raise SizeMismatchError(
# "Mismatched image shape{}, got {}, expect {}.".format(
# " for image " + dataset_dict["file_name"]
# if "file_name" in dataset_dict
# else "",
# image_wh,
# expected_wh,
# )
# + " Please check the width/height in your annotation."
# )

# To ensure bbox always remap to original image size
if "width" not in dataset_dict:
    dataset_dict["width"] = image.shape[1]
if "height" not in dataset_dict:
    dataset_dict["height"] = image.shape[0]`

Hope my answer is useful for you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants