Skip to content

Commit 52481c9

Browse files
committed
Updated benchmark to include automatic naming
1 parent 5afa512 commit 52481c9

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

DeepLabStream.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import pandas as pd
1818
import 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
2222
from utils.poser import load_deeplabcut, get_pose, find_local_peaks_new, calculate_skeletons
2323
from 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)
560561
def 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

708715
if __name__ == '__main__':
709716
mp.freeze_support()

utils/configloader.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def get_script_path():
3333
print('Incorrect resolution in config!\n'
3434
'Using default value "RESOLUTION = 848, 480"')
3535
RESOLUTION = (848, 480)
36+
MODEL = dsc_config['Streaming'].get('MODEL')
3637
FRAMERATE = dsc_config['Streaming'].getint('FRAMERATE')
3738
OUT_DIR = dsc_config['Streaming'].get('OUTPUT_DIRECTORY')
3839
STREAM = dsc_config['Streaming'].getboolean('STREAM')

0 commit comments

Comments
 (0)