Kompletní end-to-end machine learning projekt demonstrující přechod od teoretického trénování modelu k reálnému nasazení. Aplikace využívá konvoluční síť (CNN) natrénovanou na datasetu Fashion MNIST k rozpoznávání typů oblečení v moderním uživatelském rozhraní. A complete end-to-end machine learning project demonstrating the transition from theoretical model training to real-world deployment. This application utilizes a Convolutional Neural Network (CNN) trained on the Fashion MNIST dataset to recognize clothing types within a modern graphical user interface.
Tento repozitář není jen dalším tutoriálem na MNIST. Zaměřuje se na inženýrské aspekty nasazení ML modelů: This repository isn't just another MNIST tutorial. It focuses on the engineering aspects of deploying ML models:
fashion_classifier/
├── data/ # Automatically generated (dataset, models, logs)
├── src/
│ ├── app.py # Main GUI application (CustomTkinter)
│ ├── model.py # CNN architecture definition
│ ├── train.py # Training configuration and entry point
│ └── trainer.py # Encapsulated training loop and logging
├── requirements.txt
└── README.md
Doporučuje se použít virtuální prostředí (venv/conda). It is recommended to use a virtual environment (venv/conda).
1. Instalace závislostí1. Install Dependencies
pip install -r requirements.txt
2. Trénování modelu2. Train the Model (Fashion MNIST)
Spusťte trénovací pipeline. Skript automaticky stáhne dataset, inicializuje W&B a uloží nejlepší váhy. Run the training pipeline. The script will automatically download the dataset, initialize Weights & Biases, and save the best model.
python src/train.py
3. Spuštění aplikace3. Run the Application
Jakmile je model natrénován, spusťte vizuální dashboard. Once the model is trained, launch the visual dashboard.
python src/app.py
Síť je lehká CNN navržená pro rychlou inferenci i na CPU. Extrahování příznaků obstarávají 2 konvoluční bloky mapující 1 kanál na 32 kanálů. Klasifikátor poté převádí příznaky přes skrytou vrstvu se 128 neurony na výstup pro 10 tříd oblečení. The network is a lightweight CNN designed for fast inference even on a CPU. The Feature Extractor maps 1 channel to 32 channels via 2 Convolutional blocks. The Classifier then flattens the features into a hidden layer with 128 neurons, outputting to 10 clothing class logits.
import torch.nn as nn
class FashionClassifierCNN(nn.Module):
def __init__(self):
super().__init__()
# Feature Extractor: 1 channel -> 32 channels
self.features = nn.Sequential(
nn.Conv2d(1, 16, kernel_size=3, padding=1),
nn.ReLU(),
nn.MaxPool2d(2),
nn.Conv2d(16, 32, kernel_size=3, padding=1),
nn.ReLU(),
nn.MaxPool2d(2)
)
# Classifier: Flatten -> 128 hidden neurons -> 10 clothing logits
self.classifier = nn.Sequential(
nn.Flatten(),
nn.Linear(32 * 7 * 7, 128),
nn.ReLU(),
nn.Linear(128, 10)
)
def forward(self, x):
return self.classifier(self.features(x))
Všechny trénovací běhy jsou automaticky logovány. Křivky ztrátové funkce a metrik můžete sledovat lokálně pomocí TensorBoardu: All training runs are automatically logged. You can view the loss curves and accuracy metrics locally using TensorBoard:
tensorboard --logdir data/runs
Případně si je můžete zobrazit v cloudových dashboardech vašeho účtu Weights & Biases. Or view your rich dashboards in the cloud via your Weights & Biases account.