isHotdog
isHotdog is a small MobileNetV3 image classifier inspired by the Silicon Valley "Hotdog / Not Hotdog" joke.
It answers one question:
Project Structure
1hotvision/
2 app.py Gradio UI
3 hotvision_model.py model loading and prediction logic
4 prepare_data.py creates Food-101 binary dataset
5 train.py trains MobileNetV3 Small
6 predict.py CLI prediction
7 requirements.txt dependencies
8 README.md internal project notes
Generated local folders:
1dataset/ prepared train/val image-folder dataset
2raw_data/ Food-101 cache
3model/isHotdog.pt trained model checkpoint
4photos/ local test images
Install
1cd models/hotvision
2python3.12 -m venv .venv
3source .venv/bin/activate
4pip install -r requirements.txt
Prepare Dataset
isHotdog can use three sources:
- Food-101:
hot_dog as Hotdog, selected other foods as Not Hotdog
antareepdey/Hotdog-or-not-a-hotdog: local hotdog / others images
hotdog-nothotdog: local train/test hotdog / nothotdog images
bghira/not-a-hotdog: hard negative not-hotdog images
Your downloaded Hugging Face datasets should be here:
1datasets/
2 datasets--antareepdey--Hotdog-or-not-a-hotdog/
3 datasets--bghira--not-a-hotdog/
4 hotdog-nothotdog/
Prepare the best mixed dataset:
python prepare_data.py --overwrite
Prepare only from the local Hugging Face datasets, without downloading Food-101:
python prepare_data.py --overwrite --no-food101
Use all bghira hard negatives instead of the default quick subset:
python prepare_data.py --overwrite --no-food101 --max-bghira 0
Output:
1dataset/train/hotdog
2dataset/train/not_hotdog
3dataset/val/hotdog
4dataset/val/not_hotdog
Recommended: use the mixed dataset if you can download Food-101. Use local-only if you want the fastest setup with the datasets already downloaded.
Train
python train.py --epochs 8 --batch 32
On macOS the default uses --num-workers 0 because it is the most stable option with local functions and Python multiprocessing.
If training on CPU, use a smaller batch:
python train.py --epochs 8 --batch 16
If pretrained MobileNetV3 weights cannot be downloaded, train from scratch:
python train.py --epochs 12 --batch 16 --no-pretrained
The model is saved to:
CLI Prediction
Put images into:
Run:
Or run one image:
python predict.py path/to/image.jpg
Example output:
test.jpg: ✅ Hotdog confidence=94.20% hotdog_probability=94.20%
Web App
The interface shows:
or:
Threshold
Default threshold:
Meaning: isHotdog says Hotdog only if hotdog probability is at least 60%.
Use a stricter threshold for fewer false hotdogs:
python predict.py photo.jpg --threshold 0.75
Notes
- This is a classifier, not object detection.
- It does not draw boxes because the task only needs binary image-level output.
- MobileNetV3 Small is used because it is light, fast, and good enough for this joke/product.
- Do not commit
dataset/, raw_data/, model/, runs/, or local photos.