@@ -118,6 +118,12 @@ def __init__(self):
118118
119119 @ staticmethod
120120 def set_camera_manager ():
121+ """
122+ Trying to load each present camera manager, if installed
123+ Then checking for connected cameras and choosing the one with at least some cameras connected
124+ ! Camera managers cannot be mixed
125+ :return: the chosen camera manager
126+ """
121127 manager_list = []
122128 # loading realsense manager, if installed
123129 realsense = find_spec ("pyrealsense2" ) is not None
@@ -340,13 +346,14 @@ def get_analysed_frames(self) -> tuple:
340346 if self ._multiprocessing [camera ]['output' ].full ():
341347 if self ._start_time is None :
342348 self ._start_time = time .time () # getting the first frame here
349+
343350 # Getting the analysed data
344351 analysed_index , peaks = self ._multiprocessing [camera ]['output' ].get ()
345352 skeletons = calculate_skeletons (peaks , ANIMALS_NUMBER )
346353 print ('' , end = '\r ' , flush = True ) # this is the line you should not remove
347-
348354 analysed_frame , depth_map , input_time = self .get_stored_frames (camera )
349355 analysis_time = time .time () - input_time
356+
350357 # Calculating FPS and plotting the data on frame
351358 self .calculate_fps (analysis_time if analysis_time != 0 else 0.01 )
352359 frame_time = time .time () - self ._start_time
@@ -535,20 +542,6 @@ def get_start_time(self):
535542 return self ._start_time
536543
537544
538- def describe_dataset (dataset , name ):
539- """
540- Function to describe any given dataset and print out the results
541- """
542- average = np .average (dataset )
543- print ("Average {0} time {1:6.5f}" .format (name , average ))
544- maximum = np .max (dataset )
545- print ("Maximum {0} time {1:6.5f}" .format (name , maximum ))
546- minimum = np .min (dataset )
547- print ("Minimum {0} time {1:6.5f}" .format (name , minimum ))
548- standart_deviation = np .std (dataset )
549- print ("Standard deviation {0} time {1:6.5f}" .format (name , standart_deviation ))
550-
551-
552545# testing part
553546@click .command ()
554547@click .option ('--dlc-enabled' , 'dlc_enabled' , is_flag = True )
@@ -598,7 +591,23 @@ def start_deeplabstream(dlc_enabled, benchmark_enabled, recording_enabled, data_
598591 whole_loop_time_data = []
599592 tracking_accuracy_counter = 0
600593
594+ def describe_dataset (dataset , name ):
595+ """
596+ Function to describe dataset and print out the results
597+ """
598+ average = np .average (dataset )
599+ print ("Average {0} time {1:6.5f}" .format (name , average ))
600+ maximum = np .max (dataset )
601+ print ("Maximum {0} time {1:6.5f}" .format (name , maximum ))
602+ minimum = np .min (dataset )
603+ print ("Minimum {0} time {1:6.5f}" .format (name , minimum ))
604+ standart_deviation = np .std (dataset )
605+ print ("Standard deviation {0} time {1:6.5f}" .format (name , standart_deviation ))
606+
601607 def show_benchmark_statistics ():
608+ """
609+ Outputting all stream benchmark statistics
610+ """
602611 analysis_full_time = time .time () - start_time
603612 print ("Full analysis time {0:4.2f}" .format (analysis_full_time ))
604613 ##################################################################
@@ -634,12 +643,15 @@ def show_benchmark_statistics():
634643 # inputting the frames
635644 stream_manager .input_frames_for_analysis (all_frames , stream_manager .frame_index )
636645
646+ ###########################################################
647+ # Benchmarking part
637648 if res_time is not None :
638649 if benchmark_enabled and got_first_analysed_frame :
639650 analysis_time_data .append (res_time )
640651 else :
641652 if benchmark_enabled and got_first_analysed_frame :
642653 tracking_accuracy_counter += 1
654+
643655 ###########################################################
644656 # streaming the stream
645657 if res_frames :
0 commit comments