# harshkumar077/underwater-animal-classification-using-resnet-and-quantum-cnn architecture

> Architecture diagram of the GitHub repository harshkumar077/underwater-animal-classification-using-resnet-and-quantum-cnn, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harshkumar077/underwater-animal-classification-using-resnet-and-quantum-cnn
- Repository: https://github.com/harshkumar077/underwater-animal-classification-using-resnet-and-quantum-cnn

## Overview

##### Project type and purpose
- This is a full-stack web application for Underwater Marine Animal Classification.
- It combines a browser-based UI (HTML/CSS/JS) with a Python backend exposing REST endpoints for:
- Image classification via hybrid Quantum-CNN + ResNet/Inception pipelines
- Chatbot interactions powered by GPT-2
- Lookup of geolocation data for classified species

##### File structure
- Top level “index.html”, “mainscript.js”, “mainstyle.css”, “popupContact.css”, “popupcontact.js” → Single-page frontend
- “server.py” (or “main.py”) → Backend web server (Flask/FastAPI style)
- “inception_execution.py”, “resnet50_execution.py” → Model-inference modules combining classical CNNs with quantum layers
- “quantum_execution.py” (implied by “inception_execution.py” for quantum calls)
- No dedicated DB folder → Likely in-memory/static JSON or small storage of species meta

##### From the README
- Purpose: classify underwater animals into 23 classes using a hybrid quantum-classical CNN
- Embedded GPT-2 chatbot for contextual marine life info
- Provides location data (latitude/longitude) for species hotspots

##### Main components
a. User Browser (Client UI)
- index.html + mainstyle.css + mainscript.js + popup.js/css
b. Web Server/API Layer
- server.py (Flask/FastAPI) handling HTTP(S) requests
- Routes: /classify, /chat, /species-info
c. Classification Service
- ResNet50 pipeline (resnet50_execution.py)
- InceptionNet pipeline (inception_execution.py)
- Underlying Quantum CNN layers (quantum execution)
d. Chatbot Service
- GPT-2 module imported in server.py or separate chatbot.py
e. Species Metadata Store
- Static JSON or Python dict mapping class → location data
f. Optional: Quantum Simulator or External Quantum Backend
- Local quantum simulator or cloud quantum resource endpoint

##### Relationships and data flows
- Browser → Web Server: HTTP POST /classify with image
- Web Server → Classification Service: in-process function calls
- Classification Service → Quantum Backend: invoke quantum layer simulator
- Classification Service returns “label + confidence”
- Web Server → Metadata Store: lookup lat/long for label
- Browser → Web Server: HTTP GET/POST /chat with user message
- Web Server → GPT-2 Chatbot: in-process model inference
- Responses returned to Browser

##### Architectural patterns and design principles
- RESTful API boundary between frontend and backend
- Modular ML pipelines: separate scripts for each model
- Hybrid computing: classical CPU/GPU + quantum simulation
- Single-page application (SPA) frontend
- Separation of concerns: classification vs. chatbot vs. metadata

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["User Browser\n(SPA UI)"]:::frontend

    subgraph "Client UI"
        direction TB
        Index["index.html"]:::frontend
        MScript["mainscript.js"]:::frontend
        Style["mainstyle.css"]:::frontend
        PopupJS["popupcontact.js"]:::frontend
        PopupCSS["popupContact.css"]:::frontend
    end

    subgraph "API Server"
        direction TB
        Server["Flask API\nserver.py"]:::backend
        Main["main.py"]:::backend
    end

    subgraph "Classification Service"
        direction TB
        ResNet["ResNet50+QuantumCNN\n(resnet50_execution.py)"]:::ml
        Inception["InceptionNet+QuantumCNN\n(inception_execution.py)"]:::ml
    end

    subgraph "Chatbot Service"
        direction TB
        GPT2["GPT-2 Module"]:::ml
    end

    Metadata["Species Metadata Store\n(in-memory JSON)"]:::data
    Quantum["Quantum Simulator\n/ External Quantum API"]:::external

    Browser -->|"POST /classify"| Server
    Browser -->|"POST /chat"| Server

    Server -->|"calls classify"| ResNet
    Server -->|"calls classify"| Inception
    ResNet -->|"invoke quantum layer"| Quantum
    Inception -->|"invoke quantum layer"| Quantum

    Server -->|"lookup label"| Metadata
    Server -->|"in-process GPT-2"| GPT2
    GPT2 -->|"response"| Server
    Server -->|"HTTP response"| Browser

    classDef frontend fill:#D6EAF8,stroke:#1F618D,color:#1B4F72;
    classDef backend fill:#D5F5E3,stroke:#196F3D,color:#145A32;
    classDef ml fill:#FAD7A0,stroke:#B9770E,color:#7E5109;
    classDef data fill:#FCF3CF,stroke:#B7950B,color:#7D6608;
    classDef external fill:#D5D8DC,stroke:#566573,color:#1C2833;

    click Index "https://github.com/harshkumar077/underwater-animal-classification-using-resnet-and-quantum-cnn/blob/main/index.html"
    click MScript "https://github.com/harshkumar077/underwater-animal-classification-using-resnet-and-quantum-cnn/blob/main/mainscript.js"
    click Style "https://github.com/harshkumar077/underwater-animal-classification-using-resnet-and-quantum-cnn/blob/main/mainstyle.css"
    click PopupJS "https://github.com/harshkumar077/underwater-animal-classification-using-resnet-and-quantum-cnn/blob/main/popupcontact.js"
    click PopupCSS "https://github.com/harshkumar077/underwater-animal-classification-using-resnet-and-quantum-cnn/blob/main/popupContact.css"
    click Server "https://github.com/harshkumar077/underwater-animal-classification-using-resnet-and-quantum-cnn/blob/main/server.py"
    click Main "https://github.com/harshkumar077/underwater-animal-classification-using-resnet-and-quantum-cnn/blob/main/main.py"
    click ResNet "https://github.com/harshkumar077/underwater-animal-classification-using-resnet-and-quantum-cnn/blob/main/resnet50_execution.py"
    click Inception "https://github.com/harshkumar077/underwater-animal-classification-using-resnet-and-quantum-cnn/blob/main/inception_execution.py"
```
