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 TFLite Segment mask rows 1-4 normalization #9405

Merged

Conversation

charlesollion
Copy link
Contributor

@charlesollion charlesollion commented Mar 29, 2024

Update autobackend.py: fix ndim ==3 for tflite to exclude mask tensor
fixes #9385

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Improved tensor handling for non-classification tasks in neural network backend.

📊 Key Changes

  • Adjusted condition for handling tensor dimensions in callbacks: the code now precisely targets tensors with exactly 3 dimensions instead of more than 2.

🎯 Purpose & Impact

  • Enhanced precision: This change aims to exclude 4-dimensional tasks (like masks) from a normalization process meant for non-classification tasks, improving the accuracy for object detection and segmentation models.
  • Better compatibility: Ensures the neural network backend processes only relevant data shapes, leading to fewer errors and potentially faster inference times.
  • Impact: Users working with non-classification tasks (e.g., object detection) may notice improved model performance and accuracy due to more precise data handling.

fix ndim ==3 for tflite to exclude mask tensor
Copy link

github-actions bot commented Mar 29, 2024

CLA Assistant Lite bot All Contributors have signed the CLA. ✅

Copy link

@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 @charlesollion, thank you for submitting an Ultralytics YOLOv8 🚀 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/ultralytics main 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 main locally.
  • ✅ Verify all YOLOv8 Continuous Integration (CI) checks are passing.
  • ✅ Update YOLOv8 Docs for any new or updated features.
  • ✅ 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

See our Contributing Guide for details and let us know if you have any questions!

Copy link

codecov bot commented Mar 29, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 38.85%. Comparing base (30a867b) to head (02f2bfd).

❗ Current head 02f2bfd differs from pull request most recent head 211135a. Consider uploading reports for the commit 211135a to get more accurate results

Files Patch % Lines
ultralytics/nn/autobackend.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9405   +/-   ##
=======================================
  Coverage   38.85%   38.85%           
=======================================
  Files         117      117           
  Lines       14850    14850           
=======================================
  Hits         5770     5770           
  Misses       9080     9080           
Flag Coverage Δ
GPU 38.85% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@charlesollion
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@glenn-jocher
Copy link
Member

@charlesollion thank you for signing the CLA! Your contribution is immensely valuable to the YOLOv8 community. 🌟 If you have any more questions or need further assistance as you contribute, feel free to reach out. Happy coding! 👩‍💻👨‍💻

@Burhan-Q Burhan-Q added the segment Instance Segmentation issues, PR's label Mar 29, 2024
@glenn-jocher
Copy link
Member

@charlesollion thanks! It looks like the CLA message may not have worked. Can you try again with this message:

I have read the CLA Document and I sign the CLA

@charlesollion
Copy link
Contributor Author

I have read the CLA Document and I sign the CLA

@glenn-jocher glenn-jocher changed the title Fix for tflite mask segmentation wrongly scaling the first four upper pixels #9385 Fix TFLite Mask model pixels 1-4 normalization Mar 30, 2024
@glenn-jocher glenn-jocher changed the title Fix TFLite Mask model pixels 1-4 normalization Fix TFLite Segment mask rows 1-4 normalization Mar 30, 2024
@glenn-jocher glenn-jocher merged commit 007f778 into ultralytics:main Mar 30, 2024
9 of 10 checks passed
@glenn-jocher
Copy link
Member

@charlesollion PR merged! Thank you for catching this hard-to-find bug and submitting this fix. Let us know if you spot any other bugs or areas for improvement :)

hmurari pushed a commit to hmurari/ultralytics that referenced this pull request Apr 17, 2024
gkinman pushed a commit to Octasic/ultralytics that referenced this pull request May 30, 2024
puzhiyuan pushed a commit to puzhiyuan/ultralytics that referenced this pull request Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
segment Instance Segmentation issues, PR's
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tflite inference in segmentation wrongly scales the first 4 upper pixels of the image
3 participants