detect glasses with machine learning
Built a convolutional neural network to predict whether I was wearing glasses or not. Using OpenCV I used the webcam to take 50,000 images of myself, half with glasses and half without. Then I resized the images from the webcam's native resolution to size 32x32x3. Before feeding them into the network, I normalized the images so instead of the values ranging from 0 to 255, they now range from 0 to 1. To test the model, I created a video where I am wearing glasses and fed individual frames to the network. If the model outputs a value close to 1, it predicts I'm wearing glasses. Depending on the output value, a different text string is written using OpenCV's puttext function.