AI-powered graffiti detection built on YOLOv8 for training, inference, surveillance, alerting, and API integration.
I built this library because I hate seeing my city being destroyed and ruined by graffiti. The goal is to detect incidents early so response teams can act faster.
- Trains YOLOv8 models on graffiti datasets (YOLO annotation format)
- Runs inference on single images, folders, videos, and webcam streams
- Monitors multiple cameras in real time and triggers alert channels
- Exposes a FastAPI service for integration with existing systems
- Logs incidents to SQLite/JSON and supports daily reporting
- End-to-end pipeline in one repo: data prep -> training -> inference -> surveillance -> API -> incident tracking
- Production-oriented scripts (not notebook-only)
- Alert channel support: email, SMS, webhook, Discord, Slack
- Test coverage across data, metrics, alerts, visualization, incident logging, and integration
- Python 3.8+
- CUDA-capable GPU (recommended for training / real-time workloads)
- Dataset in YOLO format (
class x_center y_center width height)
git clone https://github.com/<your-username>/graffiti-detection-ai-model.git
cd graffiti-detection-ai-model
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txtInstall directly from pip (after the first PyPI release):
pip install graffiti-detection-ai-modelQuick import example:
from src.evaluation.metrics import calculate_ioupython scripts/prepare_dataset.py --data-dir data/raw --output-dir data --validate --copypython scripts/train.py --data configs/dataset.yaml --model yolov8n --epochs 100python scripts/inference.py --model models/best.pt --source image.jpg
python scripts/inference.py --model models/best.pt --source 0 --showpython scripts/evaluate.py --model models/best.pt --data configs/dataset.yaml --split testUse the example configs as a base:
cp configs/cameras_example.json configs/cameras.json
cp configs/alerts_example.json configs/alerts.jsonRun multi-camera monitoring:
python scripts/multi_camera_surveillance.py \
--model models/best.pt \
--cameras configs/cameras.json \
--alert-config configs/alerts.jsonOptional utilities:
python scripts/real_time_dashboard.py --stats-file outputs/stats.json
python scripts/incident_logger.py --action stats --period todayStart API service:
uvicorn api.graffiti_detector:app --host 0.0.0.0 --port 8000Main endpoints:
GET /POST /detectPOST /detect/annotatedPOST /detect/batchGET /stats
python tests/run_tests.py
# or
pytest tests/For Docker/Compose/Kubernetes/edge/cloud setup, see DEPLOYMENT.md.
api/ FastAPI service
configs/ Dataset, training, cameras, alerts configs
scripts/ Training, inference, evaluation, surveillance, dashboard tools
src/ Core data/evaluation/util modules
tests/ Unit and integration tests
Pierre-Henry Soria
Passionate software AI engineer building intelligent systems to solve real-world problems.
☕️ Enjoying this project? Buy me a coffee to support more AI innovations!
This project is distributed under the MIT License.
This model is intended to assist maintenance and urban management teams. Always comply with local privacy and surveillance regulations when deploying computer vision systems.