Machine learning is a form of coding that creates a model capable of mimicking human tendencies and abilities, usually by interpreting and analyzing data. This is the idea behind AI, or artificial intelligence. There are three main types of machine learning, supervised, unsupervised, and reinforcement. The poster to the left gives a brief overview of each type. For my project I used supervised learning, and the model is capable of analyzing data in the form of images to identify objects in a testing dataset.
My machine learning model classifies images into one of four items, using Python coding. It is the culmination of my class' work with python coding, and has a 94% accuracy rate when tested. Below, you can find more detailed information on my dataset, the structure of the model, and examples of mistakes and successes. The model itself can be viewed by using the link to the left.
Mask
Gloves
Goggles
Hand Sanitizer
My goal with this model was to identify four different items with an accuracy of at least 90%. These items were a mask, safety goggles, plastic gloves, and a bottle of hand sanitizer. The items I used are shown to the left.
The dataset that I collected contains 1004 images, 251 of each item, each a 48x48 pixel image. Four fifths of the images (804) are randomly assigned to the training dataset, and the remaining fifth (201) is the testing dataset. I took the images using a program that takes a large number of pictures rapidly, which has resulted in a relatively homogeneous dataset. The folder for this data that I created in Google Drive can be viewed to the left, and examples of the images I took are shown below.
Mask
Goggles
Gloves
Hand Sanitizer
To the left is the code that I used to build the model itself. The first line defines the input using a keras command, and brings in the training tensors created earlier in the code. The second line of code creates a dense layer that improves the accuracy of the model, with 1024 neurons and a sigmoid activation function. The third line of code gives the output and a second dense layer to improve accuracy. The third line defines the term "model" using another keras command, and the final line returns a summary of the model.
This image was labeled, by me, as "Goggles," and the model accurately identified it as such.
This image was labeled as "HandSanitizer," and the model accurately identified it correctly.
This image was labeled as "Masks," and the model predicted this correctly.
This image was of hand sanitizer, but the model predicted that it was a mask. This was likely due to the low image quality making the shape somewhat ambiguous, and could be solved through refining the model or adding more epochs to the training process.
This was an image of a mask, but was incorrectly identified as goggles by the model.
This was an image of hand sanitizer that was predicted to be a mask, likely because the colors are similar in distribution to the mask.