ProjectMeta¶
-
class ProjectMeta(obj_classes=
None, tag_metas=None, project_type=None, project_settings=None)[source]¶ Bases:
JsonSerializableProject-level metadata: object classes, tag metas, project type and settings.
This schema is used to validate and interpret annotations across a Supervisely project.
General information about ProjectMeta. ProjectMeta object is immutable.
- Parameters:
- obj_classes=
None¶ ObjClassCollection or just list that stores
ObjClassinstances with unique names.- tag_metas=
None¶ TagMetaCollection or just list that stores
TagMetainstances with unique names.- project_type=
None¶ Type of items in project: images, videos, volumes, point_clouds.
- project_settings=
None¶ Additional project properties. For example, multi-view settings.
- obj_classes=
- Usage Example:
import supervisely as sly # Example 1: Empty ProjectMeta meta = sly.ProjectMeta() print(meta) # Output: # ProjectMeta: # Object Classes # +------+-------+-------+--------+ # | Name | Shape | Color | Hotkey | # +------+-------+-------+--------+ # +------+-------+-------+--------+ # Tags # +------+------------+-----------------+--------+---------------+--------------------+ # | Name | Value type | Possible values | Hotkey | Applicable to | Applicable classes | # +------+------------+-----------------+--------+---------------+--------------------+ # +------+------------+-----------------+--------+---------------+--------------------+ # Example 2: Complex ProjectMeta lemon = sly.ObjClass('lemon', sly.Rectangle) kiwi = sly.ObjClass('kiwi', sly.Polygon) tag_fruit = sly.TagMeta('fruit', sly.TagValueType.ANY_STRING) objects = sly.ObjClassCollection([lemon, kiwi]) # or objects = [lemon, kiwi] tags = sly.TagMetaCollection([tag_fruit]) # or tags = [tag_fruit] meta = sly.ProjectMeta(obj_classes=objects, tag_metas=tags, project_type=sly.ProjectType.IMAGES) print(meta) # Output: # +-------+-----------+----------------+--------+ # | Name | Shape | Color | Hotkey | # +-------+-----------+----------------+--------+ # | lemon | Rectangle | [108, 15, 138] | | # | kiwi | Polygon | [15, 98, 138] | | # +-------+-----------+----------------+--------+ # Tags # +-------+------------+-----------------+--------+---------------+--------------------+ # | Name | Value type | Possible values | Hotkey | Applicable to | Applicable classes | # +-------+------------+-----------------+--------+---------------+--------------------+ # | fruit | any_string | None | | all | [] | # +-------+------------+-----------------+--------+---------------+--------------------+ # Example 3: Add multi-view to the project lemon = sly.ObjClass('lemon', sly.Rectangle) kiwi = sly.ObjClass('kiwi', sly.Polygon) tag_fruit = sly.TagMeta('fruit', sly.TagValueType.ANY_STRING) settings = sly.ProjectSettings( multiview_enabled=True, multiview_tag_name=tag_fruit.name, multiview_is_synced=False, ) meta = sly.ProjectMeta( obj_classes=[lemon, kiwi], tag_metas=tag_fruit, project_type=sly.ProjectType.IMAGES, project_settings=settings ) # Example 4: Custom color cat_class = sly.ObjClass("cat", sly.Rectangle, color=[0, 255, 0]) scene_tag = sly.TagMeta("scene", sly.TagValueType.ANY_STRING) meta = sly.ProjectMeta(obj_classes=[cat_class], tag_metas=[scene_tag])
Methods
Adds given ObjClass to ProjectMeta.
Adds given ObjClasses to ProjectMeta.
Adds given TagMeta to ProjectMeta.
Adds given TagMetas to ProjectMeta.
Clone makes a copy of ProjectMeta with new fields, if fields are given, otherwise it will use original ProjectMeta fields.
Removes given ObjClass by name from ProjectMeta.
Removes given ObjClasses by names from ProjectMeta.
Removes given TagMeta by name from ProjectMeta.
Removes given TagMetas by names from ProjectMeta.
Convert a json dict to ProjectMeta.
Get given ObjClass by name from ProjectMeta.
Get given ObjClass by name from ProjectMeta.
Get given TagMeta by name from ProjectMeta.
Return TagMeta with given id.
Return tag name with given id.
Merge all instances from given ProjectMeta into a single ProjectMeta object.
Merge ProjectMetas from given list of ProjectMetas into single ProjectMeta object.
Convert project meta classes geometries to Rectangles or skip them and create new ProjectMeta.
Convert the ProjectMeta to a json dict.
Convert project meta classes geometries with keep_geometries types to Bitmaps and create new ProjectMeta.
Attributes
Get labeling interface settings of the project.
Collection of ObjClasses in ProjectMeta.
Settings of the project.
Type of project.
Collection of TagMetas in ProjectMeta.
- classmethod from_json(data)[source]¶
Convert a json dict to ProjectMeta. Read more about Supervisely format.
- Parameters:
- Returns:
ProjectMeta object
- Return type:
- Usage Example:
import supervisely as sly meta_json = { "classes": [ { "title": "lemon", "shape": "rectangle", "color": "#8A0F7B" }, { "title": "kiwi", "shape": "polygon", "color": "#8A0F50" } ], "tags": [ { "name": "fruit", "value_type": "any_string", "color": "#0F6F8A" } ] } meta = sly.ProjectMeta.from_json(meta_json)
- static merge_list(metas)[source]¶
Merge ProjectMetas from given list of ProjectMetas into single ProjectMeta object.
- Parameters:
- metas¶
List of
ProjectMetaobjects.
- Returns:
New instance of
ProjectMetaobject- Return type:
- Usage Example:
import supervisely as sly meta = sly.ProjectMeta() meta_1 = sly.ProjectMeta() class_cat = sly.ObjClass('cat', sly.Rectangle) meta_1 = meta_1.add_obj_class(class_cat) meta_2 = sly.ProjectMeta() tag_dog = sly.TagMeta('dog_tag', sly.TagValueType.ANY_STRING) meta_2 = meta_2.add_tag_meta(tag_dog) # Remember that ProjectMeta object is immutable, and we need to assign new instance of ProjectMeta to a new variable meta = meta.merge_list([meta_1, meta_2]) meta_json = meta.to_json() print(json.dumps(meta_json, indent=4)) # Output: { # "classes": [ # { # "title": "cat", # "shape": "rectangle", # "color": "#0F8A45", # "geometry_config": {}, # "hotkey": "" # } # ], # "tags": [ # { # "name": "dog_tag", # "value_type": "any_string", # "color": "#320F8A", # "hotkey": "", # "applicable_type": "all", # "classes": [] # } # ] # }
- add_obj_class(new_obj_class)[source]¶
Adds given ObjClass to ProjectMeta.
- Parameters:
- new_obj_class¶
ObjClass object.
- Returns:
New instance of ProjectMeta object
- Return type:
- Usage Example:
import supervisely as sly meta = sly.ProjectMeta() class_cat = sly.ObjClass('cat', sly.Rectangle) # Remember that ProjectMeta object is immutable, and we need to assign new instance of ProjectMeta to a new variable meta = meta.add_obj_class(class_cat) meta_json = meta.to_json() print(json.dumps(meta_json, indent=4)) # Output: { # "classes": [ # { # "title": "cat", # "shape": "rectangle", # "color": "#178A0F", # "geometry_config": {}, # "hotkey": "" # } # ], # "tags": [] # }
- add_obj_classes(new_obj_classes)[source]¶
Adds given ObjClasses to ProjectMeta.
- Parameters:
- new_obj_classes¶
List of ObjClass objects or ObjClassCollection.
- Returns:
New instance of ProjectMeta object
- Return type:
- Usage Example:
import supervisely as sly meta = sly.ProjectMeta() class_cat = sly.ObjClass('cat', sly.Rectangle) class_dog = sly.ObjClass('dog', sly.Bitmap) # Remember that ProjectMeta object is immutable, and we need to assign new instance of ProjectMeta to a new variable meta = meta.add_obj_classes([class_cat, class_dog]) meta_json = meta.to_json() print(json.dumps(meta_json, indent=4)) # Output: { # "classes": [ # { # "title": "cat", # "shape": "rectangle", # "color": "#8A0F3F", # "geometry_config": {}, # "hotkey": "" # }, # { # "title": "dog", # "shape": "bitmap", # "color": "#8A0F56", # "geometry_config": {}, # "hotkey": "" # } # ], # "tags": [] # }
- add_tag_meta(new_tag_meta)[source]¶
Adds given TagMeta to ProjectMeta.
- Parameters:
- new_tag_meta¶
TagMeta object.
- Returns:
New instance of ProjectMeta object
- Return type:
- Usage Example:
import supervisely as sly meta = sly.ProjectMeta() tag_cat = sly.TagMeta('cat_tag', sly.TagValueType.ANY_STRING) # Remember that ProjectMeta object is immutable, and we need to assign new instance of ProjectMeta to a new variable meta = meta.add_tag_meta(tag_cat) meta_json = meta.to_json() print(json.dumps(meta_json, indent=4)) # Output: { # "classes": [], # "tags": [ # { # "name": "cat_tag", # "value_type": "any_string", # "color": "#178A0F", # "hotkey": "", # "applicable_type": "all", # "classes": [] # } # ] # }
- add_tag_metas(new_tag_metas)[source]¶
Adds given TagMetas to ProjectMeta.
- Parameters:
- new_tag_metas¶
List of TagMeta objects or TagMetaCollection.
- Returns:
New instance of ProjectMeta object
- Return type:
- Usage Example:
import supervisely as sly meta = sly.ProjectMeta() tag_cat = sly.TagMeta('cat_tag', sly.TagValueType.ANY_STRING) tag_dog = sly.TagMeta('dog_tag', sly.TagValueType.ANY_STRING) # Remember that ProjectMeta object is immutable, and we need to assign new instance of ProjectMeta to a new variable meta = meta.add_tag_metas([tag_cat, tag_dog]) meta_json = meta.to_json() print(json.dumps(meta_json, indent=4)) # Output: { # "classes": [], # "tags": [ # { # "name": "cat_tag", # "value_type": "any_string", # "color": "#0F248A", # "hotkey": "", # "applicable_type": "all", # "classes": [] # }, # { # "name": "dog_tag", # "value_type": "any_string", # "color": "#8A5C0F", # "hotkey": "", # "applicable_type": "all", # "classes": [] # } # ] # }
-
clone(obj_classes=
None, tag_metas=None, project_type=None, project_settings=None)[source]¶ Clone makes a copy of ProjectMeta with new fields, if fields are given, otherwise it will use original ProjectMeta fields.
- Parameters:
- obj_classes=
None¶ ObjClassCollection or just list that stores
ObjClassinstances with unique names.- tag_metas=
None¶ TagMetaCollection that stores
TagMetainstances with unique names.- project_type : str, optional¶
Type of items in project: images, videos, volumes, point_clouds.
- project_settings=
None¶ Additional project properties. For example, multi-view settings
- obj_classes=
- Returns:
New instance of ProjectMeta object
- Return type:
- Usage Example:
import supervisely as sly meta = sly.ProjectMeta() class_cat = sly.ObjClass('cat', sly.Rectangle) collection_cat = sly.ObjClassCollection([class_cat]) # or collection_cat = [class_cat] tag_cat = sly.TagMeta('cat_tag', sly.TagValueType.ANY_STRING) collection_tag_cat = sly.TagMetaCollection([tag_cat]) # or collection_tag_cat = [tag_cat] # Remember that ProjectMeta object is immutable, and we need to assign new instance of ProjectMeta to a new variable new_meta = meta.clone(obj_classes=collection_cat, tag_metas=collection_tag_cat) new_meta_json = new_meta.to_json() print(json.dumps(new_meta_json, indent=4)) # Output: { # "classes": [ # { # "title": "cat", # "shape": "rectangle", # "color": "#190F8A", # "geometry_config": {}, # "hotkey": "" # } # ], # "tags": [ # { # "name": "cat_tag", # "value_type": "any_string", # "color": "#8A6D0F", # "hotkey": "", # "applicable_type": "all", # "classes": [] # } # ] # }
- delete_obj_class(obj_class_name)[source]¶
Removes given ObjClass by name from ProjectMeta.
- Parameters:
- Returns:
New instance of ProjectMeta object
- Return type:
- Usage Example:
import supervisely as sly meta = sly.ProjectMeta() class_cat = sly.ObjClass('cat', sly.Rectangle) # Remember that ProjectMeta object is immutable, and we need to assign new instance of ProjectMeta to a new variable meta = meta.add_obj_class(class_cat) meta_json = meta.to_json() print(json.dumps(meta_json, indent=4)) # Output: { # "classes": [ # { # "title": "cat", # "shape": "rectangle", # "color": "#268A0F", # "geometry_config": {}, # "hotkey": "" # } # ], # "tags": [] # } # Remember that ProjectMeta object is immutable, and we need to assign new instance of ProjectMeta to a new variable meta = meta.delete_obj_class('cat') meta_json = meta.to_json() print(json.dumps(meta_json, indent=4)) # Output: { # "classes": [], # "tags": [] # }
- delete_obj_classes(obj_class_names)[source]¶
Removes given ObjClasses by names from ProjectMeta.
- Parameters:
- Returns:
New instance of ProjectMeta object
- Return type:
- Usage Example:
import supervisely as sly meta = sly.ProjectMeta() class_cat = sly.ObjClass('cat', sly.Rectangle) class_dog = sly.ObjClass('dog', sly.Bitmap) # Remember that ProjectMeta object is immutable, and we need to assign new instance of ProjectMeta to a new variable meta = meta.add_obj_classes([class_cat, class_dog]) meta_json = meta.to_json() print(json.dumps(meta_json, indent=4)) # Output: { # "classes": [ # { # "title": "cat", # "shape": "rectangle", # "color": "#8A0F18", # "geometry_config": {}, # "hotkey": "" # }, # { # "title": "dog", # "shape": "bitmap", # "color": "#0F8A7F", # "geometry_config": {}, # "hotkey": "" # } # ], # "tags": [] # } # Remember that ProjectMeta object is immutable, and we need to assign new instance of ProjectMeta to a new variable meta = meta.delete_obj_classes(['cat', 'dog']) meta_json = meta.to_json() print(json.dumps(meta_json, indent=4)) # Output: { # "classes": [], # "tags": [] # }
- delete_tag_meta(tag_name)[source]¶
Removes given TagMeta by name from ProjectMeta.
- Parameters:
- Returns:
New instance of ProjectMeta object
- Return type:
- Usage Example:
import supervisely as sly meta = sly.ProjectMeta() tag_cat = sly.TagMeta('cat_tag', sly.TagValueType.ANY_STRING) # Remember that ProjectMeta object is immutable, and we need to assign new instance of ProjectMeta to a new variable meta = meta.add_tag_meta(tag_cat) meta_json = meta.to_json() print(json.dumps(meta_json, indent=4)) # Output: { # "classes": [], # "tags": [ # { # "name": "cat_tag", # "value_type": "any_string", # "color": "#8A540F", # "hotkey": "", # "applicable_type": "all", # "classes": [] # } # ] # } # Remember that ProjectMeta object is immutable, and we need to assign new instance of ProjectMeta to a new variable meta = meta.delete_tag_meta('cat_tag') meta_json = meta.to_json() print(json.dumps(meta_json, indent=4)) # Output: { # "classes": [], # "tags": [] # }
- delete_tag_metas(tag_names)[source]¶
Removes given TagMetas by names from ProjectMeta.
- Parameters:
- tag_names¶
List of TagMetas names.
- Returns:
New instance of ProjectMeta object
- Return type:
- Usage Example:
import supervisely as sly meta = sly.ProjectMeta() tag_cat = sly.TagMeta('cat_tag', sly.TagValueType.ANY_STRING) tag_dog = sly.TagMeta('dog_tag', sly.TagValueType.ANY_STRING) # Remember that ProjectMeta object is immutable, and we need to assign new instance of ProjectMeta to a new variable meta = meta.add_tag_metas([tag_cat, tag_dog]) meta_json = meta.to_json() print(json.dumps(meta_json, indent=4)) # Output: { # "classes": [], # "tags": [ # { # "name": "cat_tag", # "value_type": "any_string", # "color": "#0F298A", # "hotkey": "", # "applicable_type": "all", # "classes": [] # }, # { # "name": "dog_tag", # "value_type": "any_string", # "color": "#8A410F", # "hotkey": "", # "applicable_type": "all", # "classes": [] # } # ] # } # Remember that ProjectMeta object is immutable, and we need to assign new instance of ProjectMeta to a new variable meta = meta.delete_tag_metas(['cat_tag', 'dog_tag']) meta_json = meta.to_json() print(json.dumps(meta_json, indent=4)) # Output: { # "classes": [], # "tags": [] # }
- get_obj_class(obj_class_name)[source]¶
Get given ObjClass by name from ProjectMeta.
- Parameters:
- Returns:
ObjClassobject- Return type:
- Usage Example:
import supervisely as sly meta = sly.ProjectMeta() class_cat = sly.ObjClass('cat', sly.Rectangle) class_dog = sly.ObjClass('dog', sly.Bitmap) # Remember that ProjectMeta object is immutable, and we need to assign new instance of ProjectMeta to a new variable meta = meta.add_obj_classes([class_cat, class_dog]) meta_json = meta.to_json() print(json.dumps(meta_json, indent=4)) # Output: { # "classes": [ # { # "title": "cat", # "shape": "rectangle", # "color": "#8A140F", # "geometry_config": {}, # "hotkey": "" # }, # { # "title": "dog", # "shape": "bitmap", # "color": "#0F8A35", # "geometry_config": {}, # "hotkey": "" # } # ], # "tags": [] # } class_cat = meta.get_obj_class('cat') print(class_cat) # Output: # Name: cat Shape: Rectangle Color: [138, 20, 15] Geom. settings: {} Hotkey class_elephant = meta.get_obj_class('elephant') print(class_elephant) # Output: # None
- get_obj_class_by_id(obj_class_id)[source]¶
Get given ObjClass by name from ProjectMeta.
- Parameters:
- Returns:
ObjClassobject or None- Return type:
- Usage Example:
import os from dotenv import load_dotenv import supervisely as sly # Load secrets and create API object from .env file (recommended) # Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication if sly.is_development(): load_dotenv(os.path.expanduser("~/supervisely.env")) api = sly.Api.from_env() project_id = 555 meta = sly.ProjectMeta.from_json(api.project.get_meta(project_id)) obj_class_id = 123
- get_tag_meta(tag_name)[source]¶
Get given TagMeta by name from ProjectMeta.
- Parameters:
- Returns:
TagMetaobject or None.- Return type:
- Usage Example:
import supervisely as sly meta = sly.ProjectMeta() tag_cat = sly.TagMeta('cat_tag', sly.TagValueType.ANY_STRING) tag_dog = sly.TagMeta('dog_tag', sly.TagValueType.ANY_STRING) # Remember that ProjectMeta object is immutable, and we need to assign new instance of ProjectMeta to a new variable meta = meta.add_tag_metas([tag_cat, tag_dog]) meta_json = meta.to_json() print(json.dumps(meta_json, indent=4)) # Output: { # "classes": [], # "tags": [ # { # "name": "cat_tag", # "value_type": "any_string", # "color": "#590F8A", # "hotkey": "", # "applicable_type": "all", # "classes": [] # }, # { # "name": "dog_tag", # "value_type": "any_string", # "color": "#0F8A88", # "hotkey": "", # "applicable_type": "all", # "classes": [] # } # ] # } tag_cat = meta.get_tag_meta('cat_tag') print(tag_cat) # Output: # Name: cat_tag Value type:any_string Possible values:None Hotkey Applicable toall Applicable classes[] tag_elephant = meta.get_tag_meta('elephant_tag') print(tag_elephant) # Output: # None
- merge(other)[source]¶
Merge all instances from given ProjectMeta into a single ProjectMeta object.
- Parameters:
- other¶
Other project’s meta.
- Returns:
New instance of project meta object
- Return type:
- Raises:
ValueError – Upon attempt to merge metas which contain the same obj class or tag meta
- Usage Example:
import supervisely as sly meta_1 = sly.ProjectMeta() class_cat = sly.ObjClass('cat', sly.Rectangle) tag_cat = sly.TagMeta('cat_tag', sly.TagValueType.ANY_STRING) meta_1 = meta_1.add_obj_class(class_cat) meta_1 = meta_1.add_tag_meta(tag_cat) meta_2 = sly.ProjectMeta() class_dog = sly.ObjClass('dog', sly.Rectangle) tag_dog = sly.TagMeta('dog_tag', sly.TagValueType.ANY_STRING) meta_2 = meta_2.add_obj_class(class_dog) meta_2 = meta_2.add_tag_meta(tag_dog) merge_meta = meta_1.merge(meta_2) merge_meta_json = merge_meta.to_json() print(json.dumps(merge_meta_json, indent=4)) # Output: { # "classes": [ # { # "title": "dog", # "shape": "rectangle", # "color": "#0F8A62", # "geometry_config": {}, # "hotkey": "" # }, # { # "title": "cat", # "shape": "rectangle", # "color": "#340F8A", # "geometry_config": {}, # "hotkey": "" # } # ], # "tags": [ # { # "name": "dog_tag", # "value_type": "any_string", # "color": "#380F8A", # "hotkey": "", # "applicable_type": "all", # "classes": [] # }, # { # "name": "cat_tag", # "value_type": "any_string", # "color": "#8A0F82", # "hotkey": "", # "applicable_type": "all", # "classes": [] # } # ] # }
-
to_detection_task(convert_classes=
False)[source]¶ Convert project meta classes geometries to Rectangles or skip them and create new ProjectMeta.
- Parameters:
- Returns:
New project meta and dict correspondences of old classes to new
- Return type:
Tuple[ProjectMeta, Dict[ObjClass, ObjClass]]- Usage Example:
import supervisely as sly meta = sly.ProjectMeta() class_cat = sly.ObjClass('cat', sly.Polygon) class_dog = sly.ObjClass('dog', sly.Bitmap) meta = meta.add_obj_classes([class_cat, class_dog]) meta_json = meta.to_json() print(json.dumps(meta_json, indent=4)) # Output: { # "classes": [ # { # "title": "cat", # "shape": "polygon", # "color": "#208A0F", # "geometry_config": {}, # "hotkey": "" # }, # { # "title": "dog", # "shape": "bitmap", # "color": "#8A570F", # "geometry_config": {}, # "hotkey": "" # } # ], # "tags": [] # } res_meta, mapping = meta.to_detection_task(convert_classes=True) res_meta_json = res_meta.to_json() print(json.dumps(res_meta_json, indent=4)) # Output: { # "classes": [ # { # "title": "cat", # "shape": "rectangle", # "color": "#3A0F8A", # "geometry_config": {}, # "hotkey": "" # }, # { # "title": "dog", # "shape": "rectangle", # "color": "#8A310F", # "geometry_config": {}, # "hotkey": "" # } # ], # "tags": [] # }
- to_json()[source]¶
Convert the ProjectMeta to a json dict. Read more about Supervisely format.
- Returns:
Json format as a dict
- Return type:
Dict[str, Any]
- Usage Example:
meta_json = meta.to_json() print(meta_json) # Output: { # "classes": [ # { # "title": "lemon", # "shape": "rectangle", # "color": "#720F8A", # "geometry_config": {}, # "hotkey": "" # }, # { # "title": "kiwi", # "shape": "polygon", # "color": "#8A0F6F", # "geometry_config": {}, # "hotkey": "" # } # ], # "tags": [ # { # "name": "fruit", # "value_type": "any_string", # "color": "#788A0F", # "hotkey": "", # "applicable_type": "all", # "classes": [] # } # ] # }
- to_segmentation_task(keep_geometries=[<class 'supervisely.geometry.polygon.Polygon'>, <class 'supervisely.geometry.bitmap.Bitmap'>], target_classes=None)[source]¶
Convert project meta classes geometries with keep_geometries types to Bitmaps and create new ProjectMeta.
- Parameters:
- keep_geometries : List, optional
List of geometries that can be converted.
- Returns:
New project meta and dict correspondences of old classes to new
- Return type:
Tuple[
ProjectMeta, Dict[ObjClass,ObjClass]]- Usage Example:
import supervisely as sly meta = sly.ProjectMeta() class_cat = sly.ObjClass('cat', sly.Polygon) class_dog = sly.ObjClass('dog', sly.Bitmap) meta = meta.add_obj_classes([class_cat, class_dog]) meta_json = meta.to_json() print(json.dumps(meta_json, indent=4)) # Output: { # "classes": [ # { # "title": "cat", # "shape": "polygon", # "color": "#208A0F", # "geometry_config": {}, # "hotkey": "" # }, # { # "title": "dog", # "shape": "bitmap", # "color": "#8A570F", # "geometry_config": {}, # "hotkey": "" # } # ], # "tags": [] # } res_meta, mapping = meta.to_segmentation_task() res_meta_json = res_meta.to_json() print(json.dumps(res_meta_json, indent=4)) # Output: { # "classes": [ # { # "title": "cat", # "shape": "bitmap", # "color": "#208A0F", # "geometry_config": {}, # "hotkey": "" # }, # { # "title": "dog", # "shape": "bitmap", # "color": "#8A570F", # "geometry_config": {}, # "hotkey": "" # } # ], # "tags": [] # }
- property labeling_interface : supervisely.project.project_settings.LabelingInterface | None¶
Get labeling interface settings of the project.
- Returns:
Labeling interface settings
- Return type:
LabelingInterfaceor None- Usage Example:
import supervisely as sly s = sly.ProjectSettings( multiview_enabled=True, multiview_tag_name='multi_tag', multiview_is_synced=False, ) meta = sly.ProjectMeta(project_settings=s) labeling_interface = meta.labeling_interface print(labeling_interface) # Output: None
- property obj_classes : supervisely.annotation.obj_class_collection.ObjClassCollection¶
Collection of ObjClasses in ProjectMeta.
- Returns:
ObjClassCollection object
- Return type:
- Usage Example:
import supervisely as sly lemon = sly.ObjClass('lemon', sly.Rectangle) kiwi = sly.ObjClass('kiwi', sly.Polygon) objects = sly.ObjClassCollection([lemon, kiwi]) # or objects = [lemon, kiwi] meta = sly.ProjectMeta(obj_classes=objects, project_type=sly.ProjectType.IMAGES) meta_classes = meta.obj_classes print(meta_classes.to_json()) # Output: [ # { # "title":"lemon", # "shape":"rectangle", # "color":"#6C0F8A", # "geometry_config":{ # # }, # "hotkey":"" # }, # { # "title":"kiwi", # "shape":"polygon", # "color":"#0F628A", # "geometry_config":{ # # }, # "hotkey":"" # } # ]
- property project_settings : supervisely.project.project_settings.ProjectSettings¶
Settings of the project. See possible values in
ProjectSettings.- Returns:
Project settings
- Return type:
ProjectSettings- Usage Example:
import supervisely as sly s = sly.ProjectSettings( multiview_enabled=True, multiview_tag_name='multi_tag', multiview_is_synced=False, ) meta = sly.ProjectMeta(project_settings=s) print(meta.project_settings) # Output: <class 'supervisely.project.project_settings.ProjectSettings'>
- property project_type : str¶
Type of project. See possible value types in
ProjectType.- Returns:
Project type
- Return type:
- Usage Example:
import supervisely as sly meta = sly.ProjectMeta(project_type=sly.ProjectType.IMAGES) print(meta.project_type) # Output: 'images'
- property tag_metas : supervisely.annotation.tag_meta_collection.TagMetaCollection¶
Collection of TagMetas in ProjectMeta.
- Returns:
TagMetaCollection object
- Return type:
- Usage Example:
import supervisely as sly tag_fruit = sly.TagMeta('fruit', sly.TagValueType.ANY_STRING) tags = sly.TagMetaCollection([tag_fruit]) # or tags = [tag_fruit] meta = sly.ProjectMeta(tag_metas=tags) meta_tags = meta.tag_metas print(meta_tags.to_json()) # Output: [ # { # "name":"fruit", # "value_type":"any_string", # "color":"#818A0F", # "hotkey":"", # "applicable_type":"all", # "classes":[] # } # ]