Upload β Watermark β Store β Detect β Compare β Classify β Display
An end-to-end MVP for protecting digital image assets using invisible steganographic watermarking, AI-powered feature extraction (MobileNetV2), and perceptual hash similarity detection β deployed on Google Cloud Run.
βββββββββββββββ HTTP/multipart ββββββββββββββββββββββββββββββββββββ
β Streamlit β ββββββββββββββββββββββ β FastAPI Backend β
β Frontend β ββββββββββββββββββββββ β β
β :8501 β JSON response β /upload-original β
βββββββββββββββ β /check-image β
β /assets β
βββββββββββββ¬βββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββΌβββββββββββββββββββββ
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββ
β Stegano (LSB) β β MobileNetV2 β β SQLite DB β
β Watermarking β β Embeddings β β assets.db β
βββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββ
Watermark Valid ββββββββββββββββββββββββββββββΊ Authentic Content β
Watermark Missing + High Similarity (>75%) βββΊ Unauthorized Copy β οΈ
Watermark Corrupted βββββββββββββββββββββββββΊ Tampered Content β οΈ
Low Similarity (<40%) βββββββββββββββββββββββΊ Different Content β
digital-asset-protection/
βββ backend.py # FastAPI app (all core logic)
βββ frontend.py # Streamlit UI
βββ requirements.txt # Python dependencies
βββ Dockerfile # Container definition
βββ start.sh # Process launcher script
βββ README.md # This file
- Python 3.10 or 3.11
- pip
# Clone / download the project folder, then:
cd digital-asset-protection
# (Optional) create a virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install CPU-only PyTorch first (smaller, faster install)
pip install torch==2.3.0+cpu torchvision==0.18.0+cpu \
--index-url https://download.pytorch.org/whl/cpu
# Install remaining dependencies
pip install -r requirements.txtpython backend.py
# β FastAPI running at http://localhost:8000
# β Auto-downloads MobileNetV2 weights on first run (~14 MB)streamlit run frontend.py
# β Opens http://localhost:8501 in your browser# Register an original image
curl -X POST http://localhost:8000/upload-original \
-F "file=@your_image.jpg"
# Check a suspected image
curl -X POST http://localhost:8000/check-image \
-F "file=@suspected_image.jpg"
# List all registered assets
curl http://localhost:8000/assets{
"status": "success",
"watermark_detected": false,
"watermark_status": "missing",
"matched_content_id": "3f8a2b1c-...",
"matched_filename": "logo.png",
"hash_similarity": 85.9,
"ai_similarity": 92.3,
"decision": "Unauthorized Copy β οΈ",
"confidence": 89.8,
"explanation": "ImageHash Similarity: 85.9% | AI Similarity: 92.3% | Final Decision: Unauthorized Copy β οΈ | Confidence: 89.8%"
}- Google Cloud SDK installed
- Docker installed
- A GCP project with billing enabled
gcloud auth login
gcloud config set project YOUR_PROJECT_IDgcloud services enable run.googleapis.com containerregistry.googleapis.com# Build
docker build -t gcr.io/YOUR_PROJECT_ID/dap-system .
# Push
docker push gcr.io/YOUR_PROJECT_ID/dap-systemgcloud run deploy dap-system \
--image gcr.io/YOUR_PROJECT_ID/dap-system \
--platform managed \
--region us-central1 \
--allow-unauthenticated \
--memory 2Gi \
--cpu 2 \
--port 8501 \
--set-env-vars="STREAMLIT_SERVER_HEADLESS=true"After deployment, grab the Cloud Run service URL and update frontend.py:
# frontend.py line ~20
API_BASE = "https://dap-system-xxxx-uc.a.run.app" # β your Cloud Run URLThen rebuild and redeploy.
Both platforms support Docker deployments via GitHub. Push this folder to a repo, connect to Railway or Render, set PORT=8501, and it deploys automatically.
This MVP uses SQLite and local disk. Here's how to scale to an internet-scale production system:
- Replace local file I/O with Google Cloud Storage (GCS) or AWS S3
- Store watermarked images as objects; use signed URLs for secure, time-limited access
- Add a CDN (Cloud CDN / CloudFront) for global low-latency delivery
- Replace numpy cosine search with FAISS (open-source, in-process, billions of vectors)
- Or Pinecone / Weaviate / Qdrant for managed ANN search at scale
- Sub-millisecond similarity search over millions of registered assets
- Cloud Pub/Sub + Cloud Run Jobs for async, event-driven watermark embedding
- Vertex AI Endpoints for scalable, GPU-backed MobileNet inference
- Redis for embedding cache and rate limiting per user/API key
- Add Firebase Auth or Auth0 for user accounts
- Namespace embeddings per organisation in the vector DB
- Role-based access for admin vs viewer
- Cloud Monitoring dashboards for latency / throughput
- Structured logging (JSON) shipped to Cloud Logging
- OpenTelemetry tracing for end-to-end request visibility
| Component | Technology |
|---|---|
| Backend API | FastAPI + Uvicorn |
| Frontend UI | Streamlit |
| Watermarking | Stegano (LSB steganography) |
| AI Features | MobileNetV2 (torchvision, pretrained) |
| Hash Similarity | imagehash (pHash) |
| Deep Similarity | numpy cosine similarity |
| Database | SQLite |
| Containerisation | Docker |
| Cloud Target | Google Cloud Run |
MIT β free to use for hackathons, demos, and production.