YOLOv8-based graffiti detection library with training, inference, surveillance, and API utilities.
Project description
Graffiti Detection AI Model
AI-powered graffiti detection built on YOLOv8 for training, inference, surveillance, alerting, and API integration.
Why I Built This
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.
What This Project Does
- 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
What Makes It Stand Out
- 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
Requirements
- Python 3.8+
- CUDA-capable GPU (recommended for training / real-time workloads)
- Dataset in YOLO format (
class x_center y_center width height)
Installation
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.txt
Install directly from pip (after the first PyPI release):
pip install graffiti-detection-ai-model
Quick import example:
from src.evaluation.metrics import calculate_iou
Quick Start
1. Prepare dataset
python scripts/prepare_dataset.py --data-dir data/raw --output-dir data --validate --copy
2. Train model
python scripts/train.py --data configs/dataset.yaml --model yolov8n --epochs 100
3. Run inference
python scripts/inference.py --model models/best.pt --source image.jpg
python scripts/inference.py --model models/best.pt --source 0 --show
4. Evaluate
python scripts/evaluate.py --model models/best.pt --data configs/dataset.yaml --split test
Real-Time Surveillance and Alerts
Use the example configs as a base:
cp configs/cameras_example.json configs/cameras.json
cp configs/alerts_example.json configs/alerts.json
Run multi-camera monitoring:
python scripts/multi_camera_surveillance.py \
--model models/best.pt \
--cameras configs/cameras.json \
--alert-config configs/alerts.json
Optional utilities:
python scripts/real_time_dashboard.py --stats-file outputs/stats.json
python scripts/incident_logger.py --action stats --period today
API
Start API service:
uvicorn api.graffiti_detector:app --host 0.0.0.0 --port 8000
Main endpoints:
GET /POST /detectPOST /detect/annotatedPOST /detect/batchGET /stats
Testing
python tests/run_tests.py
# or
pytest tests/
Deployment
For Docker/Compose/Kubernetes/edge/cloud setup, see DEPLOYMENT.md.
Project Structure
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
Author
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!
License
This project is distributed under the MIT License.
Disclaimer
This model is intended to assist maintenance and urban management teams. Always comply with local privacy and surveillance regulations when deploying computer vision systems.
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 graffiti_detection_ai_model-0.1.0.tar.gz.
File metadata
- Download URL: graffiti_detection_ai_model-0.1.0.tar.gz
- Upload date:
- Size: 27.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00562a796eb54a71750c4892f21cf57cf66681aabcc664e15d728b12bd9edf37
|
|
| MD5 |
3a56ce45852ca888b704302550a8bcd0
|
|
| BLAKE2b-256 |
0a926fb7672a03e2084b9b6c4e2ab4697f56b846d60fc0a6aaabbfee843ebcc1
|
Provenance
The following attestation bundles were made for graffiti_detection_ai_model-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on EfficientTools/graffiti-detection-ai-model
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
graffiti_detection_ai_model-0.1.0.tar.gz -
Subject digest:
00562a796eb54a71750c4892f21cf57cf66681aabcc664e15d728b12bd9edf37 - Sigstore transparency entry: 1189712913
- Sigstore integration time:
-
Permalink:
EfficientTools/graffiti-detection-ai-model@dacd3743c85ceb240d3d254c322510e96f2a18cb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/EfficientTools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@dacd3743c85ceb240d3d254c322510e96f2a18cb -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file graffiti_detection_ai_model-0.1.0-py3-none-any.whl.
File metadata
- Download URL: graffiti_detection_ai_model-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7e26fc08ba722dbcacf659034d295c05513bb32ec25bf1dcb05b5c1c54d8d97
|
|
| MD5 |
f5a05a4ea76176915851fac11eb2104e
|
|
| BLAKE2b-256 |
9f9b6f4d617fb0565308da5f631223edc39c4bf714ca6593ab231ca7c94f36f7
|
Provenance
The following attestation bundles were made for graffiti_detection_ai_model-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on EfficientTools/graffiti-detection-ai-model
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
graffiti_detection_ai_model-0.1.0-py3-none-any.whl -
Subject digest:
a7e26fc08ba722dbcacf659034d295c05513bb32ec25bf1dcb05b5c1c54d8d97 - Sigstore transparency entry: 1189712942
- Sigstore integration time:
-
Permalink:
EfficientTools/graffiti-detection-ai-model@dacd3743c85ceb240d3d254c322510e96f2a18cb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/EfficientTools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@dacd3743c85ceb240d3d254c322510e96f2a18cb -
Trigger Event:
workflow_dispatch
-
Statement type: