isHotdog
isHotdog is a small MobileNetV3 image classifier inspired by the Silicon Valley "Hotdog / Not Hotdog" joke.
It answers one question:
Hotdog
Not Hotdog
Project Structure
hotvision/
app.py Gradio UI
hotvision_model.py model loading and prediction logic
prepare_data.py creates Food-101 binary dataset
train.py trains MobileNetV3 Small
predict.py CLI prediction
requirements.txt dependencies
README.md internal project notes
Generated local folders:
dataset/ prepared train/val image-folder dataset
raw_data/ Food-101 cache
model/isHotdog.pt trained model checkpoint
photos/ local test images
Install
cd models/hotvision
python3.12 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Prepare Dataset
isHotdog can use three sources:
- Food-101:
hot_dogasHotdog, selected other foods asNot Hotdog antareepdey/Hotdog-or-not-a-hotdog: local hotdog / others imageshotdog-nothotdog: local train/test hotdog / nothotdog imagesbghira/not-a-hotdog: hard negative not-hotdog images
Your downloaded Hugging Face datasets should be here:
datasets/
datasets--antareepdey--Hotdog-or-not-a-hotdog/
datasets--bghira--not-a-hotdog/
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:
dataset/train/hotdog
dataset/train/not_hotdog
dataset/val/hotdog
dataset/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:
model/isHotdog.pt
CLI Prediction
Put images into:
photos/
Run:
python predict.py
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
python app.py
The interface shows:
โ
Hotdog
or:
โ Not Hotdog
Threshold
Default threshold:
0.60
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.