A image classification project that fine-tunes a Hugging Face vision model (ViT)(look around before finalizing on ViT?) to classify Korean BBQ meats (e.g., beef brisket vs pork belly). It includes a training pipeline, an inference utility, and a FastAPI backend? with a simple local web UI. Train model locally before deploying.
Features
Transfer learning on a pretrained ViT model? via Hugging Face Transformers + Datasets
ImageFolder-based local dataset support with train/val split utility
Proper label mapping persistence for reliable inference and Hub sharing
Metrics: accuracy, F1 (macro), confusion matrix support
Early stopping and checkpointing
FastAPI inference service with an upload page
Optional push to Hugging Face Hub (model + config)
Project Structure
.
├─ src/kbbq_classifier/ # Package code (shared utilities)
├─ scripts/ # CLI scripts for train/eval/predict and dataset tools
├─ app/ # FastAPI backend + minimal UI
│ ├─ templates/
│ └─ static/
├─ configs/ # YAML configs (training, paths)
├─ data/ # Put your dataset here (ignored by git)
├─ artifacts/ # Model outputs/checkpoints (ignored by git)
├─ tests/ # Basic tests
├─ requirements.txt
├─ README.md
└─ .gitignore
# One-time login, interactive (optional)
huggingface-cli login
# Or via environment variable in the shell session
$env:HUGGINGFACE_HUB_TOKEN = "your_token_here"
With small datasets (<200 images), strong augmentation and transfer learning are key. Might need to collect more data over time if model is weak.
Can change the base model name (e.g., google/vit-base-patch16-224) in configs/train.yaml. Smaller models may train faster.
For GPU acceleration, install appropriate PyTorch build (pytorch.org). The default torch in requirements is CPU-friendly.
Roadmap
Transfer learning image classifier with Hugging Face
FastAPI inference service + simple UI
Model monitoring and drift checks
Dockerization and CI/CD
Full-stack frontend and cloud deployment
Built with Transformers, Datasets, FastAPI
python project w/ training, inference, API, and tests
10/24/25 -
scaffold project struct w/ app for website, configs for model & parameters, src for ??, data for image datasets, scripts for running program like splitting dataset, training, and evaulation, and basic stuff like gitignore, readme, requirements.
create env and install dependencies
split data into train/validation
train and evaulate (some small errors but fixed w/ some code)
quick prediction (predictions are good only on existing train/val data(obviously?), but will still rank high top-k for random images in either direction, so prob need a lot more data, try testing on real world example w/ only those 2 classes)
testing on downloaded google images seem to be ok w/ those 2 specific classes, but colors of pb and bb overlap so cant be wrong, need a way to differiante in training between the 2 classes