Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to retrieve detected object ID - Hailo8 + RPI5 #75

Open
MECHAAMER opened this issue Dec 24, 2024 · 0 comments
Open

Unable to retrieve detected object ID - Hailo8 + RPI5 #75

MECHAAMER opened this issue Dec 24, 2024 · 0 comments

Comments

@MECHAAMER
Copy link

MECHAAMER commented Dec 24, 2024

Hello everyone,

I'm working on a project using a Yolov8l model on a Raspberry Pi5 with the Hailo 8 coprocessor. I successfully trained and tested the model on my PC, and I can retrieve the detected object ID using the following code:

model = YOLO("yolo8l.pt")
model.predict(frame)
track_ids = results[0].boxes.id.int().cpu().tolist()

I then converted the model to the .hef format following the instructions provided in hailo-rpi5-examples. While I can successfully perform inference on the converted model, I'm unable to retrieve the object ID. I can access the detected object label, but there seems to be no clear way to get the ID.

I tried:

roi = hailo.get_roi_from_buffer(buffer)
hailo_detections = roi.get_objects_typed(hailo.HAILO_DETECTION)
    
n = len(hailo_detections)
boxes = np.zeros((n, 4))
confidence = np.zeros(n)
class_id = np.zeros(n)
tracker_id = np.empty(n)

for i, detection in enumerate(hailo_detections):
	if 1 :#detection.get_label() == "person":  # Only track "person" objects
		class_id[i] = detection.get_class_id()
		confidence[i] = detection.get_confidence()
		unique_ids = detection.get_objects_typed(hailo.HAILO_UNIQUE_ID)
            
		tracker_id[i] = unique_ids[0].get_id() if unique_ids else -1  # Use -1 if no unique ID is found

but the unique_ids returns empty list always

I've searched for solutions online but haven't found anything definitive. Can anyone provide some guidance on how to access the object ID after conversion to the .hef model?

Expected Behavior:

I expect the code to return a list containing the IDs of the detected objects, similar to the output on my PC.

Any help would be greatly appreciated!

Hardware: RPI5 + Hailo8
Model: Yolov8l

@MECHAAMER MECHAAMER changed the title Unable to retrieve object ID for Hailo RPI5 Unable to retrieve detected object ID - Hailo8 + RPI5 Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant