Can't resize annotation text size and color of text
Search before asking
- [x] I have searched the YOLOv5 issues and discussions and found no similar questions.
Question
Hi, I'm having trouble with the annotation. please provide me fix or code to make this code below work:. how did you guys work it out?
model = torch.hub.load('ultralytics/yolov5', 'custom', path='./result.pt', verbose=False) results = model(image)
This is the only implementation it works so if you could find workaround please help me
Additional
No response
👋 Hello @MakMoinee, thank you for your interest in YOLOv5 🚀!
Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.
If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it. If you're looking to modify inference display properties like annotation text size or color, this may require some adjustments in the code outputs, and further detail on your implementation will help us guide you more effectively.
If this is a custom training ❓ Question, please provide as much information as possible, such as:
- Code snippet of your attempt
- Dataset image examples (if relevant)
- Any logs or error messages encountered
Also, verify you're following our Tips for Best Training Results.
Requirements
Ensure your environment meets the following minimum requirements:
Python>=3.8.0 with all requirements.txt installed, including PyTorch>=1.8. To get started:
git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install
Environments
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies like CUDA/CUDNN, Python and PyTorch preinstalled):
- Notebooks with free GPU:
- Google Cloud Deep Learning VM. See GCP Quickstart Guide
- Amazon Deep Learning AMI. See AWS Quickstart Guide
- Docker Image. See Docker Quickstart Guide
Status
If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on macOS, Windows, and Ubuntu every 24 hours and on every commit.
This is an automated response 🤖. An Ultralytics engineer will review your query and provide additional support as soon as possible 🙂
@MakMoinee to modify the annotation text size and color, you can use the .plot() method from the results object and customize parameters like font_size and font. For example:
results = model(image)
for result in results:
annotated_image = result.plot(font_size=20, font='Arial.ttf') # Adjust font size and type
If you're working with bounding box annotations, the Annotator class also allows direct control over text and box attributes. For additional details, refer to the results.plot documentation or the annotator utilities.
Let us know if you need further clarification!
👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.
For additional resources and information, please see the links below:
- Docs: https://docs.ultralytics.com
- HUB: https://hub.ultralytics.com
- Community: https://community.ultralytics.com
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLO 🚀 and Vision AI ⭐