ultralytics / ultralytics

Ultralytics YOLO11 🚀
https://docs.ultralytics.com
GNU Affero General Public License v3.0
32.81k stars 6.32k forks source link

Bounding box cannot fit #14767

Closed irfanamal closed 3 months ago

irfanamal commented 3 months ago

Search before asking

Question

I am trying to create field detection of passport using pretrained yolov8n. I have dataset consisting of 1000 samples of well-labeled data. After fine tuned the pretrained model on my dataset, I found that it has good mAP50-95 on every label except MRZ line one. Do you know why and how to fix it?

I also attach the validation result. Top one is the ground truth image, the middle one is the prediction, and the bottom one is the validation score. Note: the dataset is synthetic, so it is fake except for the face. Therefore I have to censored it. val_batch1_labels_censored

val_batch1_pred_censored

image

Additional

No response

github-actions[bot] commented 3 months ago

👋 Hello @irfanamal, thank you for your interest in Ultralytics YOLOv8 🚀! We recommend a visit to the Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered.

If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.

Join the vibrant Ultralytics Discord 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users.

Install

Pip install the ultralytics package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.

pip install ultralytics

Environments

YOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

Ultralytics CI

If this badge is green, all Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLOv8 Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

Y-T-G commented 3 months ago

What imgsz are you using?

irfanamal commented 3 months ago

I'm using imgsz = 640. In general, I used default hyperparameters, except for lr0, lrf, and batch which are 1e-3, 1e-6, and 32 respectively

Y-T-G commented 3 months ago

lrf shouldn't be that low. lrf stands for learning rate factor, not final learning rate.

final_lr = lr0 * lrf

irfanamal commented 3 months ago

I see... I'll try to use the default (lr0: 0.01, lrf: 0.01) and give the update

pderrenger commented 3 months ago

Great! Using the default learning rate settings should help. Please let us know how it goes after you make the adjustments. If the issue persists, we can explore other potential solutions.

irfanamal commented 3 months ago

The issue still persists

image

pderrenger commented 3 months ago

Thank you for the update. Since the issue persists, please ensure you are using the latest version of the Ultralytics package. If the problem continues, consider checking the class distribution in your dataset and ensuring that the MRZ line one class is well-represented. Additionally, you might want to experiment with different augmentation techniques to improve the model's ability to generalize. If you need further assistance, feel free to ask.

irfanamal commented 3 months ago

I tried bigger imgsz and it works.

pderrenger commented 3 months ago

Glad to hear that increasing the image size resolved the issue! If you encounter any further problems or have additional questions, feel free to reach out.