Skip to content

πŸ€– Train ResNet based model to detect if images is street art or not

Notifications You must be signed in to change notification settings

NewPublicArtFoundation/streetart-notstreetart

Β 
Β 

Repository files navigation

npaf-logo

Street art, not street art

Train a model that detects if image is or is not street art, based on images gathered from hashtagged content.

What

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.

Image montage

Training results

Version one of the model and dataset, which was uncleaned, resulted in the following results:

Training results

The latest training results can be seen on Comet.ml here: https://www.comet.ml/lenny/street-art-detection/dcec5a30912543839cc27ed30083cee2

screen shot 2019-01-19 at 11 59 36 pm

Dataset

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

How to run

  1. pip install -r requirements.txt
  2. Download dataset from Floydhub into /dataset. Folder structure for /dataset/images should match the format listed above.
  3. Run python build_dataset.py. This will create the /testing, /training, and /validation dataset.
  4. Run python save_model.py or use the python notebook and run the training step.
  5. Use python load_model.py to validate the results.

About

πŸ€– Train ResNet based model to detect if images is street art or not

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 96.2%
  • Python 3.8%