I build a lawn mover
useing openmv to find and avoid trees and lamppost Label Round
walls Label TURN
A horizontal “barcode” Label STOP
the code:
from machine import UART
import csi
import time
import ml
camera = csi.CSI()
camera.reset()
camera.pixformat(csi.RGB565)
camera.framesize(csi.QVGA) # QVGA 320x240
uart = UART(1, 19200)
model = ml.Model("trained.tflite", load_to_fb=True)
print(model)
labels = \["ROUND", "STOP", "TURN"\]
clock = time.clock()
while True:
clock.tick()
img = camera.snapshot().gamma_corr(gamma=1, contrast=1.3, brightness=0.3)
scores = model.predict([img])[0].flatten().tolist()
max_score = max(scores)
max_index = scores.index(max_score)
print(f"Prediction: ({labels[max_index]} {max_score:.2f})")
time.sleep(0.5) # Pause 0.5 seconds
I am using Edge Impulse to clasify my objects
It’s work fine but:
When the camera is directed to a blank wal or the screen or any unclasied objects its indicating randow ROUND, STOP TURN.
The score is often 0.7 or more
I want it to indicate only the lable objects
What to do??