# debjit11/petvision architecture

> Architecture diagram of the GitHub repository debjit11/petvision, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/debjit11/petvision
- Repository: https://github.com/debjit11/petvision

## Overview

PetVision is a Cats-vs-Dogs image classifier: users upload an image and receive a class prediction with confidence. The documented training workflow uses dataset images to train and evaluate a CNN, then saves its weights for the Streamlit app to load during inference. The notebook is described in the README but its source was not sampled, so training and evaluation details reflect that documentation rather than inspected notebook code.

Main entry points: [`app.py`](https://github.com/debjit11/petvision/blob/main/app.py) (Streamlit app), [`main.ipynb`](https://github.com/debjit11/petvision/blob/main/main.ipynb) (Train and evaluate), [`model.py`](https://github.com/debjit11/petvision/blob/main/model.py) (CNN classifier), [`saved_models/image_classifier.pth`](https://github.com/debjit11/petvision/blob/main/saved_models/image_classifier.pth) (Saved weights)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Training"]
  node_notebook["Train and evaluate<br/>[main.ipynb]"]
  node_metrics["Loss and accuracy<br/>[main.ipynb]"]
end

subgraph group_inference["Inference"]
  node_app["Streamlit app<br/>[app.py]"]
  node_preprocess["Image transforms<br/>[app.py]"]
  node_result["Prediction and confidence<br/>[app.py]"]
end

subgraph group_model["Classifier"]
  node_cnn["CNN classifier<br/>[model.py]"]
  node_weights["Saved weights"]
end

node_user(("User"))
node_dataset[("Cat/Dog images")]

node_dataset -->|"training data"| node_notebook
node_notebook -->|"trains"| node_cnn
node_notebook -->|"records metrics"| node_metrics
node_notebook -->|"saves weights"| node_weights
node_user -->|"uploads image"| node_app
node_app -->|"loads weights"| node_weights
node_app -->|"applies transforms"| node_preprocess
node_app -->|"invokes"| node_cnn
node_cnn -->|"returns logits"| node_app
node_app -->|"computes and displays"| node_result
node_result -->|"shows result"| node_user

click node_notebook "https://github.com/debjit11/petvision/blob/main/main.ipynb"
click node_metrics "https://github.com/debjit11/petvision/blob/main/main.ipynb"
click node_app "https://github.com/debjit11/petvision/blob/main/app.py"
click node_preprocess "https://github.com/debjit11/petvision/blob/main/app.py"
click node_result "https://github.com/debjit11/petvision/blob/main/app.py"
click node_cnn "https://github.com/debjit11/petvision/blob/main/model.py"
click node_weights "https://github.com/debjit11/petvision/blob/main/saved_models/image_classifier.pth"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_notebook,node_metrics,node_user toneBlue
class node_app,node_preprocess,node_result,node_dataset toneAmber
class node_cnn,node_weights toneMint
```

## Components

### Training

- [Train and evaluate](https://github.com/debjit11/petvision/blob/main/main.ipynb): `main.ipynb`
- [Loss and accuracy](https://github.com/debjit11/petvision/blob/main/main.ipynb): `main.ipynb`

### Inference

- [Streamlit app](https://github.com/debjit11/petvision/blob/main/app.py): `app.py`
- [Image transforms](https://github.com/debjit11/petvision/blob/main/app.py): `app.py`
- [Prediction and confidence](https://github.com/debjit11/petvision/blob/main/app.py): `app.py`

### Classifier

- [CNN classifier](https://github.com/debjit11/petvision/blob/main/model.py): `model.py`
- [Saved weights](https://github.com/debjit11/petvision/blob/main/saved_models/image_classifier.pth): `saved_models/image_classifier.pth`

### Other components

- **User**
- **Cat/Dog images**

## Connections

- Cat/Dog images → Train and evaluate: training data
- Train and evaluate → CNN classifier: trains
- Train and evaluate → Loss and accuracy: records metrics
- Train and evaluate → Saved weights: saves weights
- User → Streamlit app: uploads image
- Streamlit app → Saved weights: loads weights
- Streamlit app → Image transforms: applies transforms
- Streamlit app → CNN classifier: invokes
- CNN classifier → Streamlit app: returns logits
- Streamlit app → Prediction and confidence: computes and displays
- Prediction and confidence → User: shows result
