Train own image classifier with one line command

0xkoji

0xkoji

Posted on March 3, 2019

Train own image classifier with one line command

Recently, I released a python module, icTrainer that allows users to train image classifier easily.

icTrainer has 3 functions.

Collect images

This function allows users to collect images easily. However, there are a couple of issues on this function. First one is to collect zero byte image(but zero byte file is removed after finishing download process) and The images collected by this function isn't the best one for training image classifier, so users need to select images manually. However, I think still this function is useful when people want to download iamges from the internet quickly.

$ ictrainer --mode collect --keyword dog -n 250
$ ictrainer --mode collect --keyword cat -n 250
Enter fullscreen mode Exit fullscreen mode

Resize images

ImageResizer offers an image resizing function. This function is for iamges which are downloaded by ImageCollector(the first function), so need to follow the dataset/image_folder_name structure. (This issue will be fixed soon)

$ ictrainer --mode resize --target cat --image_width 480 --image_height 320
Enter fullscreen mode Exit fullscreen mode

Train image classifier

Then, the last function is to train a keras image classifier.
The output is .h5. Users can try own classifier with test script(https://github.com/koji/icTrainer/tree/master/check_model).
This function is using fine-tuning with vgg16.

$ ictrainer --mode train --classes "cat" "dog" --mname "dogAndcat_"
Enter fullscreen mode Exit fullscreen mode

I plan to add face detaction and face cropping function for training people's face classifier.

Details are here
https://github.com/koji/icTrainer
https://pypi.org/project/ictrainer/

💖 💪 🙅 🚩
0xkoji
0xkoji

Posted on March 3, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related