Binary image classifier with transfer learning (MobileNet), YAML configuration, and GPU support on WSL2/Ubuntu via uv.
├── train.py # Training entrypoint
├── evaluate.py # Test-set evaluation and threshold search
├── multi_train.py # Run multiple config files sequentially
├── config.yaml # Default training configuration
├── model/ # Model architecture
├── utils/ # Config, data split, training pipeline, GPU setup
├── scripts/ # WSL setup and GPU check helpers
└── pyproject.toml # Dependencies (uv)
cd /mnt/c/Users/Matteo\ Baldelli/Desktop/tensorflow-image-classifier
bash scripts/setup-wsl.shOr manually:
export UV_LINK_MODE=copy
export UV_PROJECT_ENVIRONMENT="$HOME/.venvs/tensorflow-image-classifier"
uv sync
uv run python scripts/check_gpu.pyuv run python train.py
uv run python train.py --config path/to/config.yamlDataset layout:
data/
class_0/
class_1/
The split is written to tmp_split/{train,val,test} on each run. Logs and metrics go to logs/<run_name>/.
uv run python evaluate.py -m modelli/<model_path> [--threshold 0.5] [--mode standard|folder_split]config.yaml is validated at startup with Pydantic. Key fields:
| Field | Description |
|---|---|
auto_split |
Source/output dirs and val/test ratios |
input_shape |
[H, W, 3] — images are resized to 224×224 inside MobileNet |
batch_size, epochs, lr |
Training hyperparameters |
decay_rate, decay_steps |
Exponential learning-rate decay |
seed |
Reproducibility seed |
checkpoint_filepath |
Where best models are saved |
uv sync --group dev
uv run ruff check .