Train a model that detects if image is or is not street art, based on images gathered from hashtagged content.
The project above trains a model that detects whether an image is or is not street art. The model is trained on a image set gathered from hashtagged images for #streetart. The training data was compared against images from New York City. The image dataset was cleaned manually to have any mistagged content and NSFW images removed.
Version two of the model and dataset, resulted in the following results:
Name | Value | Min | Value | Max |
---|---|---|---|---|
1 | acc | 0.804197365509982 | 0.375 | 0.9375 |
2 | batch | 130 | 0 | 130 |
3 | loss | 0.5488157922014857 | 0.36985594034194946 | 1.2533280849456787 |
4 | size | 32 | 31 | 32 |
5 | val_acc | 0.7505330491040562 | 0.7036247338567462 | 0.7974413653680765 |
6 | val_loss | 0.6231901207204058 | 0.5713440334873159 | 0.7559062163035075 |
The latest training results can be seen on FloydHub here: https://www.floydhub.com/rememberlenny/projects/streetart-notstreetart/3
Dataset training dataset can be downloaded from Floydhub here: https://www.floydhub.com/rememberlenny/datasets/streetart-notstreetart
To work correctly, save the dataset into the /streetart
folder.
The correct directory structure should look like this:
βββ pyimagesearch
βΒ Β βββ __pycache__
βΒ Β βΒ Β βββ config.cpython-36.pyc
βΒ Β βΒ Β βββ __init__.cpython-36.pyc
βΒ Β βΒ Β βββ resnet.cpython-36.pyc
βΒ Β βββ config.py
βΒ Β βββ __init__.py
βΒ Β βββ resnet.py
βββ streetart
βΒ Β βββ images
βΒ Β βΒ Β βββ not_streetart [4322 entries exceeds filelimit, not opening dir]
βΒ Β βΒ Β βββ streetart [1944 entries exceeds filelimit, not opening dir]
βΒ Β βββ testing
βΒ Β βΒ Β βββ not_streetart [858 entries exceeds filelimit, not opening dir]
βΒ Β βΒ Β βββ streetart [396 entries exceeds filelimit, not opening dir]
βΒ Β βββ training
βΒ Β βΒ Β βββ not_streetart [3124 entries exceeds filelimit, not opening dir]
βΒ Β βΒ Β βββ streetart [1387 entries exceeds filelimit, not opening dir]
βΒ Β βββ validation
βΒ Β βββ not_streetart [340 entries exceeds filelimit, not opening dir]
βΒ Β βββ streetart [161 entries exceeds filelimit, not opening dir]
βββ build_dataset.py
βββ not_streetart.png
βββ README.md
βββ requirements.txt
βββ Street Art Detector.ipynb
βββ streetart_model.model
βββ streetart_montage.png
βββ streetart_plot.png
βββ test_model_by_generating_montage.py
βββ train_model.py
pip install -r requirements.txt
- Download dataset from Floydhub into
/dataset
. Folder structure for/dataset/images
should match the format listed above. - Run
python build_dataset.py
. This will create the/testing
,/training
, and/validation
dataset. - Run
python train_model.py
or use the python notebook and run the training step. - Use
python test_model_by_generating_montage.py
to validate the results.