hiyouga / hiyouga/Image-Segmentation-PyTorch

Issue : Missing Error Handling for Image Opening in `ImageDataset`

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
16
Forks
4
PR merge metrics
No merged PRs in 30d

Description

The `ImageDataset` class opens images using `Image.open(impath)`. However, it lacks error handling for cases where the image file is corrupted or doesn't exist. This can lead to program crashes during training or validation. Add a `try-except` block to handle potential `FileNotFoundError` or `PIL.UnidentifiedImageError` exceptions and log the error. Consider skipping the problematic image or raising an exception to halt execution, depending on the desired behavior.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.