Skip to main content

Graffiti Detection AI Model

Graffiti Guard app icon

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.

App for iPhone and iPad

Prefer a ready-to-use mobile experience? Graffiti Guard runs private, offline detection directly on iPhone and iPad. New images are analysed automatically by default, with an inspection-focused iPad interface and shareable results.

Download Graffiti Guard on the App Store

Version 1.0 is awaiting App Review. The link becomes active when Apple publishes the app.

Why I Built It

I built this project because I hate seeing Melbourne and other cities damaged by unwanted graffiti. Earlier image review can help councils and maintenance teams prioritize work before cleanup costs and repeated surface damage escalate.

Operational Value

The problem is measurable: the City of Melbourne allocated $2.8 million to graffiti cleaning in 2025-26 and reports handling more than 5,000 removal requests and 50,000 square metres each year. Graffiti Guard targets the intake and triage step with private image review, consistent evidence, and faster handoff; it does not claim to eliminate removal costs.

Measure a pilot honestly: annual net value = ((manual review minutes - assisted review minutes) * annual reports * loaded hourly cost / 60) - annual deployment cost. Use local workflow data before publishing any savings claim.

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
  • Private, offline Core ML inference on iPhone and iPad
  • Automatic analysis with shareable, human-reviewable inspection summaries
  • Street-scene augmentation for poor lighting, weather, perspective, and CCTV artifacts

Training weights are not bundled. The Apple client includes an MIT-licensed Core ML detector for offline use; see Third-Party Notices.

Model Quality

Model quality is evidence, not a slogan. Evaluation produces a versioned report with model and dataset hashes, accuracy, runtime versions, latency, and optional release gates. Apple CI also runs the actual bundled Core ML model against the included sample. See the Model Card for scope and limitations.

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

Run a trained model against the included example image:

Graffiti painted on a city wall

from graffiti_detection import GraffitiDetector

detector = GraffitiDetector("models/best.pt", conf_threshold=0.25)
example_image = (
    "https://raw.githubusercontent.com/EfficientTools/"
    "graffiti-detection-ai-model/main/assets/examples/graffiti-wall.jpg"
)
detections = detector.predict(example_image)

for detection in detections:
    print(
        f"{detection['class_name']}: {detection['confidence']:.1%} "
        f"at {detection['box']}"
    )

Replace example_image with a local image path for your own detection. Each result contains class_id, class_name, confidence, and an xyxy box.

Measure steady-state performance on your own hardware:

benchmark = detector.benchmark(
    ["street-a.jpg", "street-b.jpg"],
    warmup_runs=1,
    measured_runs=5,
)
print(benchmark.to_dict())

Command Line

Run these operational scripts from a source checkout:

# 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 \
  --min-map50 0.80 \
  --min-recall 0.75

# 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:

python -m pip install "graffiti-detection-ai-model[api]"
MODEL_PATH=models/best.pt uvicorn graffiti_detection.api:app --host 0.0.0.0 --port 8000

See DEPLOYMENT.md for Docker instructions.

iPhone and iPad

The universal SwiftUI app in ios/GraffitiGuard runs its bundled Core ML detector entirely on-device and overlays likely graffiti regions. Its iPad workflow supports drag-and-drop intake, adjustable confidence, and shareable inspection summaries. To replace it with your own trained weights, export the model and regenerate the Xcode project:

python -m pip install -e ".[apple]"
python scripts/export_coreml.py --weights models/best.pt
xcodegen generate --spec ios/GraffitiGuard/project.yml

See the app README for Xcode and TestFlight instructions.

Development

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

Author

Pierre-Henry Soria

Pierre-Henry Soria

AI software engineer and consultant building practical computer vision systems for real-world problems.

Work with Pierre-Henry | GitHub | Bluesky | X | Support

License

Distributed under the MIT License.

Apple, the Apple logo, App Store, iPhone, and iPad are trademarks of Apple Inc., registered in the U.S. and other countries.

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.5.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.5.0
File Size Uploaded
graffiti_detection_ai_model-1.5.0.tar.gz 36.2 kB Details

Built distribution (wheel)

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

Total release size: 70.8 kB

Release files / graffiti_detection_ai_model-1.5.0.tar.gz

Download URL graffiti_detection_ai_model-1.5.0.tar.gz
Size 36.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0c5b191d91d43890d3711560307d91542e516c0c267c5c125d8c0675b0159c07
BLAKE2b-256 checksum
How to use checksums
3d0fc841979d07f8cc09e053ed2175ee0ee52445290bdea1cc0f76aca793e7c5
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.5.0-py3-none-any.whl

Download URL graffiti_detection_ai_model-1.5.0-py3-none-any.whl
Size 34.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f46dfc4ebcca3583c7f79c8664c0c8a2d6dad44964c36b8badb1a11dfdb649b
BLAKE2b-256 checksum
How to use checksums
d652e3d2e7109ee614032d90d62a3ec4911853fca913a6b116c10a71ae0d9f2a
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

This release

1.5.0 This release

2 release files

1.4.0

2 release files

1.3.0

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