Skip to content

Commit bd47f18

Browse files
committed
merged with newest master
1 parent 8db430a commit bd47f18

File tree

3 files changed

+25
-15
lines changed

3 files changed

+25
-15
lines changed

DeepLabStream.py

Lines changed: 2 additions & 2 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, MODEL, MULTI_CAM, STACK_FRAMES, \
20+
from utils.configloader import RESOLUTION, FRAMERATE, OUT_DIR, MODEL_NAME, MULTI_CAM, STACK_FRAMES, \
2121
ANIMALS_NUMBER, STREAMS, STREAMING_SOURCE
2222
from utils.poser import load_deeplabcut, get_pose, find_local_peaks_new, calculate_skeletons,\
2323
get_ma_pose, calculate_ma_skeletons, calculate_skeletons_dlc_live
@@ -763,7 +763,7 @@ def show_benchmark_statistics():
763763

764764
if benchmark_enabled:
765765
import re
766-
short_model = re.split('[-_]', MODEL)
766+
short_model = re.split('[-_]', MODEL_NAME)
767767
short_model = short_model[0] + '_' + short_model[2]
768768
np.savetxt(f'{OUT_DIR}/{short_model}_framerate_{FRAMERATE}_resolution_{RESOLUTION[0]}_{RESOLUTION[1]}.txt', np.transpose([fps_data, whole_loop_time_data]))
769769

utils/configloader.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ def get_script_path():
3030
# DeepLabCut
3131
deeplabcut_config = dict(dsc_config.items('DeepLabCut'))
3232

33+
#poseestimation
34+
MODEL_ORIGIN = dsc_config['Pose Estimation'].get('MODEL_ORIGIN')
35+
MODEL_PATH = dsc_config['Pose Estimation'].get('MODEL_PATH')
36+
MODEL_NAME = dsc_config['Pose Estimation'].get('MODEL_NAME')
37+
ALL_BODYPARTS = tuple(part for part in dsc_config['Pose Estimation'].get('ALL_BODYPARTS').split(','))
38+
39+
40+
41+
3342
# Streaming items
3443
try:
3544
RESOLUTION = tuple(int(part) for part in dsc_config['Streaming'].get('RESOLUTION').split(','))

utils/poser.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,20 @@
2020

2121

2222
# trying importing functions using deeplabcut module, if DLC 2 is installed correctly
23-
try:
24-
import deeplabcut.pose_estimation_tensorflow.nnet.predict as predict
25-
from deeplabcut.pose_estimation_tensorflow.config import load_config
26-
from deeplabcut.pose_estimation_tensorflow.nnet import predict_multianimal
27-
28-
models_folder = 'pose_estimation_tensorflow/models/'
29-
# if not DLC 2 is not installed, try import from DLC 1 the old way
30-
except ImportError:
31-
# adding DLC posing path and loading modules from it
32-
sys.path.insert(0,MODEL_PATH + "/pose-tensorflow")
33-
from config import load_config
34-
from nnet import predict
35-
models_folder = 'pose-tensorflow/models/'
23+
if MODEL_ORIGIN == 'DLC' or MODEL_ORIGIN == 'DLC-LIVE' or MODEL_ORIGIN == 'MADLC':
24+
try:
25+
import deeplabcut.pose_estimation_tensorflow.nnet.predict as predict
26+
from deeplabcut.pose_estimation_tensorflow.config import load_config
27+
from deeplabcut.pose_estimation_tensorflow.nnet import predict_multianimal
28+
29+
models_folder = 'pose_estimation_tensorflow/models/'
30+
# if not DLC 2 is not installed, try import from DLC 1 the old way
31+
except ImportError:
32+
# adding DLC posing path and loading modules from it
33+
sys.path.insert(0,MODEL_PATH + "/pose-tensorflow")
34+
from config import load_config
35+
from nnet import predict
36+
models_folder = 'pose-tensorflow/models/'
3637

3738

3839
def load_deeplabcut():

0 commit comments

Comments
 (0)