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(utils): missing edge when resample segments #8092

Merged
merged 2 commits into from
Jun 9, 2022

Conversation

HRan2004
Copy link
Contributor

@HRan2004 HRan2004 commented Jun 3, 2022

One small problem. When resample segments, missing an edge from the last point to the first.
Eg: https://github.com/HRan2004/Yolo-ArbV2/blob/main/data/images/debug01.png
When the polygon is cut, the missing edge will lead to the wrong position of the GT box.

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Enhancement to segment resampling in the YOLOv5 codebase.

πŸ“Š Key Changes

  • Added a line of code to ensure that the first point of a segment is repeated at the end, completing the loop before resampling.

🎯 Purpose & Impact

  • Ensures that closed segments (like those forming polygons) properly connect by including the starting point at the end before interpolation.
  • This small but critical update may improve the accuracy of geometric operations or analyses performed on these segments.
  • Users dealing with polygonal data representations will benefit from more accurate resampling, impacting tasks such as object detection or segmentation in images. 🌐✨

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 @HRan2004, 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 upstream/master. If your PR is behind upstream/master an automatic GitHub Actions merge may be attempted by writing /rebase in a new comment, or by running the following code, replacing 'feature' with the name of your local branch:
git remote add upstream https://github.com/ultralytics/yolov5.git
git fetch upstream
# git checkout feature  # <--- replace 'feature' with local branch name
git merge upstream/master
git push -u origin -f
  • βœ… Verify all 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

@glenn-jocher
Copy link
Member

@HRan2004 thanks for the PR! Have you trained this successfully with a segmented dataset?

@HRan2004
Copy link
Contributor Author

HRan2004 commented Jun 5, 2022

@glenn-jocher I did not directly use yolov5 to train the segment dataset, but I successfully trained on the modified model and found the bug at this time. There are many modifications, and the GT box is not generated by segment, but predicted the segment directly.

Repos address (https://github.com/HRan2004/Yolo-ArbV2)

@glenn-jocher
Copy link
Member

@HRan2004 got it, thank you! I will train a segmented dataset to verify.

@glenn-jocher
Copy link
Member

Temp experiment tracking at https://wandb.ai/glenn-jocher/test-segmentfix

@glenn-jocher
Copy link
Member

@HRan2004 PR shows improved results on segmentation dataset training:
Screenshot 2022-06-09 at 10 50 48

@glenn-jocher glenn-jocher merged commit cf298fb into ultralytics:master Jun 9, 2022
@glenn-jocher
Copy link
Member

@HRan2004 PR is merged. It looks like you found and fixed a significant bug in segmentation training! Thank you for your contributions to YOLOv5 πŸš€ and Vision AI ⭐

tdhooghe pushed a commit to tdhooghe/yolov5 that referenced this pull request Jun 10, 2022
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
ctjanuhowski pushed a commit to ctjanuhowski/yolov5 that referenced this pull request Sep 8, 2022
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
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