Digital Image Processing Project β Cairo University
A comprehensive logo/brand detection system comparing classical computer vision techniques with modern deep learning approaches, featuring a Flutter mobile application for real-time brand verification.
- Overview
- Supported Brands
- System Architecture
- Prerequisites
- Project Structure
- Installation & Setup
- Running the System
- Evaluation & Testing
- System Workflow
- Results & Analysis
This project implements two distinct approaches for brand detection:
- SIFT (Scale-Invariant Feature Transform) for feature extraction
- Descriptor matching using FLANN-based matcher
- Homography verification for geometric consistency
- Rule-based logo verification for final classification
- Vision Transformer (ViT) architecture
- Pretrained model:
Falconsai/brand_identification - Used for performance comparison and benchmarking
- Flutter mobile application for image capture and result visualization
- Real-time communication with backend via USB connection
The system currently detects three major sports brands:
- Nike
- Adidas
- Puma
β REAL β BRAND NAME (Nike/Adidas/Puma)
β FAKE β UNKNOWN BRAND
βββββββββββββββββββ
β Flutter App β
β (Mobile) β
ββββββββββ¬βββββββββ
β USB Connection
βΌ
βββββββββββββββββββ
β Python Backend β
β (Flask Server) β
ββββββββββ¬βββββββββ
β
ββββββ΄βββββ
βΌ βΌ
ββββββββββ ββββββββββ
β CV β β DL β
β SIFT β β ViT β
ββββββββββ ββββββββββ
| Component | Requirement | Purpose |
|---|---|---|
| Python | 3.9 or higher | Backend processing |
| Android Device | Physical phone | Mobile app deployment |
| USB Cable | Type-C | Device-laptop connection |
| Flutter SDK | Latest stable | Mobile app development |
| Connection | USB only | Socket communication |
β οΈ IMPORTANT: The system will NOT work over Wi-Fi. USB connection is mandatory for stable socket communication.
Before Running:
- β Backend server must be running
- β Mobile app must be installed
- β Phone must be connected via USB
- β Run app in release mode for optimal performance
Brand-Detection/
βββ src/ # Python backend server
β βββ main.py # Flask server entry point
β βββ test_brand_detection.py # Classical CV testing
β βββ run_brand_dnn.py # Deep learning testing
β
βββ Logos/ # Reference brand logos
β βββ nike.png
β βββ adidas.png
β βββ puma.png
β
βββ Experiment Results/ # Test dataset
β βββ real/ # Authentic brand images
β β βββ nike/
β β βββ adidas/
β β βββ puma/
β βββ fake/ # Non-brand/counterfeit images
β
βββ frontend/ # Flutter mobile application
βββ brand_detection/
βββ lib/ # Dart source code
# Navigate to backend directory
cd Brand-Detection/src
# Install dependencies
pip install -r requirements.txt
# Verify installation
python --version # Should be 3.9+# Navigate to Flutter project
cd Brand-Detection/frontend/brand_detection
# Get Flutter dependencies
flutter pub get
# Verify Flutter installation
flutter doctorcd Brand-Detection/src
python main.pyExpected Output:
* Running on http://127.0.0.1:5555
* Server started successfully
install mobile app from github realese
Why Release Mode?
- β‘ Better performance
- π Stable socket communication
- πΈ Accurate real-time image transfer
- π Fewer debugging overheads
- Connect Android device via USB
- Enable USB debugging on phone
- Launch app and capture/select brand image
- View real-time detection results
Test the SIFT-based approach on the experimental dataset:
cd Brand-Detection/src
python test_brand_detection.pyWhat This Does:
- Processes all images in
Experiment Results/ - Applies SIFT feature extraction and matching
- Verifies homography for geometric consistency
- Generates accuracy metrics and detailed logs
Evaluation Criteria:
| Image Type | Correct Prediction |
|---|---|
| Real Photos | Output matches folder name (nike/adidas/puma) |
| Fake Photos | Output is NOT one of the target brands |
Compare results with the pretrained Vision Transformer:
cd Brand-Detection/src
python run_brand_dnn.pyWhat This Does:
- Uses
Falconsai/brand_identificationmodel - Classifies all test images
- Validates predictions against ground truth
- Produces comparative accuracy metrics
Both approaches are evaluated using:
- β Accuracy (overall correct predictions)
- π Precision & Recall (per-brand performance)
- π― Success cases (correctly classified images)
- β Failure cases (misclassifications with analysis)
- π Detailed logging (for debugging and improvement)
1. User captures/selects image in Flutter app
β
2. Image sent to backend via USB socket
β
3. Backend processes with CV/DL pipeline
β
4. Brand classification performed
β
5. Result returned to mobile app
β
6. User views: REAL β BRAND or FAKE β UNKNOWN
| Aspect | Classical CV (SIFT) | Deep Learning (ViT) |
|---|---|---|
| Speed | Fast (milliseconds) | Moderate (model inference) |
| Accuracy | High for clear logos | Very high overall |
| Robustness | Sensitive to occlusion | Handles variations well |
| Resource | Low computational cost | Requires more memory/GPU |
| Interpretability | High (feature matching) | Low (black box) |
Classical CV Strengths:
- β‘ Fast inference
- π Explainable feature matching
- πΎ Low resource requirements
Classical CV Weaknesses:
- β Struggles with heavy rotation/distortion
- π«οΈ Poor performance in low contrast
- π Requires good logo visibility
Deep Learning Strengths:
- π― High accuracy on diverse images
- π Handles variations robustly
- πΈ Works with partial logos
Deep Learning Weaknesses:
- β±οΈ Slower inference
- π₯οΈ Requires more computational resources
- π Less interpretable decisions
This project successfully demonstrates:
- End-to-end brand detection system from image capture to classification
- Comparative analysis of traditional vs. modern computer vision techniques
- Real-world mobile application with practical USB-based communication
- Comprehensive evaluation framework for both approaches
The system highlights that while classical computer vision techniques offer speed and interpretability, deep learning models provide superior accuracy and robustness in varied real-world conditions.