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

HUB dataset_stats() error reporting #8192

Merged
merged 4 commits into from
Jun 17, 2022
Merged

HUB dataset_stats() error reporting #8192

merged 4 commits into from
Jun 17, 2022

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Jun 13, 2022

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Enhancing dataset yaml loading robustness in dataloaders.py.

πŸ“Š Key Changes

  • Wrapped yaml loading inside a try block.
  • Added an except block to raise a specific exception on yaml loading failure.

🎯 Purpose & Impact

  • Purpose: To provide a more clear and user-friendly error message if there are issues loading the dataset yaml file.
  • Impact: Users will encounter a more descriptive error when yaml loading fails, making debugging easier and improving overall user experience. πŸ› οΈ

@glenn-jocher
Copy link
Member Author

@kalenmike how's this?

@kalenmike
Copy link
Member

@glenn-jocher It will work great to check for YAML parse errors, but can we handle for the other errors as well? Like the paths don't exist for example.

@glenn-jocher
Copy link
Member Author

@kalenmike hmm, most of the finer checks are run by the default YOLOv5 function here:

check_dataset(data, autodownload) # download dataset if missing

It looks like only the val path is specifically checked though. We could expand to all parts of the dataset: train, val, test:
i.e. L485

yolov5/utils/general.py

Lines 472 to 487 in 6a67594

# Resolve paths
path = Path(extract_dir or data.get('path') or '') # optional 'path' default to '.'
if not path.is_absolute():
path = (ROOT / path).resolve()
for k in 'train', 'val', 'test':
if data.get(k): # prepend path
data[k] = str(path / data[k]) if isinstance(data[k], str) else [str(path / x) for x in data[k]]
# Parse yaml
train, val, test, s = (data.get(x) for x in ('train', 'val', 'test', 'download'))
if val:
val = [Path(x).resolve() for x in (val if isinstance(val, list) else [val])] # val path
if not all(x.exists() for x in val):
LOGGER.info(emojis('\nDataset not found ⚠, missing paths %s' % [str(x) for x in val if not x.exists()]))
if not s or not autodownload:
raise Exception(emojis('Dataset not found ❌'))

@glenn-jocher glenn-jocher merged commit d605138 into master Jun 17, 2022
@glenn-jocher glenn-jocher deleted the update/hub_errors branch June 17, 2022 16:37
@glenn-jocher
Copy link
Member Author

@kalenmike PR merged to avoid letting it linger. Will update HUB tag to master and we can work on additional error reporting next week.

ctjanuhowski pushed a commit to ctjanuhowski/yolov5 that referenced this pull request Sep 8, 2022
* HUB dataset_stats() error reporting

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update dataloaders.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@awetzel-lionpower
Copy link

I am currently getting the generic "Failed: Processing Error". Wondering if the more detailed error reporting has been finished. My data works fine with yolov5.

@glenn-jocher
Copy link
Member Author

@awetzel-lionpower glad your data works with YOLOv5! We've enhanced error reporting with the latest changes. Please update to the latest version and provide the specific error message if the issue persists. Always happy to help!

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