15 – Nd113 C7 45 L Classification V1

Let’s go back to our notebook and complete our day and night classifier. After we extract this brightness feature, the average value of an image, we want to turn this into a predicted label that classifies any image. We’ve looked at the average brightness of both day and night images, and you should have an idea for what value will separate them into their respective classes. It’s common to create a numerical label. Since we have a binary dataset, meaning there are only two classes of data, I’ll create a label that is 1 for day and 0 for night images. And I can create a complete classifier by writing a function estimate label that takes in an image, extracts the brightness feature, and then checks if the average brightness is above some threshold. So I’ll define my estimate label function, which takes in the RGB image. Then, I’ll extract the average brightness feature from that image using our function average brightness from above. Then, I’ll use the average brightness to predict a label, 0 or 1, for the image. I’ll set the default value of our predicted label to be 0, which is our label for a night image. Next, I’ll define a brightness threshold.

%d 블로거가 이것을 좋아합니다: