Pill Shape Classifier can be used in industrial belts to help classify pills on their shapes. This can further increase the speed and help to decrease human errors. Pill segregation can also be domestically used by older adults to help identify their medicines. This project was made using the UP Embedded Vision Starter Kit.
Identifying a pill that a patient has taken is a difficult task. For a patient who has accidentally taken an unknown pill or for a patient who needs to take the correct pill at the correct time, identifying the correct pill can be a life or death task. Often times, many pills look similar and patients and even doctors have a hard time identifying them. The first step however to identifying a pill is to know what shape it has.
Pills can come in various shapes: Oval, Round, Capsule etc. In this project, we use a simple Neural Network to identify what shape a pill has.
The data for this project was collected from the Pillbox dataset. The link for this can be found here.
From this dataset, we separated the pills into 5 classes: Capsule, Oval, Oblong, Round and Other. The separated dataset which is the one that was used for this project can be found here
This is a new dataset that was built for this project. We believe that this dataset can be used also for learning about Deep Learning as it is simple and yet complex enough due to class imbalances to be challenging. You can find out more information about this dataset here
Since the neural network is meant to be run on an embedded or Edge device, the neural network model chosen was one built specifically for Edge devices: Xception.
You can train the neural network here. You can specify whether how many epochs you want to train for, where to save the model and how many times to fine tune to model using command line arguments.
A sample training code would be like this:
python3 xception_transfer.py --nb_epoch 1 --batch_size 16 --model models/model.h5
You can then perform classification on the model by using the classification script here. Run it using the following command:
This project requires
python3.6. While you can train on a GPU or any other machine, for performing inference, you will need the UP Vision Embedded Kit. Other package requirements are in the requirements file.
This project was made using the UP Board Embedded Vision Starter Kit. It consisted of UP Board, Basler Camera and an Adapter of 5 V.
UP Board: UP Board has the provision of running and installing an Ubuntu OS. This helps in easily running and deploying machine learning and deep learning models
Basler Camera: The Basler Camera runs on the Pylon Software which can be easily installed. There is also a provision for taking multiple consecutive images on the software which helps in creating the appropriate test data.
1) Industrial Applications: This particular project can be used on the industrial floor of pharmaceutical industries. The entire embedded vision starter kit consisting of the Basler camera to take pictures with the UP board microcontroller can be used to help identify the shapes of the pills and further segregate them. The Basler camera can be installed on an industrial belt and this can further help to increase speed, consecutively reducing errors.
2) Domestic Applications: This project can also be used for identifying pills for older adults. Older people take medicines quotidianly. And due to their health complications sometimes accompanied with reduced vision, can cause them to misidentify pills. A pill identifier can help reduce such fatal errors. Therefore, combining this pill shape identifier with a software application can help them distinguish medicines.
There can be further work be done in creating a mobile application along with the board giving users a better interface for pill segregation.