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

Can't resize annotation text size and color of text #13499

Open
1 task done
MakMoinee opened this issue Jan 23, 2025 · 2 comments
Open
1 task done

Can't resize annotation text size and color of text #13499

MakMoinee opened this issue Jan 23, 2025 · 2 comments
Labels
question Further information is requested

Comments

@MakMoinee
Copy link

Search before asking

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

@MakMoinee MakMoinee added the question Further information is requested label Jan 23, 2025
@UltralyticsAssistant
Copy link
Member

👋 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):

Status

YOLOv5 CI

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 🙂

@pderrenger
Copy link
Member

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants