AI-Boosted Microplastics Detector Ep.2

Previously I brought a bag of plastic debris back to home. Taking a closer look at the flotsam, in most of the cases, they’re natural fragments such as twigs or shells, which is no problem being on the beach. Therefore, the key part of this project is going to be finding and picking plastic fragments from the whole mess.

As the first step to tackle this problem, I’m trying to build something basic, a simple image classifier. It seems to be relatively straightforward because the basic algorithm for image recognition has been fully established in the last ten years. A lot of useful deep learning libraries are available out there such as Tensorflow or PyTorch. On top of that, pre-trained neural networks are also available with those libraries. These are pretty handy for rapid prototyping. However, without my own training data, it would never be able to build something specific to this project. This means that I need to make my own training dataset of plastics.

The dataset I need to prepare is a whole bunch of image data, which is categorized into two classes. Firstly I randomly selected 500 plastics and 500 natural fragments from the whole samples.


To shoot these samples, I built a custom device which has 2 web cames and a flashlight and a rotating platform so that I can shoot objects from various angles. By the way, my 3D printer(Flashforge Adventurer3) worked great to put all parts together. Although I’m not sure about how much additional information to be given by multi-angled shooting, it won’t do any harm anyway.

The simplest image classification task is to predict a label to an unknown image, such as famously known as MNIST image classification. Prediction for an image that has only one object in the center position on a clear background will assumably be the easiest. So I made dataset like this.

I ended up having 10,000 jpeg images with 1,000 objects. Although the dataset contains some abnormal data because my webcams occasionally fail. With that being done, let’s move on to the training part. Continues to the Ep.3