Closed Lateef-Saheed closed 7 months ago
Hi @Lateef-Saheed,
I am glad you are using GPT. The provided answer is the way you would read in a SLEAP dataset - given it is stored in an .slp
file. But, it seems you are trying to read an .analysis.h5
file which is just a normal .h5
file that SLEAP exports all the pose data to after a project is "finished" (after the poses have been estimated using SLEAP).
You can use many different programs to read in an .h5
file, but we have an example notebook written in python to help get you acquainted.
Thanks, LIezl
Hello! I was attempting to generate a prediction-labeled video using SLEAP v.1.3.3. First I used the information found at "https://sleap.ai/develop/api/sleap.io.dataset.html#sleap.io.dataset.Labels" and found this syntax:
sleap.io.visuals.save_labeled_video(filename: str, labels: sleap.io.dataset.Labels, video: sleap.io.video.Video, frames: List[int], fps: int = 15, scale: float = 1.0, crop_size_xy: Optional[Tuple[int, int]] = None, show_edges: bool = True, edge_is_wedge: bool = False, marker_size: int = 4, color_manager: Optional[sleap.gui.color.ColorManager] = None, palette: str = 'standard', distinctly_color: str = 'instances', gui_progress: bool = False)
Me and the other labmate involved in the project arent that well-versed in python, so we ran into some difficulties. We asked Chat GPT how to call the class sleap.io.dataset.Labels:
import sleap from sleap.io.dataset import Labels dataset_path = "path_to_your_dataset.h5" dataset = sleap.load_file(dataset_path) labels = dataset.labels
After submitting the line: Dataset = sleap.load_file(dataset_path) we received this error message:
We again asked chat GPT about the issue and it gave us this alternative code:
import sleap dataset_path = "path_to_your_dataset.h5" try: dataset = sleap.load_file(dataset_path) labels = dataset.labels except Exception as e: print("Error loading dataset file:", e)
And again we received an error message in return. Could anyone possibly help us out with the code we used, or suggest a more efficient way of exporting labeled videos? Thanks for the help!