# ankit-20285/cats-vs-dogs-cnn-classifier architecture

> Architecture diagram of the GitHub repository ankit-20285/cats-vs-dogs-cnn-classifier, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ankit-20285/cats-vs-dogs-cnn-classifier
- Repository: https://github.com/ankit-20285/cats-vs-dogs-cnn-classifier

## Overview

This is a small TensorFlow/Keras cats-versus-dogs classifier. Its main workflow trains a CNN from a directory-based image dataset, saves a model, then loads that model to classify images in Prediction_Samples. The README also describes data cleaning and training visualization, but the available source does not show their implementation. Note that train.py saves to the current directory while predict.py loads from Models/.

Main entry points: [`predict.py`](https://github.com/ankit-20285/cats-vs-dogs-cnn-classifier/blob/main/predict.py) (Image preprocessing and prediction), [`train.py`](https://github.com/ankit-20285/cats-vs-dogs-cnn-classifier/blob/main/train.py) (Dataset loading and training), [`Models/cats_vs_dogs.keras`](https://github.com/ankit-20285/cats-vs-dogs-cnn-classifier/blob/main/Models/cats_vs_dogs.keras) (Saved model), [`Prediction_Samples`](https://github.com/ankit-20285/cats-vs-dogs-cnn-classifier/tree/main/Prediction_Samples) (Prediction samples)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Model training"]
  node_trainer["Dataset loading and training<br/>[train.py]"]
  node_cnn["CNN architecture<br/>[train.py]"]
end

subgraph group_inference["Image inference"]
  node_predictor["Image preprocessing and prediction<br/>[predict.py]"]
  node_classification["Cat or dog result<br/>[predict.py]"]
end

subgraph group_artifacts["Model and samples"]
  node_trained_model["Saved model<br/>[cats_vs_dogs.keras]"]
  node_samples["Prediction samples"]
end

node_user(("User"))
node_dataset[("Cat dog dataset")]

node_trainer -->|"loads images"| node_dataset
node_trainer -->|"fits model"| node_cnn
node_trainer -->|"saves model"| node_trained_model
node_user -->|"runs"| node_predictor
node_predictor -->|"loads model"| node_trained_model
node_predictor -->|"reads images"| node_samples
node_predictor -->|"prints label"| node_classification

click node_trainer "https://github.com/ankit-20285/cats-vs-dogs-cnn-classifier/blob/main/train.py"
click node_cnn "https://github.com/ankit-20285/cats-vs-dogs-cnn-classifier/blob/main/train.py"
click node_trained_model "https://github.com/ankit-20285/cats-vs-dogs-cnn-classifier/blob/main/Models/cats_vs_dogs.keras"
click node_samples "https://github.com/ankit-20285/cats-vs-dogs-cnn-classifier/tree/main/Prediction_Samples"
click node_predictor "https://github.com/ankit-20285/cats-vs-dogs-cnn-classifier/blob/main/predict.py"
click node_classification "https://github.com/ankit-20285/cats-vs-dogs-cnn-classifier/blob/main/predict.py"

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_trainer,node_cnn,node_user toneBlue
class node_predictor,node_classification,node_dataset toneAmber
class node_trained_model,node_samples toneMint
```

## Components

### Model training

- [Dataset loading and training](https://github.com/ankit-20285/cats-vs-dogs-cnn-classifier/blob/main/train.py): `train.py`
- [CNN architecture](https://github.com/ankit-20285/cats-vs-dogs-cnn-classifier/blob/main/train.py): `train.py`

### Image inference

- [Image preprocessing and prediction](https://github.com/ankit-20285/cats-vs-dogs-cnn-classifier/blob/main/predict.py): `predict.py`
- [Cat or dog result](https://github.com/ankit-20285/cats-vs-dogs-cnn-classifier/blob/main/predict.py): `predict.py`

### Model and samples

- [Saved model](https://github.com/ankit-20285/cats-vs-dogs-cnn-classifier/blob/main/Models/cats_vs_dogs.keras): `Models/cats_vs_dogs.keras`
- [Prediction samples](https://github.com/ankit-20285/cats-vs-dogs-cnn-classifier/tree/main/Prediction_Samples): `Prediction_Samples`

### Other components

- **User**
- **Cat dog dataset**

## Connections

- Dataset loading and training → Cat dog dataset: loads images (evidence: `train.py`)
- Dataset loading and training → CNN architecture: fits model (evidence: `train.py`)
- Dataset loading and training → Saved model: saves model (evidence: `train.py`)
- User → Image preprocessing and prediction: runs (evidence: `README.md`)
- Image preprocessing and prediction → Saved model: loads model (evidence: `predict.py`)
- Image preprocessing and prediction → Prediction samples: reads images (evidence: `predict.py`)
- Image preprocessing and prediction → Cat or dog result: prints label (evidence: `predict.py`)
