Riconoscitore di oggetti in tempo reale con Teachable Machine, overlay grafico e sintesi vocale italiana
Project description
🎯 Riconoscitore Oggetti
Riconoscimento oggetti in tempo reale con modelli Teachable Machine, overlay grafico e sintesi vocale italiana.
Pensato per la didattica e per progetti di accessibilità. Usa modelli .tflite esportati da Google Teachable Machine.
✨ Funzionalità
- 📷 Riconoscimento in tempo reale dalla webcam
- 🗣️ Sintesi vocale italiana (TTS) in thread separato — il video non si blocca mai
- 📊 Smoothing predizioni su N frame (anti-flickering con voto di maggioranza)
- 🎚️ Soglia di confidenza configurabile
- 🖥️ Overlay grafico con barra confidenza, FPS e log riconoscimenti
- ⌨️ Tasti rapidi: Q esci, M muto, S screenshot, P pausa
- 🔇 Cooldown vocale anti-ripetizione
📦 Installazione
pip install riconoscitore-oggetti
⚠️ Richiede Python 3.9+ e una webcam collegata.
Dipendenze installate automaticamente
opencv-python— acquisizione e visualizzazione videotensorflow— interprete TFLite per l'inferenzanumpy— elaborazione arraypyttsx3— sintesi vocale offline
🚀 Uso
Da terminale (CLI)
riconoscitore
Oppure:
python -m riconoscitore_oggetti
Si aprirà un file dialog per selezionare il modello .tflite e il file etichette .txt.
Da codice Python
from riconoscitore_oggetti import avvia
# Modalità interattiva (file dialog)
avvia()
# Percorsi espliciti
avvia("mio_modello.tflite", "etichette.txt")
# Con configurazione personalizzata
avvia(
model_path="modello.tflite",
labels_path="labels.txt",
camera_index=0,
config={
"SOGLIA_CONFIDENZA": 0.85,
"VELOCITA_VOCE": 180,
"BUFFER_FRAME": 9,
}
)
Uso avanzato delle classi
from riconoscitore_oggetti import Classificatore, MotoreVocale
# Usa solo il classificatore
clf = Classificatore("modello.tflite", ["gatto", "cane", "standard"], buffer_size=5)
etichetta, confidenza, raw = clf.predici(frame_opencv)
etichetta_stabile, conf_stabile = clf.predizione_stabile()
# Usa solo il motore vocale
voce = MotoreVocale(velocita=150, volume=0.9)
voce.parla("Ciao mondo!")
🎓 Come creare il modello
- Vai su Teachable Machine
- Crea un progetto Image → addestra le classi con la webcam
- Esporta come TensorFlow Lite (quantizzato float)
- Scarica il
.tflitee illabels.txt - Lancia il riconoscitore e seleziona i due file!
💡 Aggiungi una classe chiamata
standardcome sfondo neutro (non verrà annunciata).
⌨️ Comandi durante l'esecuzione
| Tasto | Azione |
|---|---|
| Q | Esci dall'applicazione |
| M | Attiva/disattiva muto |
| S | Salva screenshot |
| P | Pausa/riprendi |
⚙️ Configurazione
Puoi sovrascrivere qualsiasi parametro passando un dizionario config ad avvia():
| Parametro | Default | Descrizione |
|---|---|---|
SOGLIA_CONFIDENZA |
0.70 |
Soglia minima per annunci vocali |
BUFFER_FRAME |
7 |
Frame per smoothing (dispari) |
COOLDOWN_VOCE_SEC |
2.5 |
Secondi tra annunci ripetuti |
VELOCITA_VOCE |
150 |
Parole al minuto TTS |
VOLUME_VOCE |
0.9 |
Volume TTS (0.0–1.0) |
ETICHETTA_NEUTRA |
"standard" |
Classe ignorata dal TTS |
LARGHEZZA_FINESTRA |
800 |
Larghezza finestra video |
📄 Licenza
MIT — Prof. Giuseppe Aleci, ITIS Q. Sella, Biella — A.S. 2025/2026
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file riconoscitore_oggetti-2.0.1.tar.gz.
File metadata
- Download URL: riconoscitore_oggetti-2.0.1.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3dfeab9cdba4a38aa00bb5b55f298143ef8f6d203210d4370ec1c989aeaf4550
|
|
| MD5 |
923e2d88d854b0ecc31d829afad1e878
|
|
| BLAKE2b-256 |
a9298df809b731a38a15a2c24b925794af2a29034b81f6dace05fd9f36f4db0b
|
File details
Details for the file riconoscitore_oggetti-2.0.1-py3-none-any.whl.
File metadata
- Download URL: riconoscitore_oggetti-2.0.1-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7b926a0f04a8004906b3b6e3a8b686d2100be568ff4237e95c5f0650fe1f1b1
|
|
| MD5 |
863db448e96751e0afd52a0ddefc9513
|
|
| BLAKE2b-256 |
122267c9492f231cfb4934224216d2f0de250b8df512479b53eb0c0373475b9c
|