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 dataloader filepath modification to perform replace only once and not for all occurences of string #10163

Merged
merged 4 commits into from
Nov 15, 2022

Conversation

adumrewal
Copy link
Contributor

@adumrewal adumrewal commented Nov 15, 2022

Issue:

  • Loading train/val data from parent/sibling folders
    • When you want to load training data in the following form: ./../../datasets/coco128/images/train/1.jpg
    • The current implementation replaces all occurrences of ./ with parent path

Fix:

  • Replace only the first occurrence of ./ with parent path

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Improvement in path handling for dataset loading in YOLOv5.

πŸ“Š Key Changes

  • Adjusted the method that converts local paths to global paths within the dataset loader code.
  • Changed string replacement logic to ensure it correctly transforms local paths starting with './' to their global equivalent by replacing only the first instance of './'.

🎯 Purpose & Impact

  • Ensures robust and accurate file path conversion across different operating systems and environments.
  • Users should experience more reliable dataset loading, especially when local paths are used.
  • Reduces potential bugs related to path handling that could affect model training and evaluation. πŸ›βž‘οΈπŸš«

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

πŸ‘‹ Hello @adumrewal, thank you for submitting a YOLOv5 πŸš€ PR! To allow your work to be integrated as seamlessly as possible, we advise you to:

  • βœ… Verify your PR is up-to-date with ultralytics/yolov5 master branch. If your PR is behind you can update your code by clicking the 'Update branch' button or by running git pull and git merge master locally.
  • βœ… Verify all YOLOv5 Continuous Integration (CI) checks are passing.
  • βœ… Reduce changes to the absolute minimum required for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." β€” Bruce Lee

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
@glenn-jocher
Copy link
Member

@adumrewal first instance only, got it, very nice fix.

@glenn-jocher glenn-jocher merged commit 5e03f5f into ultralytics:master Nov 15, 2022
@glenn-jocher
Copy link
Member

@adumrewal PR is merged. Thank you for your contributions to YOLOv5 πŸš€ and Vision AI ⭐

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

2 participants