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

Improved Project Downloading #25

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 24 additions & 30 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
{
"name": "Export to Supervisely format",
"type": "app",
"version": "2.0.0",
"categories": [
"images",
"export"
],
"description": "images and JSON annotations",
"docker_image": "supervisely/import-export:6.73.162",
"instance_version": "6.11.8",
"main_script": "src/main.py",
"modal_template": "src/modal.html",
"modal_template_state": {
"download": "all",
"fixExtension": false
},
"task_location": "workspace_tasks",
"isolate": true,
"headless": true,
"icon": "https://i.imgur.com/1hqGMyg.png",
"icon_background": "#FFFFFF",
"context_menu": {
"target": [
"images_project",
"images_dataset"
],
"context_root": "Download as"
},
"poster": "https://user-images.githubusercontent.com/106374579/186665737-ec3da9cc-193f-43ee-85db-a6f802b2dfe4.png"
}
"name": "Export to Supervisely format",
"type": "app",
"version": "2.0.0",
"categories": ["images", "export"],
"description": "images and JSON annotations",
"docker_image": "supervisely/import-export:6.73.256",
"instance_version": "6.12.12",
"main_script": "src/main.py",
"modal_template": "src/modal.html",
"modal_template_state": {
"download": "all",
"fixExtension": false
},
"task_location": "workspace_tasks",
"isolate": true,
"headless": true,
"icon": "https://i.imgur.com/1hqGMyg.png",
"icon_background": "#FFFFFF",
"context_menu": {
"target": ["images_project", "images_dataset"],
"context_root": "Download as"
},
"poster": "https://user-images.githubusercontent.com/106374579/186665737-ec3da9cc-193f-43ee-85db-a6f802b2dfe4.png"
}
2 changes: 1 addition & 1 deletion dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
supervisely==6.73.162
supervisely==6.73.256
6 changes: 3 additions & 3 deletions local.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
TEAM_ID = 448
WORKSPACE_ID = 690
PROJECT_ID = 35637
TEAM_ID = 84010
WORKSPACE_ID = 98037
PROJECT_ID = 329689
modal.state.download=all
modal.state.fixExtension=true
# DATASET_ID =
5 changes: 3 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
from distutils import util

from supervisely.project.download import download_async_or_sync
import supervisely as sly
from dotenv import load_dotenv
from supervisely.api.module_api import ApiField
Expand Down Expand Up @@ -121,16 +122,16 @@ def download(project: sly.Project) -> str:

sly.logger.info(f"Starting download of project {project.name} to {download_dir}...")

sly.Project.download(
download_async_or_sync(
api,
project_id,
dest_dir=download_dir,
dataset_ids=dataset_ids,
log_progress=True,
batch_size=batch_size,
save_image_meta=True,
save_images=save_images,
)

meta_path = os.path.join(download_dir, "meta.json")
meta = sly.ProjectMeta.from_json(sly.json.load_json_file(meta_path))
if any(obj_cls.geometry_type == sly.Cuboid2d for obj_cls in meta.obj_classes):
Expand Down
Loading