Running machine learning on FLIR Lepton 2.5 module

I would like to run machine learning on the FLIR Lepton 2.5 module. Upon loading the tensor flow lite model, the system hangs. Hope you can help me.

Here is the code, I am using:

# Test
import sensor, image, time, os, ml, uos, gc

thresholds = (200, 255)

sensor.reset()                       # Reset and initialize the sensor.
sensor.set_pixformat(sensor.GRAYSCALE)  # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA)    # Set frame size to QVGA (320x240)
sensor.set_windowing((240, 240))     # Set 240x240 window.
sensor.skip_frames(time=2000)        # Let the camera adjust.

try:
    net = ml.Model("person_detection.tflite", load_to_fb=True)
    print("Loaded model" % (net))
except Exception as e:
    raise Exception(str(e))

try:
    labels = [line.rstrip('\n') for line in open("person_detection.txt")]
except Exception as e:
    raise Exception(str(e))

clock = time.clock()

while True:
    clock.tick()

    img = sensor.snapshot()
    print(clock.fps())

    # Code to process predictions

Hi, you didn’t post the processing part…? You just have a loop capturing images.

Are you saying when you load the person_detection.tflite model the system crashes?

Also, note that model only works on regular cameras, not the flir lepton.

Dear kwagyeman,

Thanks for your quick response. I was installing a test setup to calibrate an overhead passenger counting platform where I extended the connection to the OpenMV Cam H7 Plus with FLIR Lepton module using a USB extender cable. Unfortunately, I may have damage the thermal camera. Have you come across this issue before?

Hoping for your feedback.

Hi, what does hello world do? If that runs fine the camera is fine.

Okay, I will try the hello world program.

Meanwhile, I want to ask if there is a way keep track on the center of the blob and determine if the center is moving from top to bottow or vice-versa?

Yes, use find_blobs(). Then you need to write Python code that interprets the blob detection output and tracks it.

Thanks will try this.

By the way, I just wanted to inform you that the my system detects a virus every time I download the latest OepnMV IDE 4.2.5. Hope you can check this.

Thanks.

Noriel

Hi, OpenMV IDE 4.2.5 on windows is digitally signed with an extended verification digital signature which grants instant windows smart screen acceptance and on mac it passes through their gatekeeper software.

You should not get a virus message unless you are using a third-party tool which ignores this.

1 Like

Can I ask if there is a way to provide a unique ID for each blob?

You need to write object tracking ontop of the detection to get that. This is not provided by our SDK. Per frame, you should collect all the blobs seen, and then try to match them to previously seen blobs. You’ll want to write quite a bit of Python code to do this.