-
We have seen a popular meme that tries to represent the similarity shared between animals and food such as "Shiba Inu dog or toasted marshmallow?" So, We would like to develop the deep learning model that removes the uncertainty of an image that could be like a loaf of bread or corgi butt. But for sure, We just do it for fun.
-
We used the PyTorch framework with GPU to develop our model using Google Colaboratory.
-
Bread dataset was acquired from the combination of Google Open Images V5 + Google Images search
-
Corgi dataset was acquired from the combination of ImageNet + Stanford Dogs + Google Images search
After that, we manually remove incorrect images and apply phash (Perceptual Hashing) to get rid of duplication images.
-
Total images: 6385 images (randomly split using 80:10:10 ratios)
- Bread: 3710 images
- Train: 2968 images
- Valid: 371 images
- Test: 371 images
- Corgi: 2675 images
- Train: 2140 images
- Valid: 268 images
- Test: 267 images
- Bread: 3710 images
-
Set | Loss | Accuracy |
---|---|---|
Train | 0.0077 | 0.9977 |
Valid | 0.0132 | 0.9969 |
Test | - | 0.9968 |
- We already know that in order to benchmark our model performance, we can't just use
accuracy
andvalidation_loss
value as the only acceptable metrics.
You can download our model weight here: v1.3
Configuration | Value |
---|---|
Epoch | 3 |
Batch Size | 32 |
Optimizer | ADAM |
- To reproduce the model, requires our datasets. You can send me an e-mail at
[email protected]
if you are interested.
-
Initial datasets/ directory structure
└───datasets/ │ butt/ │ bread/
-
Install dataset-split library
pip install dataset-split
-
Execute
dataset-split
command with following argumentsdataset-split dataset/ -r 0.8 0.1 0.1
-
Ready-to-go datasets/ directory structure
└───datasets/ │ │ │ └───train │ │ │ butt/ │ │ │ bread/ │ └───test │ │ │ butt/ │ │ │ bread/ │ └───valid │ │ │ butt/ │ │ │ bread/
-
Clone this repository
git clone https://github.com/Kawaeee/butt_or_bread.git
-
Install dependencies
pip install -r requirements.txt
-
Run the
train.py
python scriptpython train.py --dataset-path datasets/ --model-path buttbread_resnet152_3.h5
-
Check jupyter notebook for interactive prediction:
predictor.ipynb
-
Clone this repository
git clone https://github.com/Kawaeee/butt_or_bread.git
-
Install dependencies
pip install -r requirements.txt
-
Run the streamlit
streamlit run streamlit_app.py
Streamlit web application will be hosted on http://localhost:8501
- Following instructions below
# Directly build and run
docker build -t butt-bread-image .
docker run --rm --name=butt-bread-container -p 0.0.0.0:8501:8501 butt-bread-image
# Serve with docker compose
docker-compose build
docker-compose up