Instructions to use DrChenChen/Apple_Resister_YOLO with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use DrChenChen/Apple_Resister_YOLO with ultralytics:
from huggingface_hub import hf_hub_download from ultralytics import YOLO # pick the weights file from this repo's "Files and versions" tab weights = hf_hub_download("DrChenChen/Apple_Resister_YOLO", "<weights>.pt") model = YOLO(weights) source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
- Apple + resistor-band detection: YOLOv8s / YOLO11s / YOLO26s
- Files
- 1. Baseline comparison (original test split, 45 images)
- 2. Bayesian hyper-parameter search
- 3. Baseline vs tuned (original test split)
- 4. Final test on ResisterTest (own phone photos, never used for training or tuning)
- 5. Resistor reading on the original test split
- 6. Apple counting (original test split)
- 7. Data check
- Files
Apple + resistor-band detection: YOLOv8s / YOLO11s / YOLO26s
Trained on the dataset DrChenChen/Resister_circle_counting (class 0 = apple, class 1 = resistor_band, one box per colour band). Baselines use default hyper-parameters; tuned models use the best setting from Bayesian optimisation (Optuna TPE, 10 trials x 12 epochs per model, objective = validation mAP50-95 of resistor_band), then 60 epochs. Image size 960, batch 16, single seed.
Known limitation: resistor-band detection generalises poorly to the test photos (domain shift), so resistor values cannot be read reliably yet.
Files
- YOLOv8/, YOLO11/, YOLO26/: baseline runs (weights/best.pt)
- hpo/_tuned/: tuned runs (weights/best.pt); hpo/_trials.csv: all search trials
- resistor_yolo_compare_v2.ipynb, resistor_reader.py: full pipeline incl. classical colour-band reading (GrabCut + PCA axis + Lab colour)
- resister_test/: 15 hand-labelled phone photos (175 band boxes), used only as a final test set
1. Baseline comparison (original test split, 45 images)
| model | params_M | train_min | mAP50 | mAP50_95 | P | R | infer_ms | post_ms | apple_mAP50 | apple_mAP50_95 | resistor_band_mAP50 | resistor_band_mAP50_95 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| YOLOv8 | 11.14 | 33.8 | 0.5131 | 0.303 | 0.6533 | 0.4757 | 19.9232 | 1.4109 | 0.9748 | 0.5886 | 0.0513 | 0.0173 |
| YOLO11 | 9.43 | 39.7 | 0.5136 | 0.3343 | 0.5375 | 0.5211 | 19.6559 | 0.9838 | 0.9971 | 0.6612 | 0.03 | 0.0074 |
| YOLO26 | 9.95 | 45.6 | 0.5436 | 0.342 | 0.6903 | 0.5051 | 21.6626 | 0.9955 | 0.9896 | 0.6325 | 0.0977 | 0.0514 |
Baseline training curves
2. Bayesian hyper-parameter search
Best hyper-parameters per model (first column = Ultralytics default):
| Unnamed: 0 | ultralytics_default | YOLOv8 | YOLO11 | YOLO26 |
|---|---|---|---|---|
| lr0 | 0.01 | 0.00014 | 0.0001 | 0.0001 |
| lrf | 0.01 | 0.29227 | 0.19264 | 0.19264 |
| momentum | 0.937 | 0.89096 | 0.83775 | 0.83775 |
| weight_decay | 0.0005 | 1e-05 | 5e-05 | 5e-05 |
| box | 7.5 | 8.47901 | 9.54761 | 9.54761 |
| cls | 0.5 | 1.13952 | 0.6218 | 0.6218 |
| degrees | 0 | 16.8149 | 9.89733 | 9.89733 |
| scale | 0.5 | 0.61871 | 0.63443 | 0.63443 |
| mosaic | 1 | 0.87443 | 0.98464 | 0.98464 |
| mixup | 0 | 0.14071 | 0.19406 | 0.19406 |
| hsv_v | 0.4 | 0.58014 | 0.33999 | 0.33999 |
YOLOv8: search history and hyper-parameter importance
YOLO11: search history and hyper-parameter importance
YOLO26: search history and hyper-parameter importance
3. Baseline vs tuned (original test split)
| model | version | mAP50 | mAP50_95 | P | R | band_mAP50 | band_mAP50_95 | apple_mAP50_95 | infer_ms |
|---|---|---|---|---|---|---|---|---|---|
| YOLOv8 | baseline | 0.5131 | 0.303 | 0.6533 | 0.4757 | 0.0513 | 0.0173 | 0.5886 | 19.6782 |
| YOLOv8 | tuned | 0.5882 | 0.3306 | 0.7497 | 0.5683 | 0.1866 | 0.0859 | 0.5753 | 20.3944 |
| YOLO11 | baseline | 0.5136 | 0.3343 | 0.5375 | 0.5211 | 0.03 | 0.0074 | 0.6612 | 20.3003 |
| YOLO11 | tuned | 0.5772 | 0.4186 | 0.6623 | 0.5727 | 0.163 | 0.0971 | 0.7401 | 20.4116 |
| YOLO26 | baseline | 0.5436 | 0.342 | 0.6903 | 0.5051 | 0.0977 | 0.0514 | 0.6325 | 21.4193 |
| YOLO26 | tuned | 0.5784 | 0.4201 | 0.7399 | 0.5651 | 0.1707 | 0.1106 | 0.7295 | 21.3366 |
Difference (tuned - baseline):
| model | mAP50 | mAP50_95 | band_mAP50 | band_mAP50_95 | apple_mAP50_95 | P | R |
|---|---|---|---|---|---|---|---|
| YOLOv8 | 0.0751 | 0.0276 | 0.1353 | 0.0686 | -0.0133 | 0.0964 | 0.0926 |
| YOLO11 | 0.0636 | 0.0843 | 0.133 | 0.0897 | 0.0789 | 0.1248 | 0.0516 |
| YOLO26 | 0.0348 | 0.0781 | 0.073 | 0.0592 | 0.097 | 0.0496 | 0.06 |
Baseline vs tuned, test mAP50-95
Validation mAP50-95: baseline (dashed) vs tuned
4. Final test on ResisterTest (own phone photos, never used for training or tuning)
| model | testset | imgsz | band_P | band_R | band_mAP50 | band_mAP50_95 |
|---|---|---|---|---|---|---|
| YOLOv8 (baseline) | ResisterTest | 960 | 0.1194 | 0.0286 | 0.0041 | 0.0005 |
| YOLOv8 (baseline) | ResisterTest | 1920 | 0.2554 | 0.1086 | 0.0427 | 0.0062 |
| YOLOv8 (baseline) | orig test + ResisterTest | 960 | 0.2813 | 0.0122 | 0.0192 | 0.006 |
| YOLO11 (baseline) | ResisterTest | 960 | 0.0889 | 0.0343 | 0.0052 | 0.0008 |
| YOLO11 (baseline) | ResisterTest | 1920 | 0.1831 | 0.1371 | 0.0741 | 0.011 |
| YOLO11 (baseline) | orig test + ResisterTest | 960 | 0.0984 | 0.0366 | 0.0092 | 0.002 |
| YOLO26 (baseline) | ResisterTest | 960 | 0.1539 | 0.0229 | 0.0064 | 0.0013 |
| YOLO26 (baseline) | ResisterTest | 1920 | 0.3314 | 0.1714 | 0.101 | 0.0134 |
| YOLO26 (baseline) | orig test + ResisterTest | 960 | 0.2207 | 0.0528 | 0.0354 | 0.0176 |
| YOLOv8 (tuned) | ResisterTest | 960 | 0.143 | 0.0971 | 0.0238 | 0.0033 |
| YOLOv8 (tuned) | ResisterTest | 1920 | 0.2794 | 0.2343 | 0.1741 | 0.0238 |
| YOLOv8 (tuned) | orig test + ResisterTest | 960 | 0.309 | 0.0569 | 0.0754 | 0.0277 |
| YOLO11 (tuned) | ResisterTest | 960 | 0.139 | 0.0857 | 0.0247 | 0.006 |
| YOLO11 (tuned) | ResisterTest | 1920 | 0.1321 | 0.1771 | 0.0619 | 0.0092 |
| YOLO11 (tuned) | orig test + ResisterTest | 960 | 0.3012 | 0.1016 | 0.0691 | 0.0345 |
| YOLO26 (tuned) | ResisterTest | 960 | 0.1616 | 0.0971 | 0.0382 | 0.0063 |
| YOLO26 (tuned) | ResisterTest | 1920 | 0.3041 | 0.3257 | 0.1741 | 0.0264 |
| YOLO26 (tuned) | orig test + ResisterTest | 960 | 0.231 | 0.0976 | 0.07 | 0.0258 |
ResisterTest: green = hand labels, red = predictions, text = value read by classical processing
5. Resistor reading on the original test split
Detected bands and decoded values
6. Apple counting (original test split)
30 images: MAE = 0.167 apples per image, exact-count accuracy = 83.3%, total ground truth 33 vs predicted 36.
Apples: green = ground truth, blue = prediction (confidence)
7. Data check
Validation labels
Test labels (different resistor type from training: domain shift)
- Downloads last month
- -






