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

Fix null images #2647

Merged
merged 2 commits into from
Jan 6, 2023
Merged

Fix null images #2647

merged 2 commits into from
Jan 6, 2023

Conversation

zhiqiangdon
Copy link
Contributor

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@@ -499,7 +499,7 @@ def transform_image(
if col_type == ROIS:
processed_data = df[col_name].tolist()
elif col_type in [IMAGE_PATH, IMAGE]:
processed_data = col_value.apply(lambda ele: ele.split(";")).tolist()
processed_data = col_value.apply(lambda ele: str(ele).split(";")).tolist()
Copy link
Collaborator

@tonyhoo tonyhoo Jan 6, 2023

Choose a reason for hiding this comment

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

This will convert the None value to ["None"], will that introduce issue during training as the image can't be loaded or we will just ignore invalid path later on

Copy link
Collaborator

Choose a reason for hiding this comment

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

It will be guarded by

try:
if feature_modalities.get(per_col_name) == IMAGE_BYTEARRAY:
image_feature = BytesIO(img_feature)
else:
image_feature = img_feature
with PIL.Image.open(image_feature) as img:
img = img.convert(image_mode)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We would try to open the images and skip them if failures happen.

Copy link
Collaborator

@sxjscience sxjscience left a comment

Choose a reason for hiding this comment

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

LGTM as a simple fix. However, we will need to handle/test missing values for all column types (including ROI / entity). Also CC @FANGAreNotGnu @cheungdaven

@github-actions
Copy link

github-actions bot commented Jan 6, 2023

Job PR-2647-acb6764 is done.
Docs are uploaded to http://autogluon-staging.s3-website-us-west-2.amazonaws.com/PR-2647/acb6764/index.html

@sxjscience sxjscience merged commit 23c4514 into autogluon:master Jan 6, 2023
@zhiqiangdon zhiqiangdon deleted the mm-fix branch January 6, 2023 05:33
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.

None yet

3 participants