Skip to content

create SLP project from scratch using python #1534

Answered by roomrys
mmmahdiii asked this question in Help!
Discussion options

You must be logged in to vote

Hi @mmmahdiii,

When creating a Labels object, create it from the inside out by creating object that are referenced by other objects first:

import sleap
from sleap import Labels, Video, LabeledFrame, Instance, Skeleton
from sleap.instance import Point
from sleap.skeleton import Node

# Create a video object
video_path = r"path/to/video.mp4"
video = Video.from_filename(video_path)

# Create a skeleton
nodes = ["head", "tail"]
skeleton = Skeleton(name="my_skeleton")
skeleton.add_nodes(nodes)
skeleton.add_edge("head", "tail")

# Initialize a list of labeled frames
lfs = []

# 0. Create a list of instances for this labeled frame
instances = []

# 1. Create an instance and append to list of ins…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@isabellow
Comment options

@talmo
Comment options

@isabellow
Comment options

Answer selected by mmmahdiii
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help!
Labels
None yet
4 participants