Closed YoungjaeDev closed 2 years ago
👋 Hello @youngjae-avikus, 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 screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.
If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.
For business inquiries or professional support requests please visit https://ultralytics.com or email support@ultralytics.com.
Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started:
git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.
@youngjae-avikus 👋 Hello! Thanks for asking about model anchors. YOLOv5 🚀 uses a new Ultralytics algorithm called AutoAnchor for anchor verification and generation before training starts.
Autoanchor will analyse your anchors against your dataset and training settings (like --img-size
), and will adjust your anchors as necessary if it determines the original anchors are a poor fit, or if an anchor count was specified in your model.yaml rather than anchor values, i.e.
# Specify anchor count (per layer)
anchors: 3
# --OR-- Specify anchor values manually
anchors:
- [10,13, 16,30, 33,23] # P3/8
- [30,61, 62,45, 59,119] # P4/16
- [116,90, 156,198, 373,326] # P5/32
When generating new anchors, autoanchor first applies a kmeans function against your dataset labels (scaled to your training --img-size
), and uses kmeans centroids as initial conditions for a Genetic Evolution (GE) algorithm. The GE algorithm will evolve all anchors for 1000 generations under default settings, using CIoU loss (same regression loss used during training) combined with Best Possible Recall (BPR) as its fitness function.
No action is required on your part to use autoanchor. If you would like to force manual anchors for any reason, you can skip autoanchor with the --noautoanchor
flag:
python train.py --noautoanchor
For more details on AutoAnchor see: https://github.com/ultralytics/yolov5/blob/master/utils/autoanchor.py
Good luck 🍀 and let us know if you have any other questions!
@glenn-jocher Thank you. Additionally, I would like to know my log Autoanchor 5.13 anchors past thr. Does it mean that BPR is 0.99 when set to Anchor 5?
@youngjae-avikus anchors past threshold counts the number of anchors that match a label on average for your dataset.
@glenn-jocher When I read the code related check_anchor, I don't understand how it comes out because I don't understand evolve side, but in conclusion, did past-threshold
say 5 as an anchor that overfits my dataset? Or does 5 mean 5anchors/target? Thank you
5 anchors per target
@glenn-jocher
The image data changes when fine-tuning, but the number of anchor boxes doesn't have to be the same (eg. coco) as before, so it's better to turn on the anchor option, is it right?
👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.
Access additional YOLOv5 🚀 resources:
Access additional Ultralytics ⚡ resources:
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 YOLOv5 🚀 and Vision AI ⭐!
@youngjae-avikus yes, that's correct. It's often helpful to tune the anchor options when fine-tuning on a custom dataset with different characteristics than the original dataset. This can help optimize performance for your specific use case.
Search before asking
Question
Hello, I train with custom dataset, and it has various data size. Therefore, I set it to 4 while using the annotation of anchor from hyp because I wanted to customize it and get higher mAP performance. But I have a question about the autoanchor log.
Thank you
Additional
No response