Exporting predicted xy locations without tracking? #1873
-
Hello, I may be an edge case here, but I would like to export the predicted x y coordinates of instances without tracking them across frames. I am using SLEAP to infer the positions of bees walking through the hive entrance - some video frames can have hundreds of bees. My skeleton for a bee instance consists of a single node (thorax) and no edges. The training is going well; it is able to identify most of the bees in each frame. For now, I am not interested in tracking individual bees across frames, I just want the predicted xy locations of each instance in each frame. I can do this in the "Run inference" menu by selecting "none" for the "Tracker Method" field, and I get predicted instances for each frame just fine. However, when I go to export these predictions as hdf5 and look at the data structure in python (jupyter notebooks), it seems to have exported only 1 instance per frame, which appears to be the average x and y for all instance positions. When I do select a tracking method during inference, I get the full data structure with individual xy coordinates. the problem is that the program takes a VERY long time to run tracking and I often run out of memory because there can be several hundred bee instances in each frame it is trying to solve. Is there a way to simply export the individual predicted xy locations without trying to track them? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @petermarting, Sure thing -- what format were you looking to export the individual instances to? Using import sleap_io as sio
labels = sio.load_file("labels.v001.slp")
all_instances = []
for lf in labels:
video_ind = labels.videos.index(lf.video)
for inst in lf:
all_instances.append({"video": video_ind, "frame": lf.frame_idx, "points": inst.numpy()}) The Cheers, Talmo |
Beta Was this translation helpful? Give feedback.
Hi @petermarting,
Sure thing -- what format were you looking to export the individual instances to?
Using
sleap-io
, our standalone package for working with SLEAP data is the easiest route here, but basically you can do something like:The
all_instances
variable will be a list of dictionaries with your data which you can then convert or save out however you want. Just let us know what you're looking for and we can help you ada…