You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently getting the "ValueError: Labels.skeleton can only be used when there is only a single skeleton saved in the labels" error when trying to combine multiple datasets, as described in a similar post here: #1101.
While the attached fix outlined by @catubc looks promising, I'm sure how to implement the code in the SLEAP environment currently set up. I'm wondering how the function definitions outlined in the post above are implemented through the command line/script call?
Apologies for the simplicity of the question; this is the first time I've tried to work directly with SLEAP's API like this! Thank you for your help!
defmerge_slp_files(fname_slp1, fname_slp2):
#fname_hybrid_video=fname_slp1[:-4]+"_merged.avi"#merged_video=sleap.load_video(fname_hybrid_video)
print(merged_video)
#fname_hybrid_slp=fname_hybrid_video[:-4] +".slp"#slp_files= [fname_slp1,
fname_slp2
]
n_frames=0all_frames= []
reference_tracks= {}
first_labels=Noneforslp_fileinslp_files:
# Load saved labels.labels=sleap.load_file(slp_file)#, match_to=first_labels)iffirst_labelsisNone:
first_labels=labelsnew_frames= []
fori, lfinenumerate(labels):
# Update reference to merged video.lf.video=merged_video# Update frame index to the frame number within the merged video.lf.frame_idx=n_frames+i# # Update the track reference to use the reference tracks to prevent duplication.forinstanceinlf:
ifinstance.trackisnotNone:
ifinstance.track.nameinreference_tracks:
instance.track=reference_tracks[instance.track.name]
else:
reference_tracks[instance.track.name] =instance.track# Append the labeled frame to the list of frames we're keeping from these labels.new_frames.append(lf)
all_frames.extend(new_frames)
n_frames+=len(new_frames)
merged_labels=sleap.Labels(all_frames)
# save stuffmerged_labels.save(fname_hybrid_slp)
print("DONE...")
# merge_slp_files(fname_human_slp,
fname_idswitch_slp)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I'm currently getting the "ValueError: Labels.skeleton can only be used when there is only a single skeleton saved in the labels" error when trying to combine multiple datasets, as described in a similar post here: #1101.
While the attached fix outlined by @catubc looks promising, I'm sure how to implement the code in the SLEAP environment currently set up. I'm wondering how the function definitions outlined in the post above are implemented through the command line/script call?
Apologies for the simplicity of the question; this is the first time I've tried to work directly with SLEAP's API like this! Thank you for your help!
Originally posted by @catubc in #1101 (comment)
Beta Was this translation helpful? Give feedback.
All reactions