authentIC is an advanced AI-powered desktop application designed to detect counterfeit integrated circuits (ICs) using a comprehensive multi-stage detection pipeline. The system combines computer vision, machine learning, and large language models to provide accurate authenticity verification for electronic components.
- IC Identification: Automatic part number, manufacturer, and package type detection using Gemini Vision Language Model
- Datasheet Retrieval: Automated scraping and parsing of official OEM datasheets
- Visual Analysis: Advanced computer vision techniques including:
- Dimension estimation using SAM (Segment Anything Model)
- Pin counting with YOLO-based detection
- Surface texture analysis with histogram filters
- Anomaly detection and heatmap visualization
- Gemini Visual Comparison: Deep analysis comparing IC images against datasheet specifications
- Comprehensive Reporting: PDF reports with detailed findings, scores, and visualizations
- Multi-View Analysis: Support for multiple IC images from different angles
- PCB Detection: Detect and analyze multiple ICs on a PCB
- RAG-Powered Search: Vector database search for historical analysis patterns
- Conversational Interface: Natural language chat interface for queries and analysis
- History Management: Track and search through past detection sessions
- Multi-User Support: Separate storage for personal and business users
- Preprocessing Pipeline: SAM-based segmentation, edge detection, and perspective correction
- Histogram Filter Dashboard: 11 different image processing filters for defect analysis
- OCR Integration: Text extraction from IC surfaces using EasyOCR
- Dimension Estimation: Precise measurement using SAM and reference objects
- Python 3.8+
- Flask: REST API server
- Google Gemini 2.5 Flash: Vision language model for IC identification and analysis
- PyTorch: Deep learning framework
- OpenCV: Computer vision operations
- YOLO (Ultralytics): Object detection for pin counting
- SAM 2.1: Image segmentation
- EasyOCR: Optical character recognition
- PostgreSQL + pgvector: Vector database for RAG search
- ReportLab: PDF report generation
- Electron: Desktop application framework
- HTML/CSS/JavaScript: Modern web UI
- Supabase: Authentication and backend services
- Python 3.8 or higher
- Node.js 16+ and npm
- PostgreSQL 17+ (optional, for vector search)
- Google Gemini API key
- Clone the repository
git clone https://github.com/Prisha8/counterfeit_IC.git
cd counterfeit_IC- Install Python dependencies
pip install -r requirements.txt- Set up environment variables
Create a
.envfile in thebackend/directory:
GEMINI_API_KEY=your_gemini_api_key_here
DB_HOST=localhost # Optional, for vector DB
DB_PORT=5432
DB_NAME=counterfeit_ic
DB_USER=your_username
DB_PASSWORD=your_password- Download model weights (if not already present)
- SAM 2.1 model weights
- YOLO pin counter weights (
pin_counter.pt) - PCB detector weights (
pcb_weights.pt) - EasyOCR models
- Install Node.js dependencies
npm install- Start the Electron app
npm startFor RAG-powered search functionality, set up PostgreSQL with pgvector:
# Install PostgreSQL 17
brew install postgresql@17
brew services start postgresql@17
# Install pgvector extension
brew install pgvector
# Create database
psql postgres
CREATE DATABASE counterfeit_ic;
\c counterfeit_ic
CREATE EXTENSION vector;See SETUP_VECTOR_DB.md for detailed instructions.
cd backend
python api_server.pyThe API server will start on http://localhost:5000
npm startPOST /api/detect- Upload IC image(s) for analysisGET /api/detect/<session_id>/status- Check detection statusGET /api/detect/<session_id>/result- Get detection results
POST /api/chat- Send conversational queryGET /api/chat/history/<session_id>- Get chat history
GET /api/history- List all detection sessionsGET /api/history/<session_id>- Get detailed session dataPOST /api/history/search- Vector search through historyPOST /api/history/<session_id>/verdict- Update verdict
POST /api/detect/pcb- Detect multiple ICs on a PCB
You can also run detection directly from the command line:
python backend/agents/counterfeit_detector.py <ic_image_path> --output-dir ./resultscounterfeit_IC/
βββ backend/
β βββ agents/
β β βββ counterfeit_detector.py # Main detection orchestrator
β β βββ conversational_agent.py # Chat interface agent
β β βββ gemini_ic_identifier.py # IC identification agent
β β βββ council_orchestrator.py # Multi-model consensus
β βββ tools/
β β βββ datasheet_scraper.py # Datasheet retrieval
β β βββ datasheet_parser.py # PDF parsing
β β βββ dimension_estimator.py # SAM-based measurements
β β βββ pin_counter.py # YOLO pin detection
β β βββ preprocessing_tool.py # Image preprocessing
β β βββ histogram_filter_tool.py # Surface analysis
β βββ utils/
β β βββ vlm_client.py # VM endpoint client
β β βββ history_manager.py # Session management
β β βββ vector_db.py # RAG search
β βββ api_server.py # Flask REST API
β βββ weights/ # Model weights directory
βββ frontend/
β βββ js/ # Frontend JavaScript
β βββ css/ # Stylesheets
β βββ *.html # HTML pages
βββ main.js # Electron main process
βββ requirements.txt # Python dependencies
βββ package.json # Node.js dependencies
βββ README.md # This file
- IC Identification: Gemini VLM analyzes the image to extract part number, manufacturer, package type, and pin count
- Datasheet Retrieval: System searches for and downloads the official OEM datasheet
- Datasheet Parsing: Extracts mechanical diagrams, dimensions, and specifications
- Preprocessing: SAM segmentation, edge detection, perspective correction, and OCR
- CV Analysis:
- Dimension estimation using SAM
- Pin counting with YOLO
- Histogram filter analysis (11 filters)
- Surface texture analysis
- Visual Comparison: Gemini compares IC image against datasheet specifications
- Anomaly Detection: Identifies defects, inconsistencies, and suspicious features
- Report Generation: Creates comprehensive PDF report with findings
The system supports parallel calls to VM-hosted VLMs:
- R-4B (port 8000): IC identification
- 38B (port 8001): Conversational agent
- 78B (port 8002): Counterfeit detection
These endpoints are called in parallel with Gemini as a fallback mechanism.
Note: This project was developed for Smart India Hackathon 2025.
