I am using on raspberry pi 5 and ai kit with hailo basic pipelines and the detection_py. It wokrs very well, it detects all objects.
I would like to lower numbers of objects/labels it detects so the effect should be that camera detect and mark with frames only certain objects
How can I do that? For now I would like to detect objects with label ‘person’, ‘car’ ‘bicycle’. How can I do that?
I have tried to delete or modify the hailofilter and next modify the def app_callback but no results.
My best what I manage to do is to turn off all the labels on camera without crashing the camera
If you just want your code to react to these three object types, simply modify the app_callback function in the detection.py file. You can ignore the visualization.
If you want to detect your own objects you will need to retrain the model, convert it into the HEF format using the Hailo Dataflow Compiler and then modify the example.
You can start here:
Thank you for your reply. I would like to use existing models as it will be fine also it is better for me for learning. I am trying to modify the app_callback but without effect. I tried to put all labeled objects into the list new list then filter through this list without effect. (first trying with only 1 label ‘person’)
My code:
detection_count = 0
labeled_detections = []
for detection in detections:
label = detection.get_label()
bbox = detection.get_bbox()
confidence = detection.get_confidence()
print(f"Drawing bounding box for: {label} with confidence {confidence}")
if label == "person":
string_to_print += f"Detection: {label} {confidence:.2f}\n"
detection_count += 1
labeled_detections.append(detection)
also trying to ignore other labels with
If label == "person"
[...]
else:
continue
Without effect, still have boxes on camera stream labelled on all objects,any tips?
That is why I wrote ignore the visualization. It is independent of the callback code. The code was written so you can start some actions without changing the pipeline e.g. switch on the light if someone enters a room or count people in a room over the course of the day …