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 one of the model and dataset, which was uncleaned, resulted in the following results:
The latest training results can be seen on Comet.ml here: https://www.comet.ml/lenny/street-art-detection/dcec5a30912543839cc27ed30083cee2
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 [generated from build_dataset.py]
βΒ Β βΒ Β βββ not_streetart [858 entries exceeds filelimit, not opening dir]
βΒ Β βΒ Β βββ streetart [396 entries exceeds filelimit, not opening dir]
βΒ Β βββ training [generated from build_dataset.py]
βΒ Β βΒ Β βββ not_streetart [3124 entries exceeds filelimit, not opening dir]
βΒ Β βΒ Β βββ streetart [1387 entries exceeds filelimit, not opening dir]
βΒ Β βββ validation [generated from build_dataset.py]
βΒ Β βββ not_streetart [340 entries exceeds filelimit, not opening dir]
βΒ Β βββ streetart [161 entries exceeds filelimit, not opening dir]
βββ build_dataset.py
βββ load_model.py
βββ README.md
βββ save_model.py
βββ Street Art Detector.ipynb
βββ streetart_model_v1.model
βββ streetart_montage_v1.png
βββ streetart_training_plot_v1.png
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 save_model.py
or use the python notebook and run the training step. - Use
python load_model.py
to validate the results.