Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export interpolate key frames in video label not working #422

Open
yuhang4mayo opened this issue Feb 26, 2025 · 0 comments
Open

Export interpolate key frames in video label not working #422

yuhang4mayo opened this issue Feb 26, 2025 · 0 comments

Comments

@yuhang4mayo
Copy link

yuhang4mayo commented Feb 26, 2025

I was trying to export the interpolated key frames using Label Studio SDK api and followed the code given on this page. link: https://labelstud.io/templates/video_object_detector

This link's code did not work, I think it might be due to update of label studio and the blog is outdated. However, I modified the code and now it works.

I will post the code I use here:

from label_studio_sdk import Client
import time
# Connect to Label Studio
ls = Client(url='http://localhost:8080', api_key='YOUR_API_KEY')
# Get your project by ID
project = ls.get_project(PROJECT_ID)
# Create an export snapshot with interpolation enabled
export_result = project.export_snapshot_create(
    title='Export with Interpolated Keyframes',
    
interpolate_key_frames = True

)
# Get the export ID
export_id = export_result['id']
# Wait for the export to complete
while True:
    export_status = project.export_snapshot_status(export_id)
    if export_status.is_completed():

        break
    elif export_status.is_failed():
        raise Exception('Export failed')
    else:
        time.sleep(5)  # Wait for 5 seconds before checking again
# Download the export
export_file_path = project.export_snapshot_download(
    export_id, export_type='JSON', path='.'
)
print(f'Exported data saved to {export_file_path}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant