Closed
Description
Bug description
During inference I get the error...
File "/home/csw14/miniconda3/envs/sleap/lib/python3.6/site-packages/tensorflow/python/autograph/impl/api.py", line 339, in _call_unconverted
return f(*args, **kwargs)
File "/home/csw14/miniconda3/envs/sleap/lib/python3.6/site-packages/sleap/nn/paf_grouping.py", line 1046, in group_instances_sample
) = make_predicted_instances(peaks, peak_scores, connections, instance_assignments)
File "/home/csw14/miniconda3/envs/sleap/lib/python3.6/site-packages/sleap/nn/paf_grouping.py", line 903, in make_predicted_instances
assert instance_ind == instance_assignments[dst_peak_id]
AssertionError
[[{{node bottom_up_inference_model_1/bottom_up_inference_layer_1/while_2/body/_211/bottom_up_inference_model_1/bottom_up_inference_layer_1/while_2/EagerPyFunc}}]]
0 successful operations.
0 derived errors ignored. [Op:__inference_predict_function_848670]
Function call stack:
predict_function -> predict_function
A similar error was reported in this issue #357 (comment), but in my case I have a connected tree as the skeleton:
> predictor.bottomup_config.model.heads
HeadsConfig(single_instance=None, centroid=None, centered_instance=None, multi_instance=MultiInstanceConfig(confmaps=MultiInstanceConfmapsHeadConfig(part_names=['tail_tip', 'tail_base', 'centroid', 'left_ear', 'right_ear', 'nose_tip', 'implant'], sigma=2.5, output_stride=4, loss_weight=1.0, offset_refinement=False), pafs=PartAffinityFieldsHeadConfig(edges=[('tail_base', 'tail_tip'), ('centroid', 'tail_base'), ('centroid', 'left_ear'), ('centroid', 'right_ear'), ('centroid', 'nose_tip'), ('centroid', 'implant')], sigma=75.0, output_stride=8, loss_weight=1.0)))
> predictor.bottomup_config.data.labels.skeletons
[Skeleton(name='Skeleton-2', nodes=['tail_tip', 'tail_base', 'centroid', 'left_ear', 'right_ear', 'nose_tip', 'implant'], edges=[('tail_base', 'tail_tip'), ('centroid', 'tail_base'), ('centroid', 'left_ear'), ('centroid', 'right_ear'), ('centroid', 'nose_tip'), ('centroid', 'implant')], symmetries=[])]
I made this model by importing from deeplabcut and defining the hand-defining skeleton...
labels = sleap.Labels.load_file("MY_DLC_CSV_FILE", as_format="deeplabcut")
project_data = yaml.load(open("MY_DLC_CONFIG.yml").read(), Loader=yaml.SafeLoader)
skeleton = labels.skeletons[0]
for a,b in project_data['skeleton']: skeleton.add_edge(a,b)
labels.save("MY_SLEAP_DATASET.pkg.slp", with_images=True)
cfg = sleap.load_config("baseline_large_rf.bottomup.json")
cfg.data.labels.training_labels ="MY_SLEAP_DATASET.pkg.slp"
cfg.data.labels.validation_fraction = 0.05
cfg.optimization.epochs = 500
trainer = sleap.nn.training.Trainer.from_config(cfg)
trainer.train()
Training was fine although it pooped out with the same assertion error when it came time to make the eval figs
Your personal set up
SLEAP: 1.1.5
TensorFlow: 2.3.1
Numpy: 1.18.5
Python: 3.6.15
OS: Linux-3.10.0-1160.45.1.el7.x86_64-x86_64-with-centos-7.9.2009-Core