Skip to content

Commit acbfe34

Browse files
committed
fixed some minor issues
1 parent 463d1b7 commit acbfe34

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

utils/plotter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def plot_bodyparts(image, skeletons):
4343
if not any(np.isnan(animal[part])):
4444
plot_dots(res_image, tuple(map(int, animal[part])), colors_list[num])
4545
#plot_dots(res_image, tuple(animal[part]), colors[part])
46+
else:
47+
pass
4648
return res_image
4749

4850

utils/poser.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def handle_missing_bp(animal_skeletons: list):
381381
if HANDLE_MISSING == 'pass':
382382
#do nothing
383383
pass
384-
if HANDLE_MISSING == 'skip':
384+
elif HANDLE_MISSING == 'skip':
385385
#remove the whole skeleton
386386
animal_skeletons.remove(skeleton)
387387
break
@@ -409,7 +409,7 @@ def calculate_skeletons_dlc_live(pose) -> list:
409409
skeletons = [transform_2skeleton(pose)]
410410
return skeletons
411411

412-
def calculate_sleap_skeletons(pose, animals_number)-> list:
412+
def calculate_sleap_skeletons(pose)-> list:
413413
"""
414414
Creating skeleton from sleap output
415415
"""
@@ -429,28 +429,36 @@ def calculate_skeletons(peaks: dict, animals_number: int) -> list:
429429
"""
430430
if MODEL_ORIGIN == 'DLC':
431431
animal_skeletons = calculate_dlstream_skeletons(peaks, animals_number)
432-
if SPLIT_MA:
432+
if animals_number != 1 and SPLIT_MA:
433433
animal_skeletons = split_flat_skeleton(animal_skeletons)
434+
else:
435+
pass
434436

435437
elif MODEL_ORIGIN == 'MADLC':
436438
animal_skeletons = calculate_ma_skeletons(peaks, animals_number)
437439
if FLATTEN_MA:
438440
animal_skeletons = flatten_maDLC_skeletons(animal_skeletons)
441+
else:
442+
pass
439443

440444
elif MODEL_ORIGIN == 'DLC-LIVE' or MODEL_ORIGIN == 'DEEPPOSEKIT':
441445
animal_skeletons = calculate_skeletons_dlc_live(peaks)
442446
if animals_number != 1 and not SPLIT_MA:
443447
raise SkeletonError('Multiple animals are currently not supported by DLC-LIVE.'
444448
' If you are using differently colored animals, please refer to the bodyparts directly (as a flattened skeleton) or use SPLIT_MA in the advanced settings.')
445-
if SPLIT_MA:
449+
elif SPLIT_MA:
446450
animal_skeletons = split_flat_skeleton(animal_skeletons)
451+
else:
452+
pass
447453

448454
elif MODEL_ORIGIN == 'SLEAP':
449-
animal_skeletons = calculate_sleap_skeletons(peaks, animals_number)
455+
animal_skeletons = calculate_sleap_skeletons(peaks)
450456
if FLATTEN_MA:
451457
animal_skeletons = flatten_maDLC_skeletons(animal_skeletons)
452-
elif SPLIT_MA:
458+
elif animals_number != 1 and SPLIT_MA:
453459
animal_skeletons = split_flat_skeleton(animal_skeletons)
460+
else:
461+
pass
454462

455463
animal_skeletons = handle_missing_bp(animal_skeletons)
456464

0 commit comments

Comments
 (0)