FLIR Thermal Camera Person Detection

Discussion related to "under the hood" OpenMV topics.
User avatar
kwagyeman
Posts: 5014
Joined: Sun May 24, 2015 2:10 pm

FLIR Thermal Camera Person Detection

Postby kwagyeman » Fri May 17, 2019 2:18 am

Ibrahim made this example script showing off person detection using the FLIR Thermal camera. Works with any FLIR Lepton.

Code: Select all

import sensor, image, time, os, nn

sensor.reset()                         # Reset and initialize the sensor.
sensor.set_pixformat(sensor.GRAYSCALE)    # Set pixel format to RGB565
sensor.set_framesize(sensor.QQVGA)      # Set frame size to QVGA (320x240)
sensor.set_windowing((32, 64))       # Set 128x128 window.
sensor.skip_frames(time=1000)

net = nn.load('/person.network')

clock = time.clock()                # Create a clock object to track the FPS.
while(True):
    clock.tick()                    # Update the FPS clock.
    img = sensor.snapshot()         # Take a picture and return the image.
    out = net.forward(img, softmax=True)
    if out.index(max(out)) == 0:
        print("person detected")
Save the person.network to your SD card.
Attachments
person.zip
(64.08 KiB) Downloaded 452 times
Nyamekye,
User avatar
RECOVA
Posts: 4
Joined: Tue Jul 21, 2020 8:25 pm
Location: Quito
Contact:

Re: FLIR Thermal Camera Person Detection

Postby RECOVA » Mon Aug 17, 2020 11:44 pm

HELLO
I loaded the code to my openmv cam h7 with a lepton 2.5 sensor and at the time of execution I got the error: OsERROR: this function is unavaible on your open MV cam could you help me please
User avatar
kwagyeman
Posts: 5014
Joined: Sun May 24, 2015 2:10 pm

Re: FLIR Thermal Camera Person Detection

Postby kwagyeman » Tue Aug 18, 2020 1:08 am

We removed the NN module.

Ibrahim, do you have the dataset this model was trained on? It could be quickly moved to TensorFlow with the dataset.
Nyamekye,
User avatar
iabdalkader
Posts: 1327
Joined: Sun May 24, 2015 3:53 pm

Re: FLIR Thermal Camera Person Detection

Postby iabdalkader » Tue Aug 18, 2020 8:00 am

Yes, I think it was this dataset:

http://portal.uc3m.es/portal/page/porta ... redDataset

https://e-archivo.uc3m.es/handle/10016/17370

Note, you need to downsample the 14 bit images to 8 bit before training and testing, and use FLIR module in GS mode.
NoBearSnack
Posts: 33
Joined: Sun Dec 20, 2020 1:59 am

Re: FLIR Thermal Camera Person Detection

Postby NoBearSnack » Sun Dec 20, 2020 2:03 am

Will this work with the Lepton PureThermal2 USB camera plugged into a Rpi? If so, this would be a godsend. I'm trying to create a FLIR sensor that detects bears and blows an airhorn for our yurt off grid in Alaska. Brown bear tore our place to pieces while we were gone and we're hoping to keep that from happening again. I'm going to get to researching this in the morning but many thanks for any help!
NoBearSnack
Posts: 33
Joined: Sun Dec 20, 2020 1:59 am

Re: FLIR Thermal Camera Person Detection

Postby NoBearSnack » Sun Dec 20, 2020 2:10 am

Just saw this video and I can't tell you how excited I am if this will prove a solution. I'll need to train it over time to recognize bears by capturing my own video I imagine (I doubt there is a bear FLIR training set out there, but who knows) and I suppose I can do that by just having it blow the horn anytime it detects something from 80-105F just to be safe. Maybe it will be a moose, but I'll collect the images and train it over time.

Super excited about this!

https://youtu.be/MZ2u_0UB6NI
NoBearSnack
Posts: 33
Joined: Sun Dec 20, 2020 1:59 am

Re: FLIR Thermal Camera Person Detection

Postby NoBearSnack » Sun Dec 20, 2020 1:25 pm

I have the PureThermal2 and I think I can pop the lepton camera off of it, could I then pop that into this adapter?

https://openmv.io/collections/cams/prod ... ter-module
User avatar
kwagyeman
Posts: 5014
Joined: Sun May 24, 2015 2:10 pm

Re: FLIR Thermal Camera Person Detection

Postby kwagyeman » Sun Dec 20, 2020 1:47 pm

Yep, that's fine.
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests