# yakhyobek1997/cats-and-dogs-resnet50 architecture

> Architecture diagram of the GitHub repository yakhyobek1997/cats-and-dogs-resnet50, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yakhyobek1997/cats-and-dogs-resnet50
- Repository: https://github.com/yakhyobek1997/cats-and-dogs-resnet50

## Overview

##### Project type and purpose
- Type: A machine-learning image classification pipeline implemented in a Jupyter notebook.

##### File structure
- Top-level:
- README.md – describes project goals and functionality
- “cats dogs” directory – contains subfolders for each class (train/test images)
- resnet.ipynb – the single Jupyter notebook hosting the entire pipeline
- No additional source directories, config files, or microservices. All logic lives in the notebook.

##### Key architecture insights from README
- Stages: Data Preparation → Model Creation → Training → Evaluation → Visualization
- Uses standard image transforms, cross-entropy loss, Adam optimizer, and confusion matrix.

##### Main components & their interactions
a. Data Storage
- Raw image folders (“cats dogs”) split into train/test subdirectories.
b. Data Ingestion & Preprocessing
- Jupyter Notebook cells load images via a DataLoader, apply Resize, CenterCrop, ToTensor, Normalize transforms.
c. Model Definition
- ResNet50 backbone with final fully-connected layer adjusted for 2 classes.
d. Training Engine
- Training loop: forward pass, loss computation, backward pass, optimizer step; logs train/val loss & accuracy.
e. Evaluation Module
- Runs model on test set; computes predictions and constructs a confusion matrix.
f. Visualization Module
- Plots loss/accuracy curves across epochs and displays the confusion matrix.

##### Architectural patterns & design principles
- Pipeline pattern: sequential dataflow through well-defined stages.
- Modularity within the notebook: separate code cells for each stage.
- Reuse of a pre-trained backbone (transfer learning).

##### Technologies and frameworks
- Python & Jupyter Notebook
- PyTorch (torchvision.models, DataLoader, transforms)
- matplotlib or seaborn for plotting
- scikit-learn (confusion_matrix)

##### Putting it all together
- “Metrics Store” (train/val curves)

## Diagram (Mermaid)

```mermaid
flowchart TD
    README["README.md"]:::doc
    DataStorage[(Raw Image Folders)]:::data
    subgraph "resnet.ipynb"
        DataPre["Data Preprocessing"]:::compute
        ModelDef["Model Definition\n(ResNet50 + FC Layer)"]:::compute
        Train["Training Loop\n(loss + optimizer)"]:::compute
        Eval["Evaluation\n(Test Inference & Confusion Matrix)"]:::compute
        Metrics["Metrics Store\n(Train/Val Logs)"]:::output
        Viz["Visualization\n(Loss/Accuracy & Confusion Matrix)"]:::output
    end

    README --> DataStorage
    DataStorage --> DataPre
    DataPre --> ModelDef
    ModelDef --> Train
    Train --> Metrics
    Train --> Eval
    Eval --> Viz

    click README "https://github.com/yakhyobek1997/cats-and-dogs-resnet50/blob/main/README.md"
    click DataStorage "https://github.com/yakhyobek1997/cats-and-dogs-resnet50/tree/main/cats dogs/"
    click DataPre "https://github.com/yakhyobek1997/cats-and-dogs-resnet50/blob/main/resnet.ipynb"
    click ModelDef "https://github.com/yakhyobek1997/cats-and-dogs-resnet50/blob/main/resnet.ipynb"
    click Train "https://github.com/yakhyobek1997/cats-and-dogs-resnet50/blob/main/resnet.ipynb"
    click Eval "https://github.com/yakhyobek1997/cats-and-dogs-resnet50/blob/main/resnet.ipynb"
    click Metrics "https://github.com/yakhyobek1997/cats-and-dogs-resnet50/blob/main/resnet.ipynb"
    click Viz "https://github.com/yakhyobek1997/cats-and-dogs-resnet50/blob/main/resnet.ipynb"

    classDef data fill:#cce5ff,stroke:#004085,color:#004085;
    classDef compute fill:#d4edda,stroke:#155724,color:#155724;
    classDef output fill:#fff3cd,stroke:#856404,color:#856404;
    classDef doc fill:#f8d7da,stroke:#721c24,color:#721c24;
```
