My family has eaten the pudding I have saved! Do you have such experience? I want to keep the peace of my home. I made pudding alert.
Pudding distinguishesM5StickV itself recognizes whether a pudding is or is not there. Include a Mobilenet neural network within M5StickV.
The Mobilenet is the neural network structure of the training data that classifies 1000 objects, which is included in the kmodel provided by Sipeed. We can use the calculation result in the middle of the layer of MobileNet.
import KPU as kpu
task = kpu.load(0x200000)
#Output the calculation result in the middle of the layer
layer_index=29
kpu.set_layers(task, layer_index)
Judge whether there is a purine or not by the K neighborhood method. This algorithm was based on Brownie.
Brownie https://www.hackster.io/ksasao/brownie-automate-your-home-with-ai-886e5c
img = sensor.snapshot()
fmap = kpu.forward(task, img)
plist=fmap[:]
for i in range(768):
dist = dist + (plist[i]-first_data[i])**2
if dist < 200:
# Pudding is OK.
else:
# Pudding is not.
Learning the pudding first and then continuing to judge with the same feature vector had one challenge. It will pick up disturbances such as lighting, and the color will change slightly.Even though there is a pudding in front of you, you gradually come to think that it is not a pudding.Therefore, if it can be determined that the pudding is in front of M5StickV, a filtering process that gradually updates the feature vector is added.
#Weighted update filter
if dist < thresh:
for i in range(768):
s_data[i] =w_data*s_data[i]+ (1.0-w_data)*plist[i]
Connect M5Stack and M5StickV
The M5StickV has a camera on the front and an LCD on the back, so it cannot show its face to the culprit when detected by the camera.Also, the display of the M5StickV is a bit small, so it's a bit less powerful to warn the culprit.Therefore, I thought about a configuration that displays a face on M5Stack and issues a warning. M5StickV and M5Stack are connected by Grove port, and M5StickV and M5Stack communicate with each other by UART communication.
Fisheye Lens
The focal length of M5StackV is far. To observe nearby, I put on a fisheye lens.The fisheye lens made it possible to observe closely.
Comments