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

How to change the thickness & the transparency of the bounding boxes ? #13412

Open
1 task done
andreade11 opened this issue Nov 11, 2024 · 3 comments
Open
1 task done
Labels
detect Object Detection issues, PR's question Further information is requested

Comments

@andreade11
Copy link

Search before asking

Question

Basically i would like my bounding boxes to become nearly transparent as my program is to detect text that is near them and sometimes they hide the text and my OCR model cannot detect them completely. So ideally I would like to make them nearly transparent or with the smallest thickness possible. I tried looking in detect.py and changing the line_thickness=1 but it doesnt produce anything...

Additional

No response

@andreade11 andreade11 added the question Further information is requested label Nov 11, 2024
@UltralyticsAssistant UltralyticsAssistant added the detect Object Detection issues, PR's label Nov 11, 2024
@UltralyticsAssistant
Copy link
Member

👋 Hello @andreade11, thank you for your interest in YOLOv5 🚀! This is an automated response to help get you started. An Ultralytics engineer will also assist you soon.

To adjust the thickness and transparency of bounding boxes in YOLOv5, you might need to modify certain parts of the code, such as in the detect.py script. If simply changing line_thickness didn't yield the desired results, you may want to ensure that your adjustments are in the correct sections of the code where the boxes are actually drawn.

For a more precise solution, please provide a minimum reproducible example with details on how you're invoking the detection and where exactly you've tried to make changes. This will greatly help us in debugging the issue.

For customizations and visualization improvements, make sure your setup satisfies all requirements. YOLOv5 is compatible with Python 3.8 and above, and requires all necessary packages as listed in our requirements.txt.

You can also try running YOLOv5 in any of our verified environments, including web-based notebooks or cloud services, where all dependencies are pre-installed. Check if similar behavior is observed in these environments to rule out local setup issues.

If CI tests are passing (indicated by a green badge), YOLOv5 functionalities related to training, validation, inference, and export are working as expected across various platforms.

Thanks for your patience and hope you find this information helpful! 😊

@andreade11
Copy link
Author

👋 Hello @andreade11, thank you for your interest in YOLOv5 🚀! This is an automated response to help get you started. An Ultralytics engineer will also assist you soon.

To adjust the thickness and transparency of bounding boxes in YOLOv5, you might need to modify certain parts of the code, such as in the detect.py script. If simply changing line_thickness didn't yield the desired results, you may want to ensure that your adjustments are in the correct sections of the code where the boxes are actually drawn.

For a more precise solution, please provide a minimum reproducible example with details on how you're invoking the detection and where exactly you've tried to make changes. This will greatly help us in debugging the issue.

For customizations and visualization improvements, make sure your setup satisfies all requirements. YOLOv5 is compatible with Python 3.8 and above, and requires all necessary packages as listed in our requirements.txt.

You can also try running YOLOv5 in any of our verified environments, including web-based notebooks or cloud services, where all dependencies are pre-installed. Check if similar behavior is observed in these environments to rule out local setup issues.

If CI tests are passing (indicated by a green badge), YOLOv5 functionalities related to training, validation, inference, and export are working as expected across various platforms.

Thanks for your patience and hope you find this information helpful! 😊

I changed line_thickness=1 in the def run() function

@pderrenger
Copy link
Member

@andreade11 to adjust the transparency of bounding boxes, you can modify the plot_one_box function in utils/plots.py to include an alpha channel for transparency. For thickness, ensure line_thickness is set correctly in the detect.py script. If changes aren't reflecting, double-check that you're editing the correct instance of the function where the boxes are drawn. If you need further assistance, please provide a minimal reproducible example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
detect Object Detection issues, PR's question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants