Skip to main content

Graffiti Detection AI Model

Graffiti Detection AI logo

CI PyPI version Supported Python versions MIT License

YOLOv8-based graffiti detection for Python applications, model training, batch inference, camera monitoring, alerts, and API integration.

Why I Built It

I built this project because I hate seeing my city being destroyed and ruined by graffiti. It is intended to help maintenance and response teams detect incidents earlier and act faster.

What Makes It Useful

  • A small Python API for image inference
  • End-to-end scripts for dataset preparation, training, evaluation, and video inference
  • Multi-camera monitoring with email, SMS, webhook, Discord, Slack, and OneSignal alerts
  • FastAPI and Docker deployment options
  • Street-scene augmentation for poor lighting, weather, perspective, and CCTV artifacts

Model weights are not bundled. Train a model with this project or provide compatible Ultralytics YOLO weights.

Installation

Python 3.9 or newer is required.

pip install graffiti-detection-ai-model

Install every runtime feature for training, alerts, and the API:

pip install "graffiti-detection-ai-model[all]"

For development from source:

git clone https://github.com/EfficientTools/graffiti-detection-ai-model.git
cd graffiti-detection-ai-model
python -m venv venv
source venv/bin/activate
python -m pip install -e ".[dev]"

Python Usage

from graffiti_detection import GraffitiDetector

detector = GraffitiDetector("models/best.pt", conf_threshold=0.25)
detections = detector.predict("image.jpg")

Each detection contains class_id, class_name, confidence, and an xyxy box.

Command Line

# Prepare a YOLO-format dataset
python scripts/prepare_dataset.py --data-dir data/raw --output-dir data --validate --copy

# Train and evaluate
python scripts/train.py --data configs/dataset.yaml --model yolov8n --epochs 100
python scripts/evaluate.py --model models/best.pt --data configs/dataset.yaml --split test

# Run image, directory, video, or webcam inference
python scripts/inference.py --model models/best.pt --source image.jpg

For camera monitoring, copy the example camera and alert files, insert your own credentials locally, then run:

python scripts/multi_camera_surveillance.py \
  --model models/best.pt \
  --cameras configs/cameras.json \
  --alert-config configs/alerts.json

Start the API with:

MODEL_PATH=models/best.pt uvicorn api.graffiti_detector:app --host 0.0.0.0 --port 8000

See DEPLOYMENT.md for Docker instructions.

Development

ruff check .
pytest tests/ -m "not gpu"
python -m build
twine check dist/*

Author

Pierre-Henry Soria

Pierre-Henry Soria

Software AI engineer building practical systems for real-world problems.

Website | GitHub | Bluesky | X | Support

License

Distributed under the MIT License.

Responsible Use

Comply with local privacy, surveillance, and data-retention laws. Human review should remain part of any enforcement or response process.

Metadata

Release files for graffiti-detection-ai-model 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for graffiti-detection-ai-model 1.3.0
File Size Uploaded
graffiti_detection_ai_model-1.3.0.tar.gz 39.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for graffiti-detection-ai-model 1.3.0
File Interpreter ABI Platform
graffiti_detection_ai_model-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 65.9 kB

Release files / graffiti_detection_ai_model-1.3.0.tar.gz

Download URL graffiti_detection_ai_model-1.3.0.tar.gz
Size 39.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a3ba62e660089a433ab350ba1b4dd1ebfe2b8f95348159dd8c1e2c1bc8d83fbd
BLAKE2b-256 checksum
How to use checksums
445ebbbffd40f3cced2a44a5f3971ab3db11bb86037f990369148a319a663b69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 18, 2026.

Transparency log

Release files / graffiti_detection_ai_model-1.3.0-py3-none-any.whl

Download URL graffiti_detection_ai_model-1.3.0-py3-none-any.whl
Size 26.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4aba083102dbb29738c15b0e731648b569f6e1e9164df754ac7809c813f999fb
BLAKE2b-256 checksum
How to use checksums
cd2615b7c95eea24f87ecf73113cc3700fc47e83c93aca5af70ad45eb48286cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 18, 2026.

Transparency log

Release history Release notifications | RSS feed

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

This release

1.3.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page