Project developed during my M.Sc. studies
Computer Vision System for Valve Quality Inspection
Python · OpenCV · Keras · Arduino · Politecnico di Milano · Summer semester 2022/2023
As a course project of my M.Sc. studies at Politecnico di Milano, in the course Advanced Measurement Systems for Control Applications, our team of two built a computer vision system that tells whether a crimped valve is good or loose. The clue is the width of the gap around the slot, seen from above. I led the team and built the image processing and the neural network; Javier Seminario built the illumination setup, the automated photo capture, and the slot location.
An Arduino drove a stepper motor that turned each of six valves through 200 steps, one photo per step, for 1,200 photos; a 3D-printed holder kept each valve at a slight tilt so that one side of the gap shows. Three pixels on the slot define its circle, and arc AC is split into 25 points, each one the center of a small crop. A metal fin sweeps over the slot as the valve turns, and its color changes from valve to valve, so color thresholds alone failed. I tracked the hole in the fin and covered the fin with a rotating patch, so the crops under it are skipped. The 1,200 photos became 12,251 labeled crops.
A small dense network classifies each crop, and a heatmap colors every crop by its probability of being good: red for a loose gap and green for a tight one. As an academic test with sigmoid activations, the same network with the same initial weights was trained with classic perceptrons and with Auto-Rotating Perceptrons (ARP), a neuron introduced in my 2019 paper as first author; under the same initial conditions, ARP gave better results. The model reached 85% test accuracy after 100 epochs.