1717import pandas as pd
1818import click
1919
20- from utils .configloader import RESOLUTION , FRAMERATE , OUT_DIR , MULTI_CAM , STACK_FRAMES ,\
20+ from utils .configloader import RESOLUTION , FRAMERATE , OUT_DIR , MODEL , MULTI_CAM , STACK_FRAMES , \
2121 ANIMALS_NUMBER , STREAMS , EXP_NUMBER
2222from utils .poser import load_deeplabcut , get_pose , find_local_peaks_new , calculate_skeletons
2323from utils .plotter import plot_bodyparts , plot_metadata_frame
@@ -96,6 +96,7 @@ class DeepLabStream:
9696 """
9797 Class for managing everything stream-related
9898 """
99+
99100 def __init__ (self ):
100101 """
101102 Initializing the DeepLabStream class with some predefined variables
@@ -118,7 +119,7 @@ def __init__(self):
118119 self ._fps = 0
119120 self .greetings ()
120121
121- @ staticmethod
122+ @staticmethod
122123 def set_camera_manager ():
123124 """
124125 Trying to load each present camera manager, if installed
@@ -554,7 +555,7 @@ def get_start_time(self):
554555# testing part
555556@click .command ()
556557@click .option ('--dlc-enabled' , 'dlc_enabled' , is_flag = True )
557- @click .option ('--benchmark-enabled' , 'benchmark_enabled' , is_flag = True )
558+ @click .option ('--benchmark-enabled' , 'benchmark_enabled' , is_flag = True )
558559@click .option ('--recording-enabled' , 'recording_enabled' , is_flag = True )
559560@click .option ('--data-output-enabled' , 'data_output_enabled' , is_flag = True )
560561def start_deeplabstream (dlc_enabled , benchmark_enabled , recording_enabled , data_output_enabled ):
@@ -704,6 +705,12 @@ def show_benchmark_statistics():
704705 elif got_first_analysed_frame :
705706 print ("[{0}/3000] Benchmarking in progress" .format (len (analysis_time_data )))
706707
708+ if benchmark_enabled :
709+ import re
710+ short_model = re .split ('[-_]' , MODEL )
711+ short_model = short_model [0 ] + '_' + short_model [2 ]
712+ np .savetxt (f'{ OUT_DIR } /{ short_model } _framerate_{ FRAMERATE } _resolution_{ RESOLUTION [0 ]} _{ RESOLUTION [1 ]} .txt' , np .transpose ([fps_data , whole_loop_time_data ]))
713+
707714
708715if __name__ == '__main__' :
709716 mp .freeze_support ()
0 commit comments