hailo-detectTo close the application, press Ctrl+C.
This is the full detection example, including object tracker and multiple video resolution support.
hailo-detect --input rpiThere are 2 ways:
Specify the argument --input to usb:
hailo-detect --input usbThis will automatically detect the available USB camera (if multiple are connected, it will use the first detected).
Second way:
Detect the available camera using this script:
get-usb-cameraRun example using USB camera input - Use the device found by the previous script:
hailo-detect --input /dev/video<X>For additional options, execute:
hailo-detect --helpFor examples:
python detection.py --input usbThe application will detect and classify various objects based on the well known "COCO list". The "business logic" happens in Python's app_callback function, and currently the example implementation there is to filter for only detected "Persons":
if label == "person":
...The user_app_callback_class has a dummy implementation, but can be used to communicate and share variables with the pipeline class GStreamerDetectionApp.
The basic idea is to utilize the pipeline's callback function. In simple terms, it can be thought of as a Python function that is invoked at the end of the pipeline when frame processing is complete.
This is the recommended location to implement your logic.
def app_callback(pad, info, user_data):
frame_number = user_data.get_count() # Using the user_data class count frames
buffer = info.get_buffer() # Get the GstBuffer from the probe info
for detection in hailo.get_roi_from_buffer(buffer).get_objects_typed(hailo.HAILO_DETECTION):
label = detection.get_label()
confidence = detection.get_confidence()
track_id = detection.get_objects_typed(hailo.HAILO_UNIQUE_ID)[0].get_id()
return Gst.PadProbeReturn.OKBasic post-processing during the pipeline occurs in the C++ code and can be found in the relevant .so file, e.g. /hailo_cpp_postprocess/cpp/yolo_hailortpp.cpp
The relevant function is the one whose name is specified in self.post_function_name or self.options_menu.pp_function.
This is the location in the C++ code for custom logic modifications.
For more details: Writing postprocess
Based on the specific model and camera capabilities, the resolution can be set using the following GStreamerDetectionApp class members:
self.video_width
self.video_heightSee our hailo_model_zoo for additional supported models.
By default, the package contains a single model depending on the device architecture.
You can download additional models by running hailo-download-resources --all.
The models are downloaded to the resources/models/ directory.
This application supports all models that are compiled with HailoRT NMS post process.
This application includes support for using retrained detection models. For more information, see Using Retrained Models.
--labels-json <path> # Path to custom labels JSON file
--so-path <path> # Path to the shared object file for post-processing
--pp-function <name> # Name of the post-processing function in the shared object file