Skip to main content

YOLOv8-based graffiti detection library with training, inference, surveillance, and API utilities.

Project description

Graffiti Detection AI Model

Graffiti Detection AI logo

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 /detect
  • POST /detect/annotated
  • POST /detect/batch
  • GET /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

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!

@phenrysay pH-7

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graffiti_detection_ai_model-0.1.0.tar.gz (27.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

graffiti_detection_ai_model-0.1.0-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file graffiti_detection_ai_model-0.1.0.tar.gz.

File metadata

File hashes

Hashes for graffiti_detection_ai_model-0.1.0.tar.gz
Algorithm Hash digest
SHA256 00562a796eb54a71750c4892f21cf57cf66681aabcc664e15d728b12bd9edf37
MD5 3a56ce45852ca888b704302550a8bcd0
BLAKE2b-256 0a926fb7672a03e2084b9b6c4e2ab4697f56b846d60fc0a6aaabbfee843ebcc1

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graffiti_detection_ai_model-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for graffiti_detection_ai_model-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7e26fc08ba722dbcacf659034d295c05513bb32ec25bf1dcb05b5c1c54d8d97
MD5 f5a05a4ea76176915851fac11eb2104e
BLAKE2b-256 9f9b6f4d617fb0565308da5f631223edc39c4bf714ca6593ab231ca7c94f36f7

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page