diff --git a/config.json b/config.json index 3dd30d4..6e65dc1 100644 --- a/config.json +++ b/config.json @@ -21,7 +21,8 @@ "headless": true, "context_menu": { "target": [ - "images_project" + "images_project", + "images_dataset" ], "context_root": "Download as" }, diff --git a/src/globals.py b/src/globals.py index 40b6103..f01f463 100644 --- a/src/globals.py +++ b/src/globals.py @@ -20,6 +20,7 @@ team_id = sly.env.team_id() workspace_id = sly.env.workspace_id() project_id = sly.env.project_id() +dataset_id = sly.env.dataset_id(raise_not_found=False) PASCAL_CONTOUR_THICKNESS = int(os.environ["modal.state.pascalContourThickness"]) TRAIN_VAL_SPLIT_COEF = float(os.environ["modal.state.trainSplitCoef"]) diff --git a/src/main.py b/src/main.py index d4d0e04..32d8640 100644 --- a/src/main.py +++ b/src/main.py @@ -39,7 +39,11 @@ def from_sly_to_pascal(api: sly.Api): images_stats = [] classes_colors = {} - datasets = api.dataset.get_list(g.project_id, recursive=True) + if g.dataset_id is None: + datasets = api.dataset.get_list(g.project_id, recursive=True) + else: + datasets = [api.dataset.get_info_by_id(g.dataset_id)] + dataset_names = ["trainval", "val", "train"] progress = sly.Progress( "Preparing images for export", api.project.get_images_count(g.project_id), sly.logger