The aim of the project was to design a image classifier which used machine learning (ML) to perform binary classification, controlled by a GUI interface on the user’s PC. The module captures images and trains ML models to provide predictions based on the trained ML model. The purpose of the design was to produce an all-in-one ML package with integrated hardware and software which the user can intuitively use without prior knowledge.
For hardware, the device used one OV7670 camera along with a shift register to control LEDs for brightness instead The camera and LEDs were connected to an STM32F446RE microcontroller on a PCB which contains a USB connector that allowed the user to connect to a PC. The microcontroller transmitted the pixel data of the image to the PC through USB. STM32 is programmed in C. The system architecture is shown in figure 1.
Figure 1: Hardware block diagram.
Software contains a user interface that allows the user to operate the camera and to view the images transmitted by the microcontroller. The software allowed the user to train a Support Vector Machine (SVM) algorithm with the feature size of the image reduced using Principal Component Analysis (PCA). Graphical user interface (GUI) design is shown in figure 2. GUI is programmed in python.
Figure 2: Screenshot of GUI.
The PCB of the board was designed in Altium designer. It has four layers with the top layer and bottom layers being the wiring between STM32 and the peripherals and the middle layers being the power and ground layers. The comparison between the PCB design and assembled module is shown in figure 3.
Figure 3: Screenshot of PCB layout and assmebled module.
Once the microcontroller is connected to the PC, the python program recognizes the open COM port and activates the GUI buttons as shown in figure 4.
Figure 4: Screenshot of GUI when activated.
Image taken from the camera module are sent to the PC via UART and stored in the PC in .jpg format with the file name representing the class of the image as shown in figure 5.
Figure 5: Screenshot of image being stored and displayed on GUI.
With sufficient images taken, the SVM & PCA classifier can be trained to generate the output of the classifier as shown in figure 6.
Figure 6: Screenshot of the output of the binary classifier.