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
To stop displaying the main frame in detection.py:
-
Find the
cv2.imshow()
function call for the main frame. -
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
-
Check for and adjust any related
cv2.waitKey()
calls. -
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:
- Removed the
hailooverlay
element and subsequent video processing elements. - Removed the
fpsdisplaysink
element, which handled video display. - 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
If I understand what you’re looking for correctly, I have an easier way to prevent the overlay window from displaying. In the hailo_rpi_common.py file look for the line in GStreamerApp init that sets self.video_sink to “xvimagesink” and instead set this to “fakesink”.
# Initialize variables
tappas_post_process_dir = os.environ.get('TAPPAS_POST_PROC_DIR', '')
if tappas_post_process_dir == '':
print("TAPPAS_POST_PROC_DIR environment variable is not set. Please set it to by sourcing setup_env.sh")
exit(1)
self.current_path = os.path.dirname(os.path.abspath(__file__))
self.postprocess_dir = tappas_post_process_dir
self.video_source = self.options_menu.input
self.source_type = get_source_type(self.video_source)
self.user_data = user_data
self.video_sink = "fakesink"
self.pipeline = None
self.loop = None
See here: fakesink
If you are using CoPilot or similar you can run the following prompt on hailo_rpi_common.py to make this an option switchable by a command line argument, say, –hide-overlay.
Add a command line option --hide-overlay that sets the video_sink to xvimagesink if false and fakesink if true. The default is false.
Hope this helps.