Run this model with HF Jobs
Run Marley07/YOLO26n-Resistor-Segmentation on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Marley07/YOLO26n-Resistor-Segmentation. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Marley07/YOLO26n-Resistor-Segmentation on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Marley07/YOLO26n-Resistor-Segmentation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use Marley07/YOLO26n-Resistor-Segmentation 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("Marley07/YOLO26n-Resistor-Segmentation", "<weights>.pt") model = YOLO(weights) source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
YOLO26n Resistor Detection and Instance Segmentation
A hybrid computer vision pipeline for detecting, counting, segmenting, extracting and straightening individual resistors from photographs containing multiple electronic components.
Project Overview
Developed as part of a Machine Vision group project at the University of the West of England, Bristol, this repository presents my individual contribution to resistor-body detection and instance segmentation.
The project combines conventional image processing and deep learning to address variations in resistor appearance, orientation, scale, illumination and overlapping metal leads.
Methodology
- Conventional HSV thresholding, morphological processing and contour-based detection
- Automated segmentation polygon generation
- Convex hull refinement and manual annotation verification
- Comparative training of YOLOv8n-seg, YOLO11n-seg and YOLO26n-seg
- Validation-based model selection and confidence threshold optimisation
- Morphological mask refinement and connected component analysis
- Individual resistor extraction
- Mask-based orientation correction and straightening
Dataset
The self-captured dataset contains 181 photographs and 1,286 annotated resistor instances.
| Split | Images | Instances |
|---|---|---|
| Training | 116 | 771 |
| Validation | 27 | 194 |
| Testing | 38 | 321 |
| Total | 181 | 1286 |
Capture-based grouping was used to reduce potential data leakage between dataset splits.
The verified segmentation dataset is available in the associated Hugging Face dataset repository:
Resistor Segmentation V4 Dataset
Final Model Configuration
| Parameter | Value |
|---|---|
| Architecture | YOLO26n-seg |
| Training epochs | 50 |
| Input size | 960 |
| Optimiser | AdamW |
| Learning rate | 0.001 |
| Batch size | 8 |
| Confidence threshold | 0.55 |
| Post-processing | Morphological closing and connected component analysis |
Held-Out Test Results
| Metric | Result |
|---|---|
| Correct detections | 314 / 321 |
| Recall | 97.82% |
| F1-score | 98.90% |
| Box mAP50β95 | 83.29% |
| Mask mAP50β95 | 69.77% |
| Counting MAE | 0.184 |
| Exact counting accuracy | 84.21% |
| GT-normalised mask IoU | 84.79% |
Standard mAP metrics describe the raw YOLO26n segmentation model. Operational detection and counting metrics describe the selected hybrid pipeline at a confidence threshold of 0.55.
Comparison with Conventional Image Processing
| Metric | Conventional OpenCV | Final Pipeline |
|---|---|---|
| Recall | 82.55% | 97.82% |
| F1-score | 77.03% | 98.90% |
| Counting MAE | 2.000 | 0.184 |
| Exact counting accuracy | 36.84% | 84.21% |
Example Segmentation
Individual Resistor Extraction
Repository Contents
| File or folder | Description |
|---|---|
Final_Resistor_Model.pt |
Final trained segmentation model |
final_pipeline_config.json |
Selected inference configuration |
Resistor_Detection_V4_Segmentation.ipynb |
Complete development notebook |
Final_Test/ |
Quantitative and qualitative evaluation |
Resistor_Extraction/ |
Individual resistor crops and segmentation masks |
Limitations
- Small or blurred resistor bodies may be missed.
- Some segmentation masks contain small portions of adjacent metal leads.
- Morphological refinement produced negligible improvements in segmentation accuracy.
- The held-out test dataset contains only two defined capture groups.
- Further evaluation is required to establish generalisation to substantially different imaging conditions.
Applications
- Electronic component detection
- Automated component counting
- Instance segmentation
- Electronics quality inspection research
- Preprocessing for resistor colour-band recognition
This repository focuses on resistor-body detection. Colour-band recognition is a separate downstream component developed collaboratively within the wider group project.
Technologies
Python, PyTorch, Ultralytics YOLO, OpenCV, NumPy, Pandas, Matplotlib, Google Colab and Roboflow.
Author
Dinesh Kumar
Machine Vision β University of Bristol and University of the West of England, Bristol.
Developed as an individual technical contribution within a collaborative university Machine Vision project.
Licence
AGPL-3.0, subject to the applicable Ultralytics licensing and source distribution requirements.
- Downloads last month
- -











