Skip to main content

cli tool for training your own image classifier with one line command!

Project description

PyPI version

icTrainer is a python module which allows users to train image classifier easily

Basically, this module is for python3

Install

$ pip install ictrainer

Also you can install manually.

clone repo
$ git https://github.com/koji/icTrainer.git
$ cd icTrainer/ictrainer
$ python setup.py install

How to Use

In this gude, we will create a dog/cat image classifier.

1.Collect Images

https://icrawler.readthedocs.io/en/latest/

$ ictrainer --mode collect --keyword dog -n 250
$ ictrainer --mode collect --keyword cat -n 250

You'll have dogs & cats images under dataset folder.

2. Resize images

In this step, we will change all images size for training. The current input size must be 320 x 180(required). This step may be mess up images you collected, so you need to check all images manually. In the furture, there will be a function that save your time.

$ ictrainer --mode resize --target dog
$ ictrainer --mode resize --target cat

For people want to use resize mode for other thing, you can use reize images with the following command.
The folder structure should be the same the above.

$ ictrainer --mode resize --target cat --image_width 480 --image_height 320

3.Create folders for classes

This step, we'll need to create folders and distribute images to train & validation folder.

3-1. create folders

Create a couple of folders under dataset.
This step will be automated in the future.

 dataset
    ├── train
    │   ├── cat
    │   └── dog
    └── val
        ├── cat
        └── dog

3-2. distribute images

Move images we got via image collect mode. In this case, probably we have 250 images for each other. We will put 225 images for train and 25 images for validation so that train/dog has 225 images and validation/dog has 25 images. The cats should be the same.

4.Train Images

There are some options we need to put. The most important one is --classes which will be labels. In this case, we have dog & cat, so we need to put them as classes. --batch: batch size default 16
--epoch: epoch default 30
--mname: output model name
--lr: learning rate default 1e-3
momentum: mementum default 0.9

We will use default settings.

$ ictrainer --mode train --classes "cat" "dog" --mname "dogAndcat_"

code

This code will be pushed soon. (cleaning up now)

pre-train model

smart device

https://github.com/koji/icTrainer/blob/master/model/smartdevice_epoch30.h5

classes = ['echo', 'echoplus', 'echoshow', 'googlehome', 'googlehomemini', 'nest']   

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ictrainer-0.2.7.tar.gz (7.7 kB view details)

Uploaded Source

File details

Details for the file ictrainer-0.2.7.tar.gz.

File metadata

  • Download URL: ictrainer-0.2.7.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.19.9 CPython/3.6.5

File hashes

Hashes for ictrainer-0.2.7.tar.gz
Algorithm Hash digest
SHA256 be4c9c85589fcfd94284d070df47c99d1c88b9a037b57e9efe0be6defddfae2f
MD5 d2ae3dfb75696d09d8b8f956c1271e9f
BLAKE2b-256 52fd9f974b9aba509ba324dd69683d30bdccfdde5e300462fc5b93c1427d4341

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page