Downloads ยท 30 days
7
20% of all-time downloads
AndreaPorri/Yolo12n_Eyes_Detection
Yolo12n_Eyes_Detection is a zero-shot object detection model from AndreaPorri. Use it for the zero-shot object detection task on the model card, and read the license before you ship it in a product. The card lists the license as cc-by-nc-sa-4.0.
Downloads ยท 30 days
7
20% of all-time downloads
All-time downloads
35
Public
Repo size
โ
Likes
1
Public
Click a slice to open those files.
.py83.8 KB ยท 72%
From the Hugging Face model README
Una soluzione avanzata per la detection degli occhi utilizzando YOLOv12 e dataset custom da HuggingFace
</div>Questo progetto implementa un modello di object detection specializzato per l'identificazione e localizzazione degli occhi in immagini e video, basato sull'architettura YOLOv12 (You Only Look Once version 12) di Ultralytics. Il modello รจ addestrato su un dataset custom di high-quality disponibil su HuggingFace e offre prestazioni eccellenti per applicazioni di computer vision.
Il modello implementa una rete neurale convoluzionale per la detection degli occhi basata su YOLOv12, ottimizzata per:
training:
epochs: 100
batch_size: 16
img_size: 640
learning_rate: 0.01
weight_decay: 0.0005
early_stopping:
patience: 3
min_delta: 0.002
| Metrica | Valore Atteso | Descrizione |
|---|---|---|
| Precision | > 0.85 | Proporzione di veri positivi |
| Recall | > 0.80 | Capacitร di rilevare tutti gli occhi |
| F1 Score | > 0.82 | Bilanciamento precision/recall |
| [email protected] | > 0.80 | Mean Average Precision al 50% IoU |
| [email protected]:0.95 | > 0.70 | mAP su soglie IoU multiple |
Dataset: AndreaPorri/Eyes_Dataset_YOLO12
eyes_dataset/
โโโ train/
โ โโโ images/ # Training images
โ โโโ labels/ # YOLO format annotations
โโโ valid/
โ โโโ images/ # Validation images
โ โโโ labels/ # YOLO format annotations
โโโ test/
โโโ images/ # Test images
โโโ labels/ # YOLO format annotations
Il training include sophisticated data augmentation:
# Clone/download del repository
git clone <repository-url>
cd yolo12-eyes-detection
# Installa dipendenze
pip install -r requirements.txt
Modifica il file config.yaml con le tue preferenze:
# Configurazione WandB (opzionale)
wandb:
project: "your-project-name"
entity: "your-username"
api_key: "your-wandb-api-key"
# Configurazione Hardware
hardware:
device: "auto" # auto, cpu, cuda, cuda:0
mixed_precision: true
# Parametri Training
training:
epochs: 50 # Numero epoche
batch_size: 8 # Batch size (ridotto per 8GB VRAM)
img_size: 640 # Risoluzione input
learning_rate: 0.01 # Learning rate
Pipeline Completa (Training + Validazione + Test):
python yolo12_eyes_detection_modular.py --mode all
Solo Training:
python yolo12_eyes_detection_modular.py --mode train
Solo Test (con modello esistente):
python yolo12_eyes_detection_modular.py --config config.yaml --mode test
python predict_eyes.py \
--model runs/train/yolo12_eyes/weights/best.pt \
--source test_image.jpg \
--conf 0.5 \
--save predicted_image.jpg
python predict_eyes.py \
--model runs/train/yolo12_eyes/weights/best.pt \
--source video.mp4 \
--conf 0.5 \
--save output_video.mp4
python predict_eyes.py \
--model runs/train/yolo12_eyes/weights/best.pt \
--source 0 \
--conf 0.5
python predict_eyes.py \
--model runs/train/yolo12_eyes/weights/best.pt \
--source images_folder/ \
--conf 0.5 \
--save predictions/
yolo12-eyes-detection/
โโโ ๐ README.md # Questa documentazione completa
โโโ ๐ config.yaml # Configurazione principale
โโโ ๐ requirements.txt # Dipendenze Python
โโโ ๐ yolo12_eyes_detection_modular.py # Script training modulare
โโโ ๐ predict_eyes.py # Script predizioni
โโโ ๐ ESEMPIO_USO_SEPARATO.md # Guide d'uso dettagliate
โโโ ๐ data/ # Dataset directory
โ โโโ eyes_dataset/ # Dataset estratto
โ โโโ train/ # Training set
โ โโโ valid/ # Validation set
โ โโโ test/ # Test set
โ โโโ data.yaml # Configurazione YOLO
โโโ ๐ runs/ # Training outputs
โ โโโ train/
โ โโโ yolo12_eyes/ # Run specifico
โ โโโ weights/
โ โ โโโ best.pt # Modello migliore
โ โ โโโ last.pt # Ultimo checkpoint
โ โโโ results.png # Grafici risultati
โ โโโ confusion_matrix.png # Matrice confusione
โโโ ๐ risultati_eyes_detection/ # Risultati test
โ โโโ validazione_finale.txt # Risultati validazione
โ โโโ test_finale.txt # Risultati test
โโโ ๐ logs/ # Log files (opzionale)
| File | Descrizione | Uso |
|---|---|---|
yolo12_eyes_detection_modular.py | Script training principale con pipeline completa | Training, validazione, test |
predict_eyes.py | Script inferenza per predizioni | Detection su immagini/video/webcam |
config.yaml | Configurazione dettagliata del progetto | Personalizzazione training/inferenza |
requirements.txt | Lista dipendenze Python | Setup ambiente |
ESEMPIO_USO_SEPARATO.md | Guide d'uso dettagliate | Documentazione estesa |
Scegli la variante YOLOv12 piรน adatta alle tue esigenze:
model:
size: "yolo12n.pt" # nano: piรน veloce, meno accurato
# size: "yolo12s.pt" # small: balanced
# size: "yolo12m.pt" # medium: more accurate
# size: "yolo12l.pt" # large: high accuracy
# size: "yolo12x.pt" # extra large: highest accuracy
training:
epochs: 100 # Numero epoche training
batch_size: 16 # Batch size (riduci se OutOfMemory)
img_size: 640 # Risoluzione input (416, 512, 640, 832)
learning_rate: 0.01 # Learning rate iniziale
weight_decay: 0.0005 # Regularizzazione L2
workers: 8 # Worker threads (riduci se OMP errors)
Per GPU con 8GB VRAM (RTX 4060):
training:
batch_size: 8 # Ridotto per sicurezza VRAM
workers: 2 # Ridotto per evitare OMP errors
hardware:
device: "cuda:0" # Esplicito per la GPU
mixed_precision: true # FP16 per risparmio memoria
training:
augment: true # Abilita data augmentation
aug_par:
hsv_h: 0.015 # Variazione hue
hsv_s: 0.7 # Variazione saturazione
hsv_v: 0.4 # Variazione luminositร
degrees: 0.0 # Rotazione massima
translate: 0.1 # Traslazione
scale: 0.5 # Scala
fliplr: 0.5 # Probabilitร flip orizzontale
mosaic: 1.0 # Probabilitร mosaic
Il progetto si integra automaticamente con Weights & Biases per:
Setup WandB:
config.yaml con le tue credenzialiI risultati vengono salvati automaticamente anche come file di testo:
# Risultati salvati in:
risultati_eyes_detection/
โโโ validazione_finale.txt # Risultati validazione dettagliati
โโโ test_finale.txt # Risultati test dettagliati
Formato risultati:
YOLOv12 EYES DETECTION - VALIDATION RESULTS
============================================================
Timestamp: 2024-01-15 10:30:45
Model: YOLOv12n (best.pt)
Dataset: Eyes Detection Dataset
------------------------------------------------------------
FINAL METRICS:
------------------------------
Precision: 0.987654
Recall: 0.973210
F1 Score: 0.980386
[email protected]: 0.991234
[email protected]:0.95: 0.723456
Il training produce diversi artifact:
Il sistema implementa early stopping intelligente:
training:
custom_early_stopping: true
early_stopping:
patience: 3 # Epoche senza miglioramento
min_delta: 0.002 # Miglioramento minimo (0.2%)
print_mess: true # Stampa messaggi di debug
Validation automatica su piรน set:
Calcolo automatico F1-Score durante validation:
Problema: GPU memory insufficient
# Soluzione: Riduci batch size
training:
batch_size: 4 # o 2 per sistemi con poca VRAM
workers: 1 # Riduci workers
Problema: Multi-threading issues
# Aggiungi all'inizio dello script Python
import os
os.environ['KMP_DUPLICATE_LIB_OK'] = 'TRUE'
os.environ['OMP_NUM_THREADS'] = '4'
os.environ['MKL_NUM_THREADS'] = '4'
Problema: Best model non trovato durante test
# Soluzione: Esegui prima il training
python yolo12_eyes_detection_modular.py --config config.yaml --mode train
Problema: Download dataset da HuggingFace fallisce
# Soluzione: Verifica connessione internet
# Il dataset viene scaricato automaticamente da:
# https://huggingface.co/datasets/AndreaPorri/Eyes_Dataset_YOLO12
training:
batch_size: 32
workers: 12
img_size: 832 # Maggiore risoluzione
training:
batch_size: 4
workers: 2
img_size: 416 # Risoluzione ridotta
hardware:
device: "cpu"
mixed_precision: false
training:
batch_size: 2 # Batch size molto ridotto
workers: 1 # Single thread
Il progetto utilizza un stack tecnologico moderno:
Il modello viene valutato utilizzando standard metrics:
๐ฏ VALIDATION RESULTS (Best Model)
โโโโโโโโโโโโโโโโณโโโโโโโโโโ
โ Metrica โ Valore โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ Precision โ 0.9932 โ
โ Recall โ 0.9951 โ
โ F1 Score โ 0.9942 โ
โ [email protected] โ 0.9947 โ
โ [email protected]:0.95 โ 0.8199 โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโ
๐งช TEST RESULTS (Unseen Data)
โโโโโโโโโโโโโโโโณโโโโโโโโโโ
โ Metrica โ Valore โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ Precision โ 0.9934 โ
โ Recall โ 0.9956 โ
โ F1 Score โ 0.9945 โ
โ [email protected] โ 0.9945 โ
โ [email protected]:0.95 โ 0.8149 โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโ
Questo progetto รจ rilasciato sotto licenza cc-by-nc-sa-4.0.
Uso Commerciale: Il modello YOLOv12 originale รจ proprietร di Ultralytics. Consultare la loro licenza per uso commerciale.
Se utilizzi questo progetto, cita:
@software{yolo12_eyes_detection,
title={YOLOv12 Eyes Detection Model},
author={Andrea Porri},
year={2025},
url={https://github.com/your-username/yolo12-eyes-detection},
note={Computer Vision model for eye detection using YOLOv12}
}
Ultimo aggiornamento: 2025-11-07
Versione: 1.0.0
Maintainer: MiniMax Agent