Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image File Intelligence

Distributed image analysis pipeline built with React, C++, Redis, Python, PyTorch, OpenCV, and Docker.

The system uses a queue-based architecture to separate HTTP request handling from ML and image-processing workloads.


Tech Stack

Layer Technology
Frontend React, Vite, CSS
API / Orchestration C++, Crow
Queue Redis, redis-plus-plus
ML Worker Python, PyTorch, TorchVision
Image Processing OpenCV, Pillow, ImageHash
Model Pretrained ResNet18
Containerization Docker, Docker Compose
Build System CMake

Architecture

┌──────────────┐
│ React / Vite │
│    :5173     │
└──────┬───────┘
       │ POST /analyze
       ▼
┌──────────────┐
│   C++ API    │
│ Crow :8080   │
└──────┬───────┘
       │ LPUSH image_jobs
       ▼
┌──────────────┐
│    Redis     │
│  image_jobs  │
└──────┬───────┘
       │ BLPOP
       ▼
┌──────────────┐
│ Python Worker│
│    Docker    │
└──────┬───────┘
       │ ResNet18 + OpenCV
       ▼
┌──────────────┐
│    Redis     │
│ image_results│
└──────┬───────┘
       │ BLPOP
       ▼
┌──────────────┐
│   C++ API    │
└──────┬───────┘
       │ JSON
       ▼
┌──────────────┐
│    React     │
└──────────────┘

System Design

Request Flow

  1. React sends POST /analyze to the C++ API.

  2. The C++ API pushes the image path to the Redis image_jobs queue.

  3. The Python worker blocks on image_jobs.

  4. The worker runs:

    • ResNet18 classification
    • OpenCV image quality analysis
  5. The worker serializes the result as JSON.

  6. The result is pushed to image_results.

  7. The C++ API retrieves the result and returns it to React.

Redis Queues

Queue Producer Consumer Purpose
image_jobs C++ API Python Worker Image analysis jobs
image_results Python Worker C++ API Completed analysis results

Worker Communication

C++ API
  │
  ├── LPUSH image_jobs
  ▼
Redis
  │
  ├── BLPOP image_jobs
  ▼
Python Worker
  │
  ├── ML + Image Processing
  │
  └── LPUSH image_results
       ▼
     Redis
       │
       └── BLPOP image_results
            ▼
          C++ API

Project Structure

image-file-intelligence/
├── backend/
│   ├── main.cpp
│   ├── ImageScanner.cpp
│   ├── ImageMetadata.cpp
│   └── ImageClassifier.cpp
│
├── ml/
│   ├── worker.py
│   ├── image_classifier.py
│   ├── image_quality.py
│   ├── duplicate_detector.py
│   ├── requirements.txt
│   └── Dockerfile
│
├── src/
│   ├── App.jsx
│   └── App.css
│
├── test_images/
├── docker-compose.yml
└── CMakeLists.txt

Prerequisites

Install:

  • CMake 3.20+
  • C++17 compiler
  • OpenCV
  • Redis++
  • Crow
  • Docker + Docker Compose
  • Node.js + npm

Installation

Clone the repository:

git clone <repository-url>
cd image-file-intelligence

Install frontend dependencies:

npm install

Running the Application

1. Start Redis and Python Worker

docker compose up -d --build

Verify:

docker compose ps

Expected services:

image-redis
image-worker

2. Build the C++ API

mkdir -p build
cd build
cmake ..
cmake --build .

3. Start the C++ API

./image_intelligence

API:

http://localhost:8080

4. Start the React Frontend

From the project root:

npm run dev

Frontend:

http://localhost:5173

API

POST /analyze

Submits an image analysis job and returns the completed worker result.

Request

/app/test_images/<image-name>

Response

{
  "image": "/app/test_images/example.png",
  "predictions": [
    {
      "label": "example_label",
      "confidence": 0.95
    }
  ],
  "quality": "Good"
}

Development Commands

C++ Source Changes

cd build
cmake --build .
./image_intelligence

CMake Changes

cd build
cmake ..
cmake --build .
./image_intelligence

Python Worker Changes

docker compose up -d --build worker

React Changes

Vite reloads automatically while running:

npm run dev

Restart Docker Services

docker compose up -d

Stop Docker Services

docker compose down

View Worker Logs

docker compose logs -f worker

Current Functionality

  • React image selection interface
  • C++ HTTP API
  • Redis-backed job queue
  • Dockerized Python worker
  • ResNet18 image classification
  • Top prediction confidence scores
  • OpenCV image quality analysis
  • Redis results queue
  • End-to-end JSON response to frontend

Full browser file uploads and persistent object storage are future extensions.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages