ねこでじ(Nekodigi)

Nekodigi’s diary

Programming, Art, Travel and etc...

【Pytorch】Create Real-Time Image Classifier!

Abstract

www.youtube.com
I've tried some PyTorch examples like CIFAR-10, but those examples are not real-time. For this reason, I created a real-time PyTorch image classifier. In this project, you can create custom datasets and test them in real-time with your webcam.

How it works

You can create an AI following steps.
1. Create datasets.
Take pictures with OpenCV and store them.
2. Create a neural network.
3. Classify images with it.

1.Create datasets

Take pictures with OpenCV and store them for each class.
Then get file paths and create a dataset that contains images and labels.

2.Create a neural network

Create a simple convolutional network that outputs class id.
Then, set up the optimizer and train the network.

3. Classify images with it.

Input camera image into the trained network and predict class name.

Source code and How to use it

1. Run this notebook with Jupyter Notebook.

*This project requires some libraries such as PyTorch.
gist.github.com