1 line script for training an image classification model (including data acquisition)
Frameworks such as keras and fast ai allow “easy” training. Why not combine?
Introducing: stupid_cv.
All technologists are automation enthusiasts and - lets face it - script kiddies. And since according to Eric Schmidt computer vision is a solved problem, I’ve decided to assemble a small script that will be kind of auto solver for computer vision.
Open images v4 allows to easilly and programmitacly download many images according classes (unlike imagenet, there may be numerous objects in every image)
To install, clone this repo, and install the requirements. You'd better have GPU on your machine.
First, get the open images data frames:
Dataset type is one of train, validation, test https://storage.googleapis.com/openimages/2018_04/{dataset_type}/{dataset_type}-annotations-bbox.csv dataset_type = train (1.1MB), validation (16MB), test (50MB) (train is very big)
classes specification can be loaded from here:
https://storage.googleapis.com/openimages/2018_04/class-descriptions-boxable.csv
python list_classes.py
Use it as follows:
python main.py --data_root <some_dir> --classes Apple Banana Orange
- Wait for it..
- Find the model in `<some_dir>/models
- Profit!
Arguments:
data_root
- the folder where the images should will be downloaded to, and the models will be saved. Open Images data frames should be placed in this folderdata_type
- select the data type form open images, as stated aboveclasses
- select classes to download and train a model on, from open images 600 classescut_image
- should the training script "cut" the relevant objects from the images
Config model in config.yaml
- Upgrade to open images 5
- Add list_classes.py
- Check functionallity of cut_images
- Add detection (and segmentation?) functionallity
- Add efficient tracking
- Add serving/deploy
Credit for open image downloader: https://github.com/qfgaohao/pytorch-ssd