Object ID is always zero in Huskylens object recognition mode

userHead PIERRE.GAUTHIER 2025-06-09 11:45:40 251 Views1 Replies

I have a problem detecting an object with Huskylens in object recognition mode.

I want to detect if the object is a ‘person’. It is one of the standard objects Huskylens

can detect.

 

My Huskylens firmware version is 0.5.1aNorm.

 

I use a Raspbery Pico 2W connected to the Huskylens via I2C.

Communication with the Huskylens is fine, no error message.

 

I use the huskylensPythonLibrary.

 

Here's some sample code I use:

 

husky = HuskyLensLibrary("I2C")  
husky.command_request_knock() 
husky.object_recognition_mode()
 
for i in range(1000):
   result = husky.command_request()
   print("======================================")
   for res in result:
       print(res)
   time.sleep(1)

 

This is the output when no object is detected:

 

======================================
before finalData,  ['55aa', '11', 10, '29', '00000100442400000000', 'ac']
numberOfBlocksOrArrow= 0
numberOfIDLearned= 1
frameNumber= 9284

 

 

Output when a “person” object is detected:


======================================
before finalData,  ['55aa', '11', 10, '29', '01000100742400000000', 'dd']
numberOfBlocksOrArrow= 1
numberOfIDLearned= 1
frameNumber= 9332
commandSplit 2=  ['55aa', '11', 10, '2a', '0501bd004f0058000000', 'ae']
<class 'list'>
55aa
11
10
2a
0501bd004f0058000000
ae
<class 'list'>
[261, 189, 79, 88, 0]

 

 

I believe the last line [261, 189, 79, 88, 0] is the X,Y, width,height, object ID   data

but the object ID is always zero. I can see on the Huskylens display that it can detect

a person, a cat etc but the id is always zero.

 

Is this a bug or is there something I'm not doing right? I saw some other people having the

same issue. There must be a way to determine the type of object recognized by Huskylens

in object recognition mode.

 

Thanks for your support.

 

Pierre

 

 

 

 

 

 

 

2025-06-10 03:40:05

Sorry, I have finally solved my problem.

 

By the way, I use the Raspberry Pico micropython library (with an example) from this link:

 

https://community.dfrobot.com/makelog-311712.html

 

 

I needed to put the Huskylens in learn mode first. So I trained it with the code

below. I thought that because the Huskylens recognizes some objects by default (ex. person, cat etc)

I didn't need to train it first.

 

#train Huskylens to recognize a person, set ID to 1.

#In this case I train Huskylens to assign ID 1 to a person

husky = HuskyLensLibrary("I2C") 

print("object recognition command")

husky.object_recognition_mode()

for i in range(1000):

    #set ID to 1

    husky.command_request_learn_once(1)

    time.sleep(1)

 

After learning, I ran the normal code:

 

husky = HuskyLensLibrary("I2C") 

print("knock command")

husky.command_request_knock()

print("object recognition command")

husky.object_recognition_mode()

print("request command")

for i in range(1000):

    result = husky.command_request()

    print("======================================")

    for res in result:

        print(res)

    time.sleep(1)


 

and I can now see the ID1 I expected along with the X,Y, width,size:


 

<class 'list'>

[110, 158, 55, 144, 1]


I also verified that it can detect multiple persons, so I will get multiple [X,Y,width, height,ID] in the command response.

userHeadPic PIERRE.GAUTHIER