18. Self-Trained Model - Object Detection

18.1. Python Example

Self-Trained Model - Object Detection
from mpython import *
import smartcamera_k230 as smartcamera

smart_camera = smartcamera.SmartCameraK230(tx=Pin.P1, rx=Pin.P0)

smart_camera.detect_kmodel_init('/data/detect.kmodel', 3)

import time
while True:
    smart_camera.detect_kmodel.recognize()
    _id = smart_camera.detect_kmodel.id
    if _id != None:
        _score = smart_camera.detect_kmodel.score
        if _score >= 0.6:
            print(str('Class id: ') + str(_id))
            print(str('Confidence: ') + str(_score))
        else:
            print('Unknown class')
    time.sleep(0.01)

18.2. Detection Model - Traffic Sign Recognition

It can recognize left-turn, right-turn, and stop traffic signs.

18.3. mPython Graphical Example

../../../../_images/object_detection.png