How can i stop displaying the main frame in detection.py in hailo-rpi5-examples

hi how can i stop displaying the main frame in detection.py in hailo-rpi5-examples

@omria can you suggest me how to solve it

Hey @vinaygouda.ttssl

To stop displaying the main frame in detection.py:

  1. Find the cv2.imshow() function call for the main frame.

  2. Choose one of these methods to disable it:
    a. Comment out the line with #
    b. Use a control variable:

    DISPLAY_MAIN_FRAME = False
    if DISPLAY_MAIN_FRAME:
        cv2.imshow("Main Frame", frame)
    

    c. Delete the line if you’ll never need it

  3. Check for and adjust any related cv2.waitKey() calls.

  4. Keep any important frame processing code intact.

i think there is no such lines in the detections.py file or in hailo_rpi_common.py i think it not displayed using cv2.imshow() so can any one tell me how to stop displying frame

@omria i have checked it but i didnt get and so how can i stop displaying it

any other idea on this

@Omer @omria if i do more anlytics on raspberry-hailo-AI kit using hailo-rpi5-examples it slowing down the frame rate so any one can tell me if i do multiprocessing is it work if yes how can i integrate in this

Then you can try to do it by modifying the pipeline by updating the get_pipeline_string method as follows:

def get_pipeline_string(self):
    # ... (keep the existing source_element code)

    pipeline_string = (
        "hailomuxer name=hmux "
        + source_element
        + "tee name=t ! "
        + QUEUE("bypass_queue", max_size_buffers=20)
        + "hmux.sink_0 "
        + "t. ! "
        + QUEUE("queue_hailonet")
        + "videoconvert n-threads=3 ! "
        f"hailonet hef-path={self.hef_path} batch-size={self.batch_size} {self.thresholds_str} force-writable=true ! "
        + QUEUE("queue_hailofilter")
        + f"hailofilter so-path={self.default_postprocess_so} {self.labels_config} qos=false ! "
        + QUEUE("queue_hmuc")
        + "hmux.sink_1 "
        + "hmux. ! "
        + QUEUE("queue_hailo_python")
        + QUEUE("queue_user_callback")
        + "identity name=identity_callback ! "
        + "fakesink sync=false"
    )
    print(pipeline_string)
    return pipeline_string

Key changes made to remove the main frame display:

  1. Removed the hailooverlay element and subsequent video processing elements.
  2. Removed the fpsdisplaysink element, which handled video display.
  3. Added a fakesink element at the end to consume the data without displaying it.

@omria how can i do the multtiproccessing in detection.py in hailo-rpi5-examples to maintain constant speed and frame rate

Do you have working code example to share? Thank you