1616from scipy .ndimage .measurements import label , maximum_position
1717from scipy .ndimage .morphology import generate_binary_structure , binary_erosion
1818from scipy .ndimage .filters import maximum_filter
19- from utils .configloader import deeplabcut_config , MODEL_ORIGIN
19+ from utils .configloader import MODEL_ORIGIN , MODEL_NAME , MODEL_PATH
2020
21- MODEL = deeplabcut_config ['model' ]
22- DLC_PATH = deeplabcut_config ['dlc_path' ]
2321
2422# trying importing functions using deeplabcut module, if DLC 2 is installed correctly
2523try :
3129# if not DLC 2 is not installed, try import from DLC 1 the old way
3230except ImportError :
3331 # adding DLC posing path and loading modules from it
34- sys .path .insert (0 , DLC_PATH + "/pose-tensorflow" )
32+ sys .path .insert (0 ,MODEL_PATH + "/pose-tensorflow" )
3533 from config import load_config
3634 from nnet import predict
3735 models_folder = 'pose-tensorflow/models/'
@@ -43,7 +41,7 @@ def load_deeplabcut():
4341
4442 :return: tuple of DeepLabCut config, TensorFlow session, inputs and outputs
4543 """
46- model = os .path .join (DLC_PATH , models_folder , MODEL )
44+ model = os .path .join (MODEL_PATH , models_folder , MODEL_NAME )
4745 cfg = load_config (os .path .join (model , 'test/pose_cfg.yaml' ))
4846 snapshots = sorted ([sn .split ('.' )[0 ] for sn in os .listdir (model + '/train/' ) if "index" in sn ])
4947 cfg ['init_weights' ] = model + '/train/' + snapshots [- 1 ]
@@ -237,7 +235,7 @@ def extract_to_animal_skeleton(coords):
237235
238236 return skeletons
239237 animal_skeletons = extract_to_animal_skeleton (pose ['coordinates' ])
240- # animal_skeletons = list(animal_skeletons.values())
238+ animal_skeletons = list (animal_skeletons .values ())
241239
242240 return animal_skeletons
243241
@@ -294,6 +292,6 @@ def calculate_skeletons(peaks: dict, animals_number: int) -> list:
294292 raise ValueError ('Multiple animals are currently not supported by DLC-LIVE.'
295293 ' If you are using differently colored animals, please refere to the bodyparts directly.' )
296294
297-
295+ return animal_skeletons
298296
299297
0 commit comments