HH Goa 2026 β Task #3
Complete pipeline that detects faces, extracts biometric embeddings, performs multi-provider reverse image search with AI-powered vision analysis, verifies candidates biometrically, and records verified matches in a tamper-evident blockchain ledger.
- Biometric Face Detection: YuNet + SFace for 128D face embeddings
- AI Vision Analysis: Gemini Vision extracts names from badges/text (critical for non-famous people)
- Multi-Provider Search: SerpAPI, Yandex, Google Vision, Bing, FaceCheck.id
- Smart Social Lookup: Finds Instagram/Facebook/LinkedIn profiles by name (bypasses CDN blocking)
- Biometric Verification: Filters false positives with cosine similarity matching
- Blockchain Recording: Local JSON chain (default) or Polygon Amoy testnet (optional)
- Python 3.10+ (tested on 3.10)
- Virtual environment recommended
- API Keys (see Configuration below)
Linux/macOS:
cd ~/Blockchain
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .envWindows (PowerShell):
cd C:\Blockchain
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
Copy-Item .env.example .envEdit .env and add your API keys:
# Required - Gemini Vision (FREE, 1000/day)
# Get from: https://aistudio.google.com
GEMINI_API_KEY=your_gemini_key_here
# Required - Reverse Search (Paid, $50/mo for 5000 searches)
# Get from: https://serpapi.com
SERPAPI_API_KEY=your_serpapi_key_here
# Optional - Additional providers
YANDEX_API_KEY=your_yandex_key_here
GOOGLE_CLOUD_API_KEY=your_google_key_here
FACECHECK_API_KEY=your_facecheck_key_here
# Optional - Polygon Amoy blockchain (default: local chain)
WALLET_ADDRESS=0x...
WALLET_PRIVATE_KEY=0x...
AMOY_RPC_URL=https://polygon-amoy.drpc.orgBasic usage:
python run_pipeline.py --image samples/Anuj.jpg --provider serpapiMulti-provider (best results):
python run_pipeline.py --image samples/shruti.png --multi-providerWith person name (improves accuracy):
python run_pipeline.py --image samples/shruti.png --provider serpapi --person-name "Shruti Haasan"The complete pipeline executes these steps:
STEP 1: Biometric Face Detection & 128D Embedding
ββ YuNet face detector (5-point landmarks)
ββ SFace 128D biometric embedding
ββ SHA-256 hash of embedding (blockchain-ready)
STEP 1.5: Gemini Vision Analysis (NEW)
ββ Extract visible text (badges, nametags, logos)
ββ Identify public figures
ββ Generate targeted search queries
ββ Context clues extraction
STEP 2: Reverse Image Search
ββ Query selected provider(s)
ββ Classify results (social/web_profile/mention/web)
ββ Platform detection (90+ social networks)
STEP 2b: Social Profile Lookup (Option B)
ββ Extract person name from search results
ββ Search "Name" site:instagram.com
ββ Search "Name" site:facebook.com
ββ 12 platforms: Instagram, Facebook, X, LinkedIn, etc.
STEP 3: Biometric Verification
ββ Download candidate profile photos
ββ Extract face embeddings from each
ββ Compute cosine similarity vs. query face
ββ Filter results above threshold (0.363)
STEP 6: Blockchain Write (only if verified matches exist)
ββ Local mode: Write to chain.json
ββ Polygon mode: Upload to Amoy testnet
Note: STEP 6 only runs when STEP 3 produces verified matches. Use --no-verify skips verification and blockchain write.
# Single provider (default: serpapi)
python run_pipeline.py --image samples/Anuj.jpg
# Specific provider
python run_pipeline.py --image samples/Anuj.jpg --provider yandex
# Multi-provider merge (best coverage)
python run_pipeline.py --image samples/Anuj.jpg --multi-provider
# Custom provider combination (space-separated)
python run_pipeline.py --image samples/Anuj.jpg --multi-provider --providers serpapi yandex# Provide person name (skip name extraction)
python run_pipeline.py --image test.jpg --person-name "John Doe"
# Skip biometric verification (faster, no blockchain)
python run_pipeline.py --image test.jpg --no-verify
# Skip Gemini Vision analysis
python run_pipeline.py --image test.jpg --no-gemini
# Skip social profile lookup (Option B)
python run_pipeline.py --image test.jpg --no-social-lookup
# Select specific face from group photo (0-indexed)
python run_pipeline.py --image group.jpg --face-index 2
# Limit verification candidates (default: 25)
python run_pipeline.py --image test.jpg --max-verify-candidates 10# Local blockchain (default, writes to chain.json)
python run_pipeline.py --image test.jpg --blockchain-mode local
# Polygon Amoy testnet (requires wallet in .env)
python run_pipeline.py --image test.jpg --blockchain-mode polygon
# Custom chain file location
python run_pipeline.py --image test.jpg --chain-file my_chain.json
# Disable blockchain (testing only)
python run_pipeline.py --image test.jpg --no-blockchain# Save results to JSON
python run_pipeline.py --image test.jpg --save-json results/output.json
# View blockchain ledger
python run_pipeline.py --show-chain
# View custom chain file
python run_pipeline.py --show-chain --chain-file my_chain.json
# Verify specific record
python run_pipeline.py --verify-only --record-json results/pipeline_run_12345.jsonpython -c "
from blockchain.local_chain import LocalChain
chain = LocalChain('test_chain.json')
block = chain.add_block({'test': 'record', 'hash': 'abc123'})
print(f'β
Blockchain working: {len(chain.blocks)} blocks, valid={chain.validate_chain()}')
"# View main chain
cat chain.json | python -m json.tool
# Check chain validity
python run_pipeline.py --show-chain# Run pipeline and verify blockchain write
python run_pipeline.py --image samples/shruti.png --provider serpapi --person-name "Shruti Haasan"
# Check for STEP 6 in output
# Verify chain.json was created
ls -la chain.json~/Blockchain/
βββ face_pipeline/
β βββ pipeline.py # YuNet + SFace face detection
βββ reverse_search/
β βββ base.py # Data structures, platform detection
β βββ serpapi_lens.py # SerpAPI Google Lens
β βββ yandex_visual.py # Yandex reverse search
β βββ google_vision.py # Google Cloud Vision API
β βββ bing_visual.py # Bing Visual Search
β βββ facecheck_id.py # FaceCheck.id (face-specific)
β βββ gemini_vision.py # Gemini Vision Analyzer (AI text extraction)
β βββ social_profile_finder.py # Name-based social profile search
β βββ biometric_verifier.py # Biometric similarity verification
βββ blockchain/
β βββ local_chain.py # Local JSON blockchain
β βββ uploader.py # Polygon Amoy uploader
β βββ config.py # Blockchain configuration
β βββ record_builder.py # Record hashing utilities
β βββ verify.py # Verification utilities
βββ samples/ # Test images
βββ results/ # JSON output files
βββ run_pipeline.py # Main entry point
βββ requirements.txt # Python dependencies
βββ .env # API keys (create from .env.example)
βββ chain.json # Local blockchain ledger (created on first run)
python run_pipeline.py --image celebrity.jpg --multi-provider --person-name "Celebrity Name"Expected: High match count, multiple verified social profiles, blockchain record created
python run_pipeline.py --image professional.jpg --provider serpapiExpected: LinkedIn/GitHub profiles found, moderate match count
python run_pipeline.py --image conference_badge.jpg --provider serpapiExpected: Gemini extracts name from badge, searches by name, finds social profiles
python run_pipeline.py --image private_person.jpg --provider serpapiExpected: Few or no matches, no verified results, no blockchain write
pip install eth-account web3- Switched to
gemini-flash-lite-latest(fast, 2-3s response) - Old thinking models (
gemini-3.6-flash) timeout after 30s
- STEP 6 only runs with verified matches
- Don't use
--no-verifyif you want blockchain write - Ensure reverse search finds results (use famous person for testing)
pip install opencv-contrib-python# For Python 3.10, use numpy 1.x
pip install "numpy>=1.24.0,<2.0.0"- Storage:
chain.jsonfile - Cost: Free
- Speed: Instant
- Tamper-evident: Yes (SHA-256 chain)
- Public verification: No (local file only)
- Setup: None required
- Storage: Polygon Amoy testnet
- Cost: Free testnet MATIC from faucet
- Speed: 5-10 seconds per transaction
- Tamper-evident: Yes (public blockchain)
- Public verification: Yes (PolygonScan)
- Setup: Requires wallet address + private key in
.env
Get testnet MATIC: https://faucet.polygon.technology/
Located in results/pipeline_run_<timestamp>.json:
{
"image_path": "samples/Anuj.jpg",
"face_embedding_hash": "ec03fd78...",
"verified_matches_count": 5,
"verified_matches": [...],
"blockchain_mode": "local",
"blockchain_block_index": 3,
"blockchain_block_hash": "c6ab6974...",
"blockchain_chain_file": "chain.json"
}Located at chain.json:
{
"schema": "LOCAL_FACE_ID_CHAIN_V1",
"blocks": [
{
"index": 0,
"timestamp": "2026-01-01T00:00:00+00:00",
"data": {"type": "genesis"},
"previous_hash": "0",
"hash": "20475c84..."
},
{
"index": 1,
"timestamp": "2026-09-07T15:07:18+00:00",
"data": {
"record_hash": "abc123...",
"record": {...}
},
"previous_hash": "20475c84...",
"hash": "c6ab6974..."
}
]
}- Local blockchain: Not a decentralized public chain (use
--blockchain-mode polygonfor public ledger) - Polygon mode: Requires testnet MATIC and funded wallet
- Reverse search: Providers may rate-limit or return no matches
- Privacy: Transaction stores hashes only, not face images or biometric vectors
- Instagram/Facebook: CDN blocking requires name-based search workaround (Option B)
- Non-famous people: Requires visible text (badges, nametags) or existing web mentions
| Service | Free Tier | Paid Tier | Notes |
|---|---|---|---|
| Gemini Vision | 1000/day | N/A | FREE forever, no credit card |
| SerpAPI | 100/mo | $50/mo (5000) | Required for Google Lens |
| Yandex | Unlimited | N/A | Screen scraping (no official API) |
| FaceCheck.id | N/A | Paid only | Face-specific search |
- Project Summary:
PROJECT_SUMMARY.md(comprehensive technical doc) - API Configuration:
.env.example(template for API keys) - Chain Verification:
python run_pipeline.py --show-chain
Developer: Anuj
Project: HH Goa 2026 Task #3
Location: /home/anuj/Blockchain/
MIT License (see LICENSE file)
Last Updated: September 2026
Version: 1.0
Status: Production Ready