lightly-studio 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of lightly-studio might be problematic. Click here for more details.
- lightly_studio-0.3.1/.gitignore +18 -0
- lightly_studio-0.3.1/PKG-INFO +520 -0
- lightly_studio-0.3.1/USAGE.md +487 -0
- lightly_studio-0.3.1/pyproject.toml +100 -0
- lightly_studio-0.3.1/src/lightly_studio/__init__.py +11 -0
- lightly_studio-0.3.1/src/lightly_studio/api/__init__.py +0 -0
- lightly_studio-0.3.1/src/lightly_studio/api/app.py +110 -0
- lightly_studio-0.3.1/src/lightly_studio/api/cache.py +77 -0
- lightly_studio-0.3.1/src/lightly_studio/api/db.py +133 -0
- lightly_studio-0.3.1/src/lightly_studio/api/db_tables.py +32 -0
- lightly_studio-0.3.1/src/lightly_studio/api/features.py +7 -0
- lightly_studio-0.3.1/src/lightly_studio/api/routes/api/annotation.py +233 -0
- lightly_studio-0.3.1/src/lightly_studio/api/routes/api/annotation_label.py +90 -0
- lightly_studio-0.3.1/src/lightly_studio/api/routes/api/annotation_task.py +38 -0
- lightly_studio-0.3.1/src/lightly_studio/api/routes/api/classifier.py +387 -0
- lightly_studio-0.3.1/src/lightly_studio/api/routes/api/dataset.py +182 -0
- lightly_studio-0.3.1/src/lightly_studio/api/routes/api/dataset_tag.py +257 -0
- lightly_studio-0.3.1/src/lightly_studio/api/routes/api/exceptions.py +96 -0
- lightly_studio-0.3.1/src/lightly_studio/api/routes/api/features.py +17 -0
- lightly_studio-0.3.1/src/lightly_studio/api/routes/api/metadata.py +37 -0
- lightly_studio-0.3.1/src/lightly_studio/api/routes/api/metrics.py +80 -0
- lightly_studio-0.3.1/src/lightly_studio/api/routes/api/sample.py +196 -0
- lightly_studio-0.3.1/src/lightly_studio/api/routes/api/settings.py +45 -0
- lightly_studio-0.3.1/src/lightly_studio/api/routes/api/status.py +19 -0
- lightly_studio-0.3.1/src/lightly_studio/api/routes/api/text_embedding.py +48 -0
- lightly_studio-0.3.1/src/lightly_studio/api/routes/api/validators.py +17 -0
- lightly_studio-0.3.1/src/lightly_studio/api/routes/healthz.py +13 -0
- lightly_studio-0.3.1/src/lightly_studio/api/routes/images.py +104 -0
- lightly_studio-0.3.1/src/lightly_studio/api/routes/webapp.py +51 -0
- lightly_studio-0.3.1/src/lightly_studio/api/server.py +82 -0
- lightly_studio-0.3.1/src/lightly_studio/core/__init__.py +0 -0
- lightly_studio-0.3.1/src/lightly_studio/core/dataset.py +523 -0
- lightly_studio-0.3.1/src/lightly_studio/core/sample.py +77 -0
- lightly_studio-0.3.1/src/lightly_studio/core/start_gui.py +15 -0
- lightly_studio-0.3.1/src/lightly_studio/dataset/__init__.py +0 -0
- lightly_studio-0.3.1/src/lightly_studio/dataset/edge_embedding_generator.py +144 -0
- lightly_studio-0.3.1/src/lightly_studio/dataset/embedding_generator.py +91 -0
- lightly_studio-0.3.1/src/lightly_studio/dataset/embedding_manager.py +163 -0
- lightly_studio-0.3.1/src/lightly_studio/dataset/env.py +16 -0
- lightly_studio-0.3.1/src/lightly_studio/dataset/file_utils.py +35 -0
- lightly_studio-0.3.1/src/lightly_studio/dataset/loader.py +622 -0
- lightly_studio-0.3.1/src/lightly_studio/dataset/mobileclip_embedding_generator.py +144 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/env.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/0.DenzbfeK.css +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/LightlyLogo.BNjCIww-.png +0 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/OpenSans-Bold.DGvYQtcs.ttf +0 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/OpenSans-Italic-VariableFont_wdth_wght.B4AZ-wl6.ttf +0 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/OpenSans-Medium.DVUZMR_6.ttf +0 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/OpenSans-Regular.DxJTClRG.ttf +0 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/OpenSans-SemiBold.D3TTYgdB.ttf +0 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/OpenSans-VariableFont_wdth_wght.BZBpG5Iz.ttf +0 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/SelectableSvgGroup.OwPEPQZu.css +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/SelectableSvgGroup.b653GmVf.css +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/_layout.T-zjSUd3.css +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/useFeatureFlags.CV-KWLNP.css +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/69_IOA4Y.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/B2FVR0s0.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/B90CZVMX.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/B9zumHo5.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/BJXwVxaE.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/Bsi3UGy5.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/Bu7uvVrG.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/Bx1xMsFy.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/BylOuP6i.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/C8I8rFJQ.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CDnpyLsT.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CWj6FrbW.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CYgJF_JY.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CcaPhhk3.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CvOmgdoc.js +93 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CxtLVaYz.js +3 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/D5-A_Ffd.js +4 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/D6RI2Zrd.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/D6su9Aln.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/D98V7j6A.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DIRAtgl0.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DIeogL5L.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DOlTMNyt.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DjUWrjOv.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DjfY96ND.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/H7C68rOM.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/O-EABkf9.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/XO7A28GO.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/hQVEETDE.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/l7KrR96u.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/nAHhluT7.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/r64xT6ao.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/vC4nQVEB.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/x9G_hzyY.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/entry/app.CjnvpsmS.js +2 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/entry/start.0o1H7wM9.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/0.XRq_TUwu.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/1.B4rNYwVp.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/10.DfBwOEhN.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/11.CWG1ehzT.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/12.CwF2_8mP.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/2.CS4muRY-.js +6 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/3.CWHpKonm.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/4.OUWOLQeV.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/5.Dm6t9F5W.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/6.Bw5ck4gK.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/7.CF0EDTR6.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/8.Cw30LEcV.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/9.CPu3CiBc.js +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/_app/version.json +1 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/apple-touch-icon-precomposed.png +0 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/apple-touch-icon.png +0 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/favicon.png +0 -0
- lightly_studio-0.3.1/src/lightly_studio/dist_lightly_studio_view_app/index.html +44 -0
- lightly_studio-0.3.1/src/lightly_studio/examples/example.py +23 -0
- lightly_studio-0.3.1/src/lightly_studio/examples/example_metadata.py +338 -0
- lightly_studio-0.3.1/src/lightly_studio/examples/example_selection.py +39 -0
- lightly_studio-0.3.1/src/lightly_studio/examples/example_split_work.py +67 -0
- lightly_studio-0.3.1/src/lightly_studio/examples/example_v2.py +21 -0
- lightly_studio-0.3.1/src/lightly_studio/export_schema.py +18 -0
- lightly_studio-0.3.1/src/lightly_studio/few_shot_classifier/__init__.py +0 -0
- lightly_studio-0.3.1/src/lightly_studio/few_shot_classifier/classifier.py +80 -0
- lightly_studio-0.3.1/src/lightly_studio/few_shot_classifier/classifier_manager.py +663 -0
- lightly_studio-0.3.1/src/lightly_studio/few_shot_classifier/random_forest_classifier.py +489 -0
- lightly_studio-0.3.1/src/lightly_studio/metadata/complex_metadata.py +47 -0
- lightly_studio-0.3.1/src/lightly_studio/metadata/gps_coordinate.py +41 -0
- lightly_studio-0.3.1/src/lightly_studio/metadata/metadata_protocol.py +17 -0
- lightly_studio-0.3.1/src/lightly_studio/metrics/__init__.py +0 -0
- lightly_studio-0.3.1/src/lightly_studio/metrics/detection/__init__.py +0 -0
- lightly_studio-0.3.1/src/lightly_studio/metrics/detection/map.py +268 -0
- lightly_studio-0.3.1/src/lightly_studio/models/__init__.py +1 -0
- lightly_studio-0.3.1/src/lightly_studio/models/annotation/__init__.py +0 -0
- lightly_studio-0.3.1/src/lightly_studio/models/annotation/annotation_base.py +171 -0
- lightly_studio-0.3.1/src/lightly_studio/models/annotation/instance_segmentation.py +56 -0
- lightly_studio-0.3.1/src/lightly_studio/models/annotation/links.py +17 -0
- lightly_studio-0.3.1/src/lightly_studio/models/annotation/object_detection.py +47 -0
- lightly_studio-0.3.1/src/lightly_studio/models/annotation/semantic_segmentation.py +44 -0
- lightly_studio-0.3.1/src/lightly_studio/models/annotation_label.py +47 -0
- lightly_studio-0.3.1/src/lightly_studio/models/annotation_task.py +28 -0
- lightly_studio-0.3.1/src/lightly_studio/models/classifier.py +20 -0
- lightly_studio-0.3.1/src/lightly_studio/models/dataset.py +84 -0
- lightly_studio-0.3.1/src/lightly_studio/models/embedding_model.py +30 -0
- lightly_studio-0.3.1/src/lightly_studio/models/metadata.py +208 -0
- lightly_studio-0.3.1/src/lightly_studio/models/sample.py +180 -0
- lightly_studio-0.3.1/src/lightly_studio/models/sample_embedding.py +37 -0
- lightly_studio-0.3.1/src/lightly_studio/models/settings.py +60 -0
- lightly_studio-0.3.1/src/lightly_studio/models/tag.py +96 -0
- lightly_studio-0.3.1/src/lightly_studio/py.typed +0 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/__init__.py +7 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_label_resolver/__init__.py +21 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_label_resolver/create.py +27 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_label_resolver/delete.py +28 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_label_resolver/get_all.py +22 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_label_resolver/get_by_id.py +24 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_label_resolver/get_by_ids.py +25 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_label_resolver/get_by_label_name.py +24 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_label_resolver/names_by_ids.py +25 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_label_resolver/update.py +38 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_resolver/__init__.py +33 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_resolver/count_annotations_by_dataset.py +120 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_resolver/create.py +19 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_resolver/create_many.py +96 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_resolver/delete_annotation.py +45 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_resolver/delete_annotations.py +56 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_resolver/get_all.py +74 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_resolver/get_by_id.py +18 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_resolver/update_annotation_label.py +144 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_resolver/update_bounding_box.py +68 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotation_task_resolver.py +31 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotations/__init__.py +1 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/annotations/annotations_filter.py +89 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/dataset_resolver.py +278 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/embedding_model_resolver.py +100 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/metadata_resolver/__init__.py +15 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/metadata_resolver/metadata_filter.py +163 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/metadata_resolver/sample/__init__.py +21 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/metadata_resolver/sample/bulk_set_metadata.py +48 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/metadata_resolver/sample/get_by_sample_id.py +24 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/metadata_resolver/sample/get_metadata_info.py +104 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/metadata_resolver/sample/get_value_for_sample.py +27 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/metadata_resolver/sample/set_value_for_sample.py +53 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/sample_embedding_resolver.py +86 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/sample_resolver.py +249 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/samples_filter.py +81 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/settings_resolver.py +58 -0
- lightly_studio-0.3.1/src/lightly_studio/resolvers/tag_resolver.py +276 -0
- lightly_studio-0.3.1/src/lightly_studio/selection/README.md +6 -0
- lightly_studio-0.3.1/src/lightly_studio/selection/mundig.py +105 -0
- lightly_studio-0.3.1/src/lightly_studio/selection/select.py +96 -0
- lightly_studio-0.3.1/src/lightly_studio/selection/select_via_db.py +93 -0
- lightly_studio-0.3.1/src/lightly_studio/selection/selection_config.py +31 -0
- lightly_studio-0.3.1/src/lightly_studio/services/annotations_service/__init__.py +21 -0
- lightly_studio-0.3.1/src/lightly_studio/services/annotations_service/get_annotation_by_id.py +31 -0
- lightly_studio-0.3.1/src/lightly_studio/services/annotations_service/update_annotation.py +65 -0
- lightly_studio-0.3.1/src/lightly_studio/services/annotations_service/update_annotation_label.py +48 -0
- lightly_studio-0.3.1/src/lightly_studio/services/annotations_service/update_annotations.py +29 -0
- lightly_studio-0.3.1/src/lightly_studio/setup_logging.py +19 -0
- lightly_studio-0.3.1/src/lightly_studio/type_definitions.py +19 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/ACKNOWLEDGEMENTS +422 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/LICENSE +31 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/LICENSE_weights_data +50 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/README.md +5 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/__init__.py +1 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/__init__.py +96 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/clip.py +77 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/configs/mobileclip_b.json +18 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/configs/mobileclip_s0.json +18 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/configs/mobileclip_s1.json +18 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/configs/mobileclip_s2.json +18 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/image_encoder.py +67 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/logger.py +154 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/models/__init__.py +10 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/models/mci.py +933 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/models/vit.py +433 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/modules/__init__.py +4 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/modules/common/__init__.py +4 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/modules/common/mobileone.py +341 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/modules/common/transformer.py +451 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/modules/image/__init__.py +4 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/modules/image/image_projection.py +113 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/modules/image/replknet.py +188 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/modules/text/__init__.py +4 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/modules/text/repmixer.py +281 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/modules/text/tokenizer.py +38 -0
- lightly_studio-0.3.1/src/lightly_studio/vendor/mobileclip/text_encoder.py +245 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
dist
|
|
2
|
+
build
|
|
3
|
+
.venv
|
|
4
|
+
*.egg-info
|
|
5
|
+
__pycache__
|
|
6
|
+
.pytest_cache
|
|
7
|
+
.ruff_cache
|
|
8
|
+
dist_lightly_studio_view_app
|
|
9
|
+
|
|
10
|
+
# Ignore all .db files
|
|
11
|
+
*.db
|
|
12
|
+
*.db.wal
|
|
13
|
+
|
|
14
|
+
# Folder to test datasets
|
|
15
|
+
datasets
|
|
16
|
+
|
|
17
|
+
# Generated API schema
|
|
18
|
+
openapi.json
|
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lightly-studio
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: LightlyStudio is a lightweight, fast, and easy-to-use data exploration tool for data scientists and engineers.
|
|
5
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
6
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
7
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Requires-Python: >=3.8
|
|
14
|
+
Requires-Dist: annotated-types==0.7.0
|
|
15
|
+
Requires-Dist: duckdb-engine>=0.13.5
|
|
16
|
+
Requires-Dist: duckdb>=1.1.3
|
|
17
|
+
Requires-Dist: environs<12.0.0
|
|
18
|
+
Requires-Dist: eval-type-backport>=0.2.2
|
|
19
|
+
Requires-Dist: fastapi>=0.115.5
|
|
20
|
+
Requires-Dist: faster-coco-eval>=1.6.5
|
|
21
|
+
Requires-Dist: labelformat>=0.1.7
|
|
22
|
+
Requires-Dist: lightly-mundig==0.1.3
|
|
23
|
+
Requires-Dist: open-clip-torch>=2.20.0
|
|
24
|
+
Requires-Dist: python-multipart>=0.0.20
|
|
25
|
+
Requires-Dist: scikit-learn==1.3.2
|
|
26
|
+
Requires-Dist: sqlmodel>=0.0.22
|
|
27
|
+
Requires-Dist: torchmetrics>=1.5.2
|
|
28
|
+
Requires-Dist: tqdm>=4.65.0
|
|
29
|
+
Requires-Dist: typing-extensions>=4.12.2
|
|
30
|
+
Requires-Dist: uvicorn>=0.32.1
|
|
31
|
+
Requires-Dist: xxhash>=3.5.0
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
<div align="center">
|
|
35
|
+
<p align="center">
|
|
36
|
+
|
|
37
|
+
<!-- prettier-ignore -->
|
|
38
|
+
<img src="https://cdn.prod.website-files.com/62cd5ce03261cba217188442/66dac501a8e9a90495970876_Logo%20dark-short-p-800.png" height="50px">
|
|
39
|
+
|
|
40
|
+
**The open-source tool curating datasets**
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
[](https://pypi.org/project/lightly-studio)
|
|
45
|
+
[](https://pypi.org/project/lightly-studio)
|
|
46
|
+
[](LICENSE)
|
|
47
|
+
|
|
48
|
+
</p>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
# 🚀 Welcome to LightlyStudio!
|
|
52
|
+
|
|
53
|
+
We at **[Lightly](https://lightly.ai)** created **LightlyStudio**, an open-source tool
|
|
54
|
+
designed to supercharge your data curation workflows for computer vision datasets. Explore
|
|
55
|
+
your data, visualize annotations and crops, tag samples, and export curated lists to improve
|
|
56
|
+
your machine learning pipelines. And much more!
|
|
57
|
+
|
|
58
|
+
LightlyStudio runs entirely locally on your machine, keeping your data private. It consists
|
|
59
|
+
of a Python library for indexing your data and a web-based UI for visualization and curation.
|
|
60
|
+
|
|
61
|
+
## ✨ Core Workflow
|
|
62
|
+
|
|
63
|
+
Using LightlyStudio typically involves these steps:
|
|
64
|
+
|
|
65
|
+
1. **Index Your Dataset:** Run a Python script using the `lightly_studio` library to process your local dataset (images and annotations) and save metadata into a local `lightly_studio.db` file.
|
|
66
|
+
2. **Launch the UI:** The script then starts a local web server.
|
|
67
|
+
3. **Explore & Curate:** Use the UI to visualize images, annotations, and object crops. Filter and search your data (experimental text search available). Apply tags to interesting samples (e.g., "mislabeled", "review").
|
|
68
|
+
4. **Export Curated Data:** Export information (like filenames) for your tagged samples from the UI to use downstream.
|
|
69
|
+
5. **Stop the Server:** Close the terminal running the script (Ctrl+C) when done.
|
|
70
|
+
|
|
71
|
+
<p align="center">
|
|
72
|
+
<img alt="LightlyStudio Sample Grid View" src="https://storage.googleapis.com/lightly-public/studio/screenshot_grid_view.jpg" width="70%">
|
|
73
|
+
<br/>
|
|
74
|
+
<em>Visualize your dataset samples with annotations in the grid view.</em>
|
|
75
|
+
</p>
|
|
76
|
+
<p align="center">
|
|
77
|
+
<img alt="LightlyStudio Annotation Crop View" src="https://storage.googleapis.com/lightly-public/studio/screenshot_annotation_view.jpg" width="70%">
|
|
78
|
+
<br/>
|
|
79
|
+
<em>Switch to the annotation view to inspect individual object crops easily.</em>
|
|
80
|
+
</p>
|
|
81
|
+
<p align="center">
|
|
82
|
+
<img alt="LightlyStudio Sample Detail View" src="https://storage.googleapis.com/lightly-public/studio/screenshot_detail_view.jpg" width="70%">
|
|
83
|
+
<br/>
|
|
84
|
+
<em>Inspect individual samples in detail, viewing all annotations and metadata.</em>
|
|
85
|
+
</p>
|
|
86
|
+
|
|
87
|
+
## 🎯 Features
|
|
88
|
+
|
|
89
|
+
* **Local Web GUI:** Explore and curate your dataset in your browser. Works completelly
|
|
90
|
+
offline, your data never leaves your machine.
|
|
91
|
+
* **Flexible Input Formats:** Load your image dataset from a folder, or with annotations from
|
|
92
|
+
a number of popular formats like e.g. COCO or YOLO.
|
|
93
|
+
* **Metadata:** Attach your custom metadata to every sample.
|
|
94
|
+
* **Tags:** Mark subsets of your dataset for later use.
|
|
95
|
+
* **Embeddings:** Run similarity search queries on your data.
|
|
96
|
+
* **Selection:** Run advanced selection algorithms to tag a subset of your data.
|
|
97
|
+
|
|
98
|
+
## 💻 Installation
|
|
99
|
+
|
|
100
|
+
Ensure you have **Python 3.8 or higher**. We strongly recommend using a virtual environment.
|
|
101
|
+
|
|
102
|
+
The library is OS-independent and works on Windows, Linux, and macOS.
|
|
103
|
+
|
|
104
|
+
```shell
|
|
105
|
+
# 1. Create and activate a virtual environment (Recommended)
|
|
106
|
+
# On Linux/macOS:
|
|
107
|
+
python3 -m venv venv
|
|
108
|
+
source venv/bin/activate
|
|
109
|
+
|
|
110
|
+
# On Windows:
|
|
111
|
+
python -m venv venv
|
|
112
|
+
.\venv\Scripts\activate
|
|
113
|
+
|
|
114
|
+
# 2. Install LightlyStudio
|
|
115
|
+
pip install lightly_studio
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## **Quickstart**
|
|
119
|
+
|
|
120
|
+
Download the dataset and run a quickstart script to load your dataset and launch the app.
|
|
121
|
+
|
|
122
|
+
### YOLO Object Detection
|
|
123
|
+
|
|
124
|
+
To run an example using a yolo dataset, clone the example repository and run the example script:
|
|
125
|
+
|
|
126
|
+
```shell
|
|
127
|
+
git clone https://github.com/lightly-ai/dataset_examples_studio dataset_examples_studio
|
|
128
|
+
python dataset_examples_studio/road_signs_yolo/example_yolo.py
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
<details>
|
|
132
|
+
<summary>The YOLO format details:</summary>
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
road_signs_yolo/
|
|
136
|
+
├── train/
|
|
137
|
+
│ ├── images/
|
|
138
|
+
│ │ ├── image1.jpg
|
|
139
|
+
│ │ ├── image2.jpg
|
|
140
|
+
│ │ └── ...
|
|
141
|
+
│ └── labels/
|
|
142
|
+
│ ├── image1.txt
|
|
143
|
+
│ ├── image2.txt
|
|
144
|
+
│ └── ...
|
|
145
|
+
├── valid/ (optional)
|
|
146
|
+
│ ├── images/
|
|
147
|
+
│ │ └── ...
|
|
148
|
+
│ └── labels/
|
|
149
|
+
│ └── ...
|
|
150
|
+
└── data.yaml
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Each label file should contain YOLO format annotations (one per line):
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
<class> <x_center> <y_center> <width> <height>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Where coordinates are normalized between 0 and 1.
|
|
160
|
+
|
|
161
|
+
</details>
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
<details>
|
|
165
|
+
<summary>Let's break down the `example_yolo.py` script to explore the dataset:</summary>
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
# We import the DatasetLoader class from the lightly_studio module
|
|
169
|
+
from lightly_studio import DatasetLoader
|
|
170
|
+
from pathlib import Path
|
|
171
|
+
|
|
172
|
+
# Create a DatasetLoader instance
|
|
173
|
+
loader = DatasetLoader()
|
|
174
|
+
|
|
175
|
+
data_yaml_path = Path(__file__).resolve().parent / "data.yaml"
|
|
176
|
+
loader.from_yolo(
|
|
177
|
+
data_yaml_path=str(data_yaml_path),
|
|
178
|
+
input_split="test",
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
# We start the UI application on the port defined with the LIGHTLY_STUDIO_PORT env variable or 8001 by default.
|
|
182
|
+
loader.start_gui()
|
|
183
|
+
```
|
|
184
|
+
</details>
|
|
185
|
+
|
|
186
|
+
</details>
|
|
187
|
+
|
|
188
|
+
### COCO Instance Segmentation
|
|
189
|
+
|
|
190
|
+
To run an instance segmentation example using a COCO dataset, clone the example repository and run the example script:
|
|
191
|
+
|
|
192
|
+
```shell
|
|
193
|
+
git clone https://github.com/lightly-ai/dataset_examples_studio dataset_examples_studio
|
|
194
|
+
python dataset_examples_studio/coco_subset_128_images/example_coco.py
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
<details>
|
|
198
|
+
<summary>The COCO format details:</summary>
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
coco_subset_128_images/
|
|
202
|
+
├── images/
|
|
203
|
+
│ ├── image1.jpg
|
|
204
|
+
│ ├── image2.jpg
|
|
205
|
+
│ └── ...
|
|
206
|
+
└── instances_train2017.json # Single JSON file containing all annotations
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
COCO uses a single JSON file containing all annotations. The format consists of three main components:
|
|
210
|
+
|
|
211
|
+
- Images: Defines metadata for each image in the dataset.
|
|
212
|
+
- Categories: Defines the object classes.
|
|
213
|
+
- Annotations: Defines object instances.
|
|
214
|
+
|
|
215
|
+
</details>
|
|
216
|
+
|
|
217
|
+
<details>
|
|
218
|
+
<summary>Let's break down the `example_coco.py` script to explore the dataset:</summary>
|
|
219
|
+
|
|
220
|
+
```python
|
|
221
|
+
# We import the DatasetLoader class from the lightly_studio module
|
|
222
|
+
from lightly_studio import DatasetLoader
|
|
223
|
+
from pathlib import Path
|
|
224
|
+
|
|
225
|
+
# Create a DatasetLoader instance
|
|
226
|
+
loader = DatasetLoader()
|
|
227
|
+
|
|
228
|
+
current_dir = Path(__file__).resolve().parent
|
|
229
|
+
loader.from_coco_instance_segmentations(
|
|
230
|
+
annotations_json_path=str(current_dir / "instances_train2017.json"),
|
|
231
|
+
img_dir=str(current_dir / "images"),
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
# We start the UI application on the port defined with the LIGHTLY_STUDIO_PORT env variable or 8001 by default.
|
|
235
|
+
loader.start_gui()
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
</details>
|
|
239
|
+
|
|
240
|
+
</details>
|
|
241
|
+
|
|
242
|
+
## 🔍 How It Works
|
|
243
|
+
|
|
244
|
+
1. Your **Python script** uses the `lightly_studio` **Dataset Loader**.
|
|
245
|
+
2. The Loader reads your images and annotations, calculates embeddings, and saves metadata to a local **`lightly_studio.db`** file (using DuckDB).
|
|
246
|
+
3. `loader.start_gui()` starts a **local Backend API** server.
|
|
247
|
+
4. This server reads from `lightly_studio.db` and serves data to the **UI Application** running in your browser (`http://localhost:8001`).
|
|
248
|
+
5. Images are streamed directly from your disk for display in the UI.
|
|
249
|
+
|
|
250
|
+
## 🎯 Python Interface
|
|
251
|
+
|
|
252
|
+
### Load Image Dataset From A Folder
|
|
253
|
+
|
|
254
|
+
```py
|
|
255
|
+
from lightly_studio import DatasetLoader
|
|
256
|
+
|
|
257
|
+
loader = DatasetLoader()
|
|
258
|
+
loader.from_directory(
|
|
259
|
+
dataset_name="my-dataset",
|
|
260
|
+
img_dir="/path/to/image_dataset",
|
|
261
|
+
)
|
|
262
|
+
loader.start_gui()
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Load Image Dataset With Annotations
|
|
266
|
+
|
|
267
|
+
The `DatasetLoader` currently supports:
|
|
268
|
+
|
|
269
|
+
- **YOLOv8 Object Detection:** Reads `.yaml` file. Supports bounding boxes.
|
|
270
|
+
- **COCO Object Detection:** Reads `.json` annotations. Supports bounding boxes.
|
|
271
|
+
- **COCO Instance Segmentation:** Reads `.json` annotations. Supports instance masks in RLE (Run-Length Encoding) format.
|
|
272
|
+
|
|
273
|
+
```py
|
|
274
|
+
from lightly_studio import DatasetLoader
|
|
275
|
+
|
|
276
|
+
# Create a DatasetLoader instance
|
|
277
|
+
loader = DatasetLoader()
|
|
278
|
+
|
|
279
|
+
# Load a dataset in YOLO format
|
|
280
|
+
dataset = loader.from_yolo(
|
|
281
|
+
data_yaml_path="my_yolo_dataset/data.yaml",
|
|
282
|
+
input_split="test",
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
# Load an object detection dataset in COCO format
|
|
286
|
+
dataset = loader.from_coco_object_detections(
|
|
287
|
+
annotations_json_path="my_coco_dataset/detections_train.json",
|
|
288
|
+
img_dir="my_coco_dataset/images",
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
# Load an instance segmentation dataset in COCO format
|
|
292
|
+
dataset = loader.from_coco_instance_segmentations(
|
|
293
|
+
annotations_json_path="my_coco_dataset/instances_train.json",
|
|
294
|
+
img_dir="my_coco_dataset/images",
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
# Launch the GUI
|
|
298
|
+
loader.start_gui()
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Samples
|
|
302
|
+
|
|
303
|
+
The dataset consists of samples. Every sample corresponds to an image.
|
|
304
|
+
Dataset samples can be fetched and accessed as follows,
|
|
305
|
+
for a full list of attributes see [src/lightly_studio/models/sample.py]().
|
|
306
|
+
|
|
307
|
+
```py
|
|
308
|
+
# Get all dataset samples
|
|
309
|
+
samples = dataset.get_samples()
|
|
310
|
+
|
|
311
|
+
# Access sample attributes
|
|
312
|
+
s = samples[0]
|
|
313
|
+
s.sample_id # Sample ID
|
|
314
|
+
s.file_name # Image file name
|
|
315
|
+
s.file_path_abs # Full image file path
|
|
316
|
+
s.tags # The list of sample tags
|
|
317
|
+
...
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Sample Filtering
|
|
321
|
+
|
|
322
|
+
You can efficiently fetch filtered dataset samples with the `get_samples()` method.
|
|
323
|
+
All arguments are optional. A database object UUID is needed for filtering by
|
|
324
|
+
annotation labels, tags and samples. They would be obtained by other function calls.
|
|
325
|
+
|
|
326
|
+
```py
|
|
327
|
+
from lightly_studio.resolvers.samples_filter import FilterDimensions, SampleFilter
|
|
328
|
+
from lightly_studio.resolvers.metadata_resolver.metadata_filter import Metadata
|
|
329
|
+
|
|
330
|
+
sample1 = ...
|
|
331
|
+
sample2 = ...
|
|
332
|
+
ann1 = ...
|
|
333
|
+
tag1 = ...
|
|
334
|
+
|
|
335
|
+
# Example with available filters, all arguments are optional.
|
|
336
|
+
samples = dataset.get_samples(
|
|
337
|
+
# Set offset and limit to the list of returned samples.
|
|
338
|
+
# Samples are ordered by their creation date.
|
|
339
|
+
offset=0,
|
|
340
|
+
limit=10,
|
|
341
|
+
|
|
342
|
+
filters=SampleFilter(
|
|
343
|
+
# Filter by width and/or height.
|
|
344
|
+
width=FilterDimensions(min=10, max=200),
|
|
345
|
+
height=FilterDimensions(min=10, max=None),
|
|
346
|
+
|
|
347
|
+
# Filter by annotations.
|
|
348
|
+
annotation_label_ids=[ann1.annotation_label_id],
|
|
349
|
+
|
|
350
|
+
# Filter by tags.
|
|
351
|
+
tag_ids=[tag1.tag_id],
|
|
352
|
+
|
|
353
|
+
# Filter by metadata.
|
|
354
|
+
metadata_filters=[
|
|
355
|
+
Metadata("temperature") > 25.0,
|
|
356
|
+
Metadata("nested.bool_key") == True,
|
|
357
|
+
]
|
|
358
|
+
),
|
|
359
|
+
|
|
360
|
+
# Fetch only specific samples by IDs.
|
|
361
|
+
sample_ids=[sample1.sample_id, sample2.sample_id],
|
|
362
|
+
)
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
Alternatively, samples can be filtered directly in python code:
|
|
366
|
+
|
|
367
|
+
```py
|
|
368
|
+
my_samples = [
|
|
369
|
+
sample in dataset.get_samples()
|
|
370
|
+
if sample.file_name in ["image1.jpg", "image2.jpg"]
|
|
371
|
+
]
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Add Custom Metadata
|
|
375
|
+
|
|
376
|
+
Attach values to custom fields for every sample.
|
|
377
|
+
|
|
378
|
+
```py
|
|
379
|
+
from lightly_studio import DatasetLoader
|
|
380
|
+
|
|
381
|
+
# Load your dataset
|
|
382
|
+
loader = DatasetLoader()
|
|
383
|
+
dataset = loader.from_directory(
|
|
384
|
+
dataset_name="my-dataset",
|
|
385
|
+
img_dir="/path/to/image_dataset",
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
# Attach metadata
|
|
389
|
+
for sample in dataset.get_samples():
|
|
390
|
+
sample["my_metadata"] = f"Example metadata field for {sample.file_name}"
|
|
391
|
+
sample["my_dict"] = {"my_int_key": 10, "my_bool_key": True}
|
|
392
|
+
|
|
393
|
+
# View metadata in GUI
|
|
394
|
+
loader.start_gui()
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
### Tags
|
|
398
|
+
|
|
399
|
+
You can easily mark subsets of your data with tags.
|
|
400
|
+
|
|
401
|
+
```py
|
|
402
|
+
from lightly_studio.resolvers import tag_resolver
|
|
403
|
+
from lightly_studio.models.tag import TagCreate
|
|
404
|
+
|
|
405
|
+
# Load your dataset
|
|
406
|
+
loader = DatasetLoader()
|
|
407
|
+
dataset = ...
|
|
408
|
+
|
|
409
|
+
# Create a tag
|
|
410
|
+
my_tag = tag_resolver.create(
|
|
411
|
+
session=loader.session,
|
|
412
|
+
tag=TagCreate(dataset_id=dataset.dataset_id, name="my-tag"),
|
|
413
|
+
)
|
|
414
|
+
|
|
415
|
+
# Tag some samples, for example the first 10 samples:
|
|
416
|
+
for sample in dataset.get_samples()[:10]:
|
|
417
|
+
tag_resolver.add_tag_to_sample(
|
|
418
|
+
session=loader.session,
|
|
419
|
+
tag_id=my_tag.tag_id,
|
|
420
|
+
sample=sample,
|
|
421
|
+
)
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
Find existing tags and tagged samples as follows.
|
|
425
|
+
|
|
426
|
+
```py
|
|
427
|
+
from lightly_studio.resolvers import tag_resolver
|
|
428
|
+
from lightly_studio.resolvers.samples_filter import SampleFilter
|
|
429
|
+
|
|
430
|
+
# Get all tags
|
|
431
|
+
all_tags = tag_resolver.get_all_by_dataset_id(
|
|
432
|
+
session=loader.session,
|
|
433
|
+
dataset_id=dataset.dataset_id,
|
|
434
|
+
)
|
|
435
|
+
|
|
436
|
+
# Get a tag by name
|
|
437
|
+
my_tag = tag_resolver.get_by_name(
|
|
438
|
+
session=loader.session,
|
|
439
|
+
tag_name="my-tag"
|
|
440
|
+
)
|
|
441
|
+
|
|
442
|
+
# Get tagged samples
|
|
443
|
+
tagged_samples = dataset.get_samples(filters=SampleFilter(tag_ids=[my_tag.tag_id]))
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### Selection
|
|
447
|
+
|
|
448
|
+
LightlyStudio offers as a premium feature advanced methods for subselecting dataset
|
|
449
|
+
samples.
|
|
450
|
+
|
|
451
|
+
**Prerequisites:** The selection functionality requires a valid LightlyStudio license key.
|
|
452
|
+
Set the `LIGHTLY_STUDIO_LICENSE_KEY` environment variable before using selection features:
|
|
453
|
+
|
|
454
|
+
```bash
|
|
455
|
+
export LIGHTLY_STUDIO_LICENSE_KEY="license_key_here"
|
|
456
|
+
```
|
|
457
|
+
Alternatively, set it inside your Python script:
|
|
458
|
+
|
|
459
|
+
```py
|
|
460
|
+
import os
|
|
461
|
+
os.environ["LIGHTLY_STUDIO_LICENSE_KEY"] = "license_key_here"
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
The selection can be configured with a rich interface of the `Selection` object. The
|
|
465
|
+
example below showcases a simple case of selecting diverse samples.
|
|
466
|
+
|
|
467
|
+
```py
|
|
468
|
+
import os
|
|
469
|
+
from lightly_studio import DatasetLoader
|
|
470
|
+
from lightly_studio.selection.select import Selection
|
|
471
|
+
|
|
472
|
+
# Load your dataset
|
|
473
|
+
loader = DatasetLoader()
|
|
474
|
+
dataset = loader.from_directory(
|
|
475
|
+
dataset_name="my-dataset",
|
|
476
|
+
img_dir="/path/to/image_dataset",
|
|
477
|
+
)
|
|
478
|
+
|
|
479
|
+
# Select a diverse subset of 10 samples.
|
|
480
|
+
select = Selection(dataset_id=dataset.dataset_id, session=loader.session)
|
|
481
|
+
select.diverse(
|
|
482
|
+
n_samples_to_select=10,
|
|
483
|
+
selection_result_tag_name="diverse_selection",
|
|
484
|
+
)
|
|
485
|
+
|
|
486
|
+
loader.start_gui()
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
The selected sample paths can be exported via the GUI, or by a script:
|
|
490
|
+
|
|
491
|
+
```py
|
|
492
|
+
from lightly_studio.resolvers import tag_resolver
|
|
493
|
+
from lightly_studio.resolvers.samples_filter import SampleFilter
|
|
494
|
+
|
|
495
|
+
tag = tag_resolver.get_by_name(session=loader.session, tag_name="diverse_selection")
|
|
496
|
+
selected_samples = dataset.get_samples(filters=SampleFilter(tag_ids=[tag.tag_id]))
|
|
497
|
+
|
|
498
|
+
with open("export.txt", "w") as f:
|
|
499
|
+
for sample in selected_samples:
|
|
500
|
+
f.write(f"{sample.file_name}\n")
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
## 📚 **FAQ**
|
|
504
|
+
|
|
505
|
+
### Are the datasets persistent?
|
|
506
|
+
|
|
507
|
+
Yes, the information about datasets is persistent and stored in the db file. You can see it after the dataset is processed.
|
|
508
|
+
If you rerun the loader it will create a new dataset representing the same dataset, keeping the previous dataset information untouched.
|
|
509
|
+
|
|
510
|
+
### Can I change the database path?
|
|
511
|
+
|
|
512
|
+
Not yet. The database is stored in the working directory by default.
|
|
513
|
+
|
|
514
|
+
### Can I launch in another Python script or do I have to do it in the same script?
|
|
515
|
+
|
|
516
|
+
It is possible to use only one script at the same time because we lock the db file for the duration of the script.
|
|
517
|
+
|
|
518
|
+
### Can I change the API backend port?
|
|
519
|
+
|
|
520
|
+
Yes. To change the port set the LIGHTLY_STUDIO_PORT variable to your preffered value. If at runtime the port is unavailable it will try to set it to a random value.
|