### Install Pharos Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/features/visualization.md Install the Pharos plugin using pip. ```console pip3 install pharos ``` -------------------------------- ### Install TensorBay Python SDK Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/README.md Install the TensorBay Python SDK using pip. ```console pip3 install tensorbay ``` -------------------------------- ### Verify TensorBay Installation Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/quick_start/getting_started_with_tensorbay.md Verify the installed SDK and CLI version by running this command in your terminal. This confirms a successful installation. ```console gas --version ``` -------------------------------- ### Example Profile Summary Output Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/advanced_features/profile.md This is an example of the output format for a saved profile summary file. It includes details on API paths, total time, call numbers, average time, response length, and file size. ```text |Path |totalTime (s) |callNumber |avgTime (s) |totalResponseLength |totalFileSize (B)| |[GET] data06/labels |11.239 |25 |0.450 |453482 |0 | |[GET] data06/data/urls |16.739 |25 |0.670 |794545 |0 | |[POST] oss-cn-shanghai |0.567 |10 |0.057 |0 |8058707 | ``` -------------------------------- ### Initialize GAS Client Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/features/search/basic_search.md Initializes the GAS client with your AccessKey and gets a dataset client. Replace '' and '' with your actual credentials and dataset name. ```python from tensorbay import GAS # Please visit `https://gas.graviti.com/tensorbay/developer` to get the AccessKey. gas = GAS("") dataset_client = gas.get_dataset("") ``` -------------------------------- ### Word Object Example Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/label/label_sentence.md Demonstrates the creation and serialization of a Word object. ```python >>> word = Word(text="example", begin=1, end=2) >>> word.dumps() {'text': 'example', 'begin': 1, 'end': 2} ``` -------------------------------- ### Example of CLI Completion Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/tensorbay_cli/completion.md Demonstrates how shell completion suggests command and option names when using the `gas` CLI. Options are shown after a dash is entered. ```console $ gas auth -- Authenticate the accessKey of gas. branch -- List, create or delete branches. commit -- Commit drafts. config -- Configure the options when using gas CLI. cp -- Copy local data to a remote path. dataset -- List, create or delete datasets. draft -- List or create drafts. log -- Show commit logs. ls -- List data under the path. rm -- Remove the remote data. tag -- List, create or delete tags. $ gas auth - --get -g -- Get the accesskey of the profile --status -s -- Get the user info and accesskey of the profile --unset -u -- Unset the accesskey of the profile --all -a -- All the auth info --help -- Show this message and exit. ``` -------------------------------- ### Creating a LabeledBox3D Instance Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/label_format/Box3D.md Example of how to create a LabeledBox3D object using its constructor with size, translation, rotation, category, attributes, and instance. ```APIDOC ## Creating a LabeledBox3D Instance ```pycon >>> from tensorbay.label import LabeledBox3D >>> box3d_label = LabeledBox3D( ... size=[10, 20, 30], ... translation=[0, 0, 0], ... rotation=[1, 0, 0, 0], ... category="", ... attributes={"": ""}, ... instance="" ... ) >>> box3d_label LabeledBox3D( (size): Vector3D(10, 20, 30), (translation): Vector3D(0, 0, 0), (rotation): quaternion(1.0, 0.0, 0.0, 0.0), (category): '', (attributes): {...}, (instance): '' ) ``` ``` -------------------------------- ### Access a Dataset Segment Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/quick_start/examples/THCHS30.md Get a specific segment from the dataset by its name. For example, access the 'dev' segment. ```python segment = dataset["dev"] ``` -------------------------------- ### Initialize and Configure SentenceSubcatalog Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/label_format/Sentence.md Demonstrates how to initialize a SentenceSubcatalog and set its properties like is_sample, sample_rate, and lexicon. ```python >>> from tensorbay.label import SentenceSubcatalog >>> sentence_subcatalog = SentenceSubcatalog() >>> sentence_subcatalog.is_sample = True >>> sentence_subcatalog.sample_rate = 5 >>> sentence_subcatalog.append_lexicon(["text", "spell", "phone"]) >>> sentence_subcatalog SentenceSubcatalog( (is_sample): True, (sample_rate): 5, (lexicon): [...] ) ``` -------------------------------- ### Access a Dataset Segment Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/quick_start/examples/DogsVsCats.md Get a specific segment from the dataset by its name. For example, accessing the 'train' segment. ```python segment = dataset["train"] ``` -------------------------------- ### Show All TensorBay Configurations Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/tensorbay_cli/cli_commands.md Display all current configuration settings for TensorBay. ```bash $ gas config ``` -------------------------------- ### Initialize TensorBay GAS Client Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/features/version_control/draft_and_commit.md Initialize the GAS client with your AccessKey and create a dataset client. Visit the provided URL to obtain your AccessKey. ```python from tensorbay import GAS # Please visit `https://gas.graviti.com/tensorbay/developer` to get the AccessKey. gas = GAS("") dataset_client = gas.create_dataset("") ``` -------------------------------- ### Initialize and Add Keypoints to Keypoints2DSubcatalog Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/label_format/Keypoints2D.md Demonstrates initializing a Keypoints2DSubcatalog and adding keypoints with their associated information like names, skeleton, visibility, and parent categories. This can be done during initialization or after. ```python from tensorbay.label import Keypoints2DSubcatalog keypoints2d_subcatalog = Keypoints2DSubcatalog() keypoints2d_subcatalog.add_keypoints( 3, names=["head", "body", "feet"], skeleton=[[0, 1], [1, 2]], visible="BINARY", parent_categories=["cat"], description="keypoints of cats" ) keypoints2d_subcatalog.keypoints ``` ```python [KeypointsInfo( (number): 3, (names): [...], (skeleton): [...], (visible): 'BINARY', (parent_categories): [...] )] ``` -------------------------------- ### TBRN Example Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/glossary.md An example of a TBRN for an image file within a specific dataset and segment. TBRNs are used in the CLI. ```default tb:example:train://000000.jpg ``` -------------------------------- ### Get TensorBay Authentication Information Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/tensorbay_cli/cli_commands.md Retrieve the current authentication information for your TensorBay account. Use the --all flag to get information for all configurations. ```bash $ gas auth --get [--all] ``` -------------------------------- ### Get Remote Dataset with TensorBay SDK Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/advanced_features/cache.md Get a remote dataset from TensorBay using your AccessKey and dataset name. Ensure you have your AccessKey from the Graviti platform. ```python from tensorbay import GAS from tensorbay.dataset import Dataset # Please visit `https://gas.graviti.com/tensorbay/developer` to get the AccessKey. gas = GAS("") dataset = Dataset("", gas) ``` -------------------------------- ### Get the top-left and bottom-right points of a Box2D Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/geometry/box.md Access the `tl` and `br` properties to get Vector2D objects representing the top-left and bottom-right corners of the box, respectively. ```python >>> box2d = Box2D(1, 2, 3, 4) >>> box2d.tl Vector2D(1, 2) ``` ```python >>> box2d = Box2D(1, 2, 3, 4) >>> box2d.br Vector2D(3, 4) ``` -------------------------------- ### Authorize a Client Instance Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/quick_start/examples/CADC.md Create a GAS client instance. Obtain your AccessKey from the TensorBay developer portal. ```python from tensorbay import GAS from tensorbay.dataset import FusionDataset # Please visit `https://gas.graviti.com/tensorbay/developer` to get the AccessKey. gas = GAS("") ``` -------------------------------- ### Get Latest Basic Search Job Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/features/search/basic_search.md Retrieves the latest basic search job using its ID. Alternatively, `list_jobs()` can be used to get a list of all jobs, and the first element can be accessed. ```python job = dataset_client.basic_search.get_job("") ``` ```python job = dataset_client.basic_search.list_jobs()[0] ``` -------------------------------- ### Authorize a Sextant Instance Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/applications/sextant.md Instantiate the Sextant client using your AccessKey. Visit the developer portal to obtain your AccessKey. ```python from tensorbay.apps.sextant import Sextant # Please visit `https://gas.graviti.com/tensorbay/developer` to get the AccessKey. sextant = Sextant("") ``` -------------------------------- ### Initialize and Configure Polyline2DSubcatalog Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/label_format/Polyline2D.md Demonstrates how to initialize a Polyline2DSubcatalog and set its properties after initialization. Use this when you need to customize the subcatalog's behavior, such as enabling Bezier curves. ```python >>> from tensorbay.label import Polyline2DSubcatalog >>> polyline2d_subcatalog = Polyline2DSubcatalog() >>> polyline2d_subcatalog.is_beizer_curve = True >>> polyline2d_subcatalog Polyline2DSubcatalog( (is_beizer_curve): True, (is_tracking): False ) ``` -------------------------------- ### Get Dataset Label Statistics Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/quick_start/examples/get_label_statistics.md Instantiate the GAS client, get a dataset client, and then call get_label_statistics() to retrieve the statistics. The statistics object contains detailed information about label quantities and categories. ```python >>> from tensorbay import GAS >>> gas = GAS("YOUR_ACCESSKEY") >>> dataset_client = gas.get_dataset("") >>> statistics = dataset_client.get_label_statistics() >>> statistics Statistics { 'BOX2D': {...}, 'BOX3D': {...}, 'KEYPOINTS2D': {...} } ``` -------------------------------- ### Initialize TensorBay Dataset Client Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/features/version_control/tag.md Before operating on tags, you need to initialize a dataset client instance. Ensure you have your AccessKey and dataset name ready. ```python from tensorbay import GAS # Please visit `https://gas.graviti.com/tensorbay/developer` to get the AccessKey. gas = GAS("") dataset_client = gas.create_dataset("") dataset_client.create_draft("draft-1") # do the modifications in this draft ``` -------------------------------- ### Transform3D.rotation Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/geometry/transform.md Gets the rotation component of the 3D transform. ```APIDOC #### property rotation *: quaternion* ### Description Return the rotation of the 3D transform. ### Returns Rotation in numpy quaternion. ### Examples ```pycon >>> transform = Transform3D(matrix=[[1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 1]]) >>> transform.rotation quaternion(1, -0, -0, -0) ``` ``` -------------------------------- ### Transform3D.translation Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/geometry/transform.md Gets the translation component of the 3D transform. ```APIDOC #### property translation *: [Vector3D](vector.md#tensorbay.geometry.vector.Vector3D)* ### Description Return the translation of the 3D transform. ### Returns Translation in [`Vector3D`](vector.md#tensorbay.geometry.vector.Vector3D). ### Examples ```pycon >>> transform = Transform3D(matrix=[[1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 1]]) >>> transform.translation Vector3D(1, 1, 1) ``` ``` -------------------------------- ### Initialize Dataset Client and Create Branches Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/features/version_control/squash_and_merge.md Initializes a dataset client and creates multiple branches with commits. This sets up the environment for squash and merge operations. ```python from tensorbay import GAS # Please visit `https://gas.graviti.com/tensorbay/developer` to get the AccessKey. gas = GAS("") dataset_client = gas.create_dataset("") dataset_client.create_draft("draft-1") dataset_client.commit("commit-1") dataset_client.create_branch("dev") dataset_client.create_draft("draft-2") dataset_client.commit("commit-2") dataset_client.create_draft("draft-3") dataset_client.commit("commit-3") dataset_client.checkout("main") dataset_client.create_draft("draft-4") dataset_client.commit("commit-4") ``` -------------------------------- ### Pipeline.copy Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/healthcheck/pipeline.md Method to get a shallow copy of the pipeline. ```APIDOC ## copy() ### Description Copy method to get a shallow copy of pipeline. ### Parameters #### Path Parameters - **self** ( _S*) - Required - ### Returns - ** _S* - A shallow copy of the pipeline. ``` -------------------------------- ### Get Tag Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/client/version.md Retrieves a specific tag by its name. ```APIDOC ## get_tag(name) ### Description Get the certain tag with the given name. ### Parameters #### Path Parameters - **name** (str) - Required - The required tag name. ### Returns - **Tag** - The Tag instance with the given name. ``` -------------------------------- ### Authorize a Sextant Instance Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/applications/sextant.md Initializes a Sextant client instance using an AccessKey. The AccessKey can be obtained from the Graviti developer portal. ```APIDOC ## Authorize a Sextant Instance ### Description Initializes a Sextant client instance using an AccessKey. ### Method ```python Sextant("") ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python from tensorbay.apps.sextant import Sextant # Please visit `https://gas.graviti.com/tensorbay/developer` to get the AccessKey. sextant = Sextant("") ``` ### Response None ``` -------------------------------- ### Generate Fish Activation Script (Click 8.x) Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/tensorbay_cli/completion.md Generates the Fish completion script and saves it to `~/.config/fish/completions/gas.fish`. This file will be automatically loaded by Fish. ```fish _GAS_COMPLETE=fish_source gas > ~/.config/fish/completions/gas.fish ``` -------------------------------- ### FusionDatasetClient.get_or_create_segment Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/client/dataset.md Gets or creates a fusion segment with the specified name. ```APIDOC ## get_or_create_segment(name='default') ### Description Get or create a fusion segment with the given name. ### Parameters #### Parameters **name** (*str*) – The name of the fusion segment. ### Returns The created [`FusionSegmentClient`](segment.md#tensorbay.client.segment.FusionSegmentClient) with given name. ### Return type [*FusionSegmentClient*](segment.md#tensorbay.client.segment.FusionSegmentClient) ``` -------------------------------- ### Generate Fish Activation Script (Click 7.x) Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/tensorbay_cli/completion.md Generates the Fish completion script and saves it to `~/.config/fish/completions/gas-complete.fish`. This file will be automatically loaded by Fish. ```fish _GAS_COMPLETE=source_fish gas > ~/.config/fish/completions/gas-complete.fish ``` -------------------------------- ### Get Branch Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/features/version_control/branch.md Retrieves information about a specific branch by its name. ```APIDOC ## Get Branch ```python branch = dataset_client.get_branch("T123") ``` ``` -------------------------------- ### Initialize Keypoint2D from coordinates and visibility Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/geometry/keypoint.md Initialize a Keypoint2D object with its x, y coordinates and visibility status. ```python >>> Keypoint2D(1.0, 2.0, 0) Keypoint2D(1.0, 2.0, 0) ``` -------------------------------- ### Initialize SentenceSubcatalog Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/label/label_sentence.md Initialize SentenceSubcatalog using its constructor. Requires specifying sample-related information and lexicon. ```python >>> SentenceSubcatalog(True, 16000, [["mean", "m", "iy", "n"]]) SentenceSubcatalog( (is_sample): True, (sample_rate): 16000, (lexicon): [...] ) ``` -------------------------------- ### Get Benchmark by Name Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/apps/sextant.md Retrieve a specific benchmark instance by its name. ```APIDOC ## get_benchmark(name) ### Description Get a benchmark instance by name. ### Parameters - **name** (str) - Name of the Benchmark. ### Returns The Benchmark instance with the given name. ### Raises [**ResourceNotExistError**](../exception.md#tensorbay.exception.ResourceNotExistError) – When the required benchmark does not exist. ### Return type [*Benchmark*](#tensorbay.apps.sextant.Benchmark) ``` -------------------------------- ### Get Commit Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/features/version_control/draft_and_commit.md Retrieves a specific commit using its commit ID. ```APIDOC ## Get Commit ```python commit = dataset_client.get_commit(commit_id) ``` ``` -------------------------------- ### Initialize Dataset Object Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/quick_start/examples/DogsVsCats.md Instantiate a Dataset object to interact with the 'DogsVsCats' dataset. Requires an authenticated gas client. ```python dataset = Dataset("DogsVsCats", gas) ``` -------------------------------- ### Initialize and Configure Camera Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/sensor/sensor.md Initializes a Camera sensor, sets its extrinsic and intrinsic parameters, including translation, rotation, camera matrix, and distortion coefficients. ```python >>> from tensorbay.geometry import Vector3D >>> from numpy import quaternion >>> camera = Camera('Camera1') >>> translation = Vector3D(1, 2, 3) >>> rotation = quaternion(1, 2, 3, 4) >>> camera.set_extrinsics(translation=translation, rotation=rotation) >>> camera.set_camera_matrix(fx=1.1, fy=1.1, cx=1.1, cy=1.1) >>> camera.set_distortion_coefficients(p1=1.2, p2=1.2, k1=1.2, k2=1.2) >>> camera Camera("Camera1")( (extrinsics): Transform3D( (translation): Vector3D(1, 2, 3), (rotation): quaternion(1, 2, 3, 4) ), (intrinsics): CameraIntrinsics( (camera_matrix): CameraMatrix( (fx): 1.1, (fy): 1.1, (cx): 1.1, (cy): 1.1, (skew): 0 ), (distortion_coefficients): DistortionCoefficients( (p1): 1.2, (p2): 1.2, (k1): 1.2, (k2): 1.2 ) ) ) ``` -------------------------------- ### Get Draft Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/features/version_control/draft_and_commit.md Retrieves a specific draft using its draft number. ```APIDOC ## Get Draft ```python draft = dataset_client.get_draft(draft_number=1) ``` ``` -------------------------------- ### Get Evaluation Result Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/applications/sextant.md Fetches the detailed result of a specific evaluation. ```APIDOC ## Get Evaluation Result ### Description Retrieves the detailed results of an evaluation. ### Method `evaluation.get_result()` ### Endpoint N/A (SDK method) ### Parameters None ### Request Example ```python result = evaluation.get_result() ``` ### Response Returns a dictionary containing the evaluation results, including category-specific and overall metrics. ``` -------------------------------- ### Initialize empty RLESubcatalog and add attributes Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/label/label_polygon.md Create an empty RLESubcatalog and then add categories and attributes. This approach is useful for dynamic catalog construction. ```python >>> from tensorbay.label import CategoryInfo, AttributeInfo >>> rle_subcatalog = RLESubcatalog() >>> rle_subcatalog.is_tracking = True >>> rle_subcatalog.add_category("a") >>> rle_subcatalog.add_attribute("gender", enum=["female", "male"]) >>> rle_subcatalog RLESubcatalog( (is_tracking): True, (categories): NameList [...], (attributes): NameList [...] ) ``` -------------------------------- ### Get a Specific Tag Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/features/version_control/tag.md Retrieve information about a specific tag by its name. ```python tag = dataset_client.get_tag("Tag-1") ``` -------------------------------- ### Initialize Dataset Client and Create Commits Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/features/version_control/branch.md Before operating branches, a dataset client instance with existing commits is required. This snippet shows how to initialize the client and create initial commits for subsequent branch operations. ```python from tensorbay import GAS # Please visit `https://gas.graviti.com/tensorbay/developer` to get the AccessKey. gas = GAS("") dataset_client = gas.create_dataset("") dataset_client.create_draft("draft-1") # Add some data to the dataset. dataset_client.commit("commit-1", tag="V1") commit_id_1 = dataset_client.status.commit_id dataset_client.create_draft("draft-2") # Do some modifications to the dataset. dataset_client.commit("commit-2", tag="V2") commit_id_2 = dataset_client.status.commit_id ``` -------------------------------- ### Initialize and populate Keypoints2DSubcatalog Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/label/label_keypoints.md Initialize an empty Keypoints2DSubcatalog and then programmatically add categories, attributes, and keypoints. This approach is suitable for building a catalog dynamically. ```python from tensorbay.label import CategoryInfo, AttributeInfo, Keypoints2DSubcatalog, KeypointsInfo from tensorbay.utility import NameList categories = NameList() categories.append(CategoryInfo("a")) attributes = NameList() attributes.append(AttributeInfo("gender", enum=["female", "male"])) keypoints2d_subcatalog = Keypoints2DSubcatalog() keypoints2d_subcatalog.is_tracking = True keypoints2d_subcatalog.categories = categories keypoints2d_subcatalog.attributes = attributes keypoints2d_subcatalog.add_keypoints( 2, names=["L_shoulder", "R_Shoulder"], skeleton=[(0,1)], visible="BINARY", parent_categories="shoulder", description="12345", ) ``` -------------------------------- ### Get Rotation from Transform3D Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/geometry/transform.md Access the rotation component of a Transform3D object as a quaternion. ```python >>> transform = Transform3D(matrix=[[1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 1]]) >>> transform.rotation quaternion(1, -0, -0, -0) ``` -------------------------------- ### Get Translation from Transform3D Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/geometry/transform.md Access the translation component of a Transform3D object as a Vector3D. ```python >>> transform = Transform3D(matrix=[[1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 1]]) >>> transform.translation Vector3D(1, 1, 1) ``` -------------------------------- ### Initialize Box2DSubcatalog Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/label_format/CommonSubcatalogProperties.md Instantiate a Box2DSubcatalog, optionally enabling tracking information support. ```python >>> from tensorbay.label import Box2DSubcatalog >>> box2d_subcatalog = Box2DSubcatalog(is_tracking=True) >>> box2d_subcatalog Box2DSubcatalog( (is_tracking): True ) ``` -------------------------------- ### Get Tag Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/features/version_control/tag.md Retrieve information about a specific tag associated with a dataset commit. ```APIDOC ## Get Tag ```python tag = dataset_client.get_tag("Tag-1") ``` ``` -------------------------------- ### Initialize TensorBay Client Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/quick_start/examples/move_and_copy.md Initializes the TensorBay client using an access key and retrieves a dataset client. Ensure you have your access key and the dataset name. ```python from tensorbay import GAS gas = GAS("") dataset_client = gas.get_dataset("OxfordIIITPet") dataset_client.list_segment_names() # test, trainval ``` -------------------------------- ### SentenceSubcatalog Initialization and Usage Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/label_format/Sentence.md Demonstrates how to initialize SentenceSubcatalog and set its properties, including adding lexicon entries. ```APIDOC ## SentenceSubcatalog Before adding sentence labels to the dataset, [`SentenceSubcatalog`](../api/label/label_sentence.md#tensorbay.label.label_sentence.SentenceSubcatalog) should be defined. Besides [attributes information](CommonSubcatalogProperties.md#attributes-information) in [`SentenceSubcatalog`](../api/label/label_sentence.md#tensorbay.label.label_sentence.SentenceSubcatalog), it also has [`is_sample`](../api/label/label_sentence.md#tensorbay.label.label_sentence.SentenceSubcatalog.is_sample), [`sample_rate`](../api/label/label_sentence.md#tensorbay.label.label_sentence.SentenceSubcatalog.sample_rate) and [`lexicon`](../api/label/label_sentence.md#tensorbay.label.label_sentence.SentenceSubcatalog.lexicon). to describe the transcripted sentences of the audio. The catalog with only Sentence subcatalog is typically stored in a json file as follows: ```json { "SENTENCE": { * "isSample": ! -- Whether the unit of sampling points in Sentence label is the number of samples. The default value is false and the units are seconds. "sampleRate": -- Audio sampling frequency whose unit is Hz. It is required when "isSample" is true. "description": ! -- Subcatalog description, (default: ""). "attributes": [ -- Attribute list, which contains all attribute information. { "name": * -- Attribute name. "enum": [...], -- All possible options for the attribute. "type": -- Type of the attribute including "boolean", "integer", "number", "string", "array" and "null". And it is not required when "enum" is provided. "minimum": -- Minimum value of the attribute when type is "number". "maximum": -- Maximum value of the attribute when type is "number". "items": { -- Used only if the attribute type is "array". "enum": [...], -- All possible options for elements in the attribute array. "type": -- Type of elements in the attribute array. "minimum": -- Minimum value of elements in the attribute array when type is "number". "maximum": -- Maximum value of elements in the attribute array when type is "number". }, "description": ! -- Attribute description, (default: ""). }, ... ... ] "lexicon": [ -- A list consists all of text and phone. [ text, -- Word. phone, -- Corresponding phonemes. phone, -- Corresponding phonemes (A word can correspond to more than one phoneme). ... ], ... ] } } ``` #### NOTE `*` indicates that the field is required. `!` indicates that the field has a default value. Besides giving the parameters while initializing [`SentenceSubcatalog`](../api/label/label_sentence.md#tensorbay.label.label_sentence.SentenceSubcatalog), it’s also feasible to set them after initialization. ```python >>> from tensorbay.label import SentenceSubcatalog >>> sentence_subcatalog = SentenceSubcatalog() >>> sentence_subcatalog.is_sample = True >>> sentence_subcatalog.sample_rate = 5 >>> sentence_subcatalog.append_lexicon(["text", "spell", "phone"]) >>> sentence_subcatalog SentenceSubcatalog( (is_sample): True, (sample_rate): 5, (lexicon): [...] ) ``` To add a [`LabeledSentence`](../api/label/label_sentence.md#tensorbay.label.label_sentence.LabeledSentence) label to one data: ```python >>> from tensorbay.dataset import Data >>> data = Data("") >>> data.label.sentence = [] >>> data.label.sentence.append(sentence_label) ``` ``` -------------------------------- ### Unset TensorBay Configuration Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/tensorbay_cli/cli_commands.md Remove a specific configuration setting by its key, for example, 'editor'. ```bash $ gas config --unset editor ``` -------------------------------- ### Initialize and configure Polyline2DSubcatalog manually Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/label/label_polyline.md Create an empty Polyline2DSubcatalog and then programmatically add categories and attributes. This method provides more control during initialization, especially when building the catalog structure dynamically. ```python >>> from tensorbay.label import CategoryInfo, AttributeInfo >>> from tensorbay.utility import NameList >>> categories = NameList() >>> categories.append(CategoryInfo("a")) >>> attributes = NameList() >>> attributes.append(AttributeInfo("gender", enum=["female", "male"])) >>> polyline2d_subcatalog = Polyline2DSubcatalog() >>> polyline2d_subcatalog.is_tracking = True >>> polyline2d_subcatalog.is_beizer_curve = True >>> polyline2d_subcatalog.categories = categories >>> polyline2d_subcatalog.attributes = attributes >>> polyline2d_subcatalog Polyline2DSubcatalog( (is_beizer_curve): True, (is_tracking): True, (categories): NameList [...], (attributes): NameList [...] ) ``` -------------------------------- ### Set TensorBay Editor Configuration Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/tensorbay_cli/cli_commands.md Set the editor to be used by TensorBay, for example, 'vim'. ```bash $ gas config editor vim ``` -------------------------------- ### Sextant.list_benchmarks() Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/apps/index.md Lists all available benchmarks. ```APIDOC ## Sextant.list_benchmarks() ### Description Lists all available benchmarks. ### Method Not specified (likely a method call on a Sextant object) ### Endpoint Not applicable (SDK method) ### Parameters None explicitly documented. ### Request Example ```python sextant.list_benchmarks() ``` ### Response - **benchmarks** (list[Benchmark]) - A list of Benchmark objects. ``` -------------------------------- ### FusionSearchResult Operations Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/client/index.md Operations for FusionSearchResult, including listing frames and getting sensor information. ```APIDOC ## FusionSearchResult.list_frames() ### Description Lists the frames within the fusion search result. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters (Not specified in source) ### Request Example (Not specified in source) ### Response (Not specified in source) ## FusionSearchResult.get_sensors() ### Description Gets the sensor information for the fusion search result. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters (Not specified in source) ### Request Example (Not specified in source) ### Response (Not specified in source) ``` -------------------------------- ### Get Auth Storage Config Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/client/gas.md Retrieves a specific authentication storage configuration by its name. ```APIDOC ## get_auth_storage_config(name) ### Description Get the auth storage config with the given name. ### Parameters * **name** (*str*) – The required auth storage config name. ### Returns The auth storage config with the given name. * **Return type:** [*StorageConfig*](cloud_storage.md#tensorbay.client.cloud_storage.StorageConfig) ### Raises * **TypeError** – When the given auth storage config is illegal. * [**ResourceNotExistError**](../exception.md#tensorbay.exception.ResourceNotExistError) – When the required auth storage config does not exist. ``` -------------------------------- ### GAS Client Initialization Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/client/gas.md Initializes the GAS client for interacting with TensorBay. Requires an access key and optionally a URL. ```APIDOC ## GAS(access_key, url='') ### Description Initializes the GAS client for interacting between local and TensorBay. ### Parameters * **access_key** (*str*) – User’s access key. * **url** (*str*) – The host URL of the gas website. ``` -------------------------------- ### Get User Info Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/client/gas.md Retrieves user information associated with the current access key. ```APIDOC ## get_user() ### Description Get the user information with the current accesskey. ### Returns The [`struct.UserInfo`](struct.md#tensorbay.client.struct.UserInfo) with the current accesskey. * **Return type:** [*UserInfo*](struct.md#tensorbay.client.struct.UserInfo) ``` -------------------------------- ### Get a Specific Commit Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/features/version_control/draft_and_commit.md Retrieve details of a specific commit using its commit ID. ```python commit = dataset_client.get_commit(commit_id) ``` -------------------------------- ### InstanceMaskSubcatalog Initialization Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/label/label_mask.md Demonstrates two methods for initializing an InstanceMaskSubcatalog: from a dictionary using `loads()` and by adding categories and attributes programmatically. ```APIDOC ## InstanceMaskSubcatalog Initialization ### Description Demonstrates two methods for initializing an InstanceMaskSubcatalog: from a dictionary using `loads()` and by adding categories and attributes programmatically. ### Initialization Method 1: Using `loads()` ```python catalog = { "INSTANCE_MASK": { "categories": [ {'name': 'background', "categoryId": 0} ], "attributes": [{'name': 'occluded', 'type': 'boolean'}] } } InstanceMaskSubcatalog.loads(catalog["INSTANCE_MASK"]) ``` ### Initialization Method 2: Programmatic Addition ```python instance_mask_subcatalog = InstanceMaskSubcatalog() instance_mask_subcatalog.add_category("background", 0) instance_mask_subcatalog.add_attribute("occluded", type_="boolean") ``` ``` -------------------------------- ### Initialize and Populate PolygonSubcatalog Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/label/label_polygon.md Shows how to create an empty PolygonSubcatalog and then programmatically add categories and attributes. This approach is suitable for dynamically building catalog structures. ```python >>> from tensorbay.utility import NameList >>> from tensorbay.label import CategoryInfo, AttributeInfo >>> categories = NameList() >>> categories.append(CategoryInfo("a")) >>> attributes = NameList() >>> attributes.append(AttributeInfo("gender", enum=["female", "male"])) >>> polygon_subcatalog = PolygonSubcatalog() >>> polygon_subcatalog.is_tracking = True >>> polygon_subcatalog.categories = categories >>> polygon_subcatalog.attributes = attributes >>> polygon_subcatalog PolygonSubcatalog( (is_tracking): True, (categories): NameList [...], (attributes): NameList [...] ) ``` -------------------------------- ### Get a Specific Draft Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/features/version_control/draft_and_commit.md Retrieve details of a specific draft using its draft number. ```python draft = dataset_client.get_draft(draft_number=1) ``` -------------------------------- ### Show Specific TensorBay Configuration Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/tensorbay_cli/cli_commands.md Display the value of a specific configuration key, for example, 'editor'. ```bash $ gas config editor ``` -------------------------------- ### List Configured Storage Source: https://context7.com/graviti-ai/tensorbay-python-sdk/llms.txt List all storage configurations that have been set up with TensorBay. This helps in managing and verifying storage settings. ```python # List all configured storage configs for config in gas.list_auth_storage_configs(): print(config.name) ``` -------------------------------- ### Get Cloud Client Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/client/gas.md Retrieves a cloud client for interacting with a specified cloud storage configuration. ```APIDOC ## get_cloud_client(name) ### Description Get a cloud client used for interacting with cloud platform. ### Parameters * **name** (*str*) – The required auth storage config name. ### Returns The cloud client of this dataset. * **Return type:** [*CloudClient*](cloud_storage.md#tensorbay.client.cloud_storage.CloudClient) ``` -------------------------------- ### List Benchmarks Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/apps/sextant.md List all available benchmarks using the Sextant client. ```APIDOC ## list_benchmarks() ### Description List all benchmarks. ### Returns The list of Benchmark instances. ### Return type [*PagingList*](../client/lazy.md#tensorbay.client.lazy.PagingList)[[*Benchmark*](#tensorbay.apps.sextant.Benchmark)] ``` -------------------------------- ### Get BasicSearchJob Information Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/features/search/basic_search.md Access various details of a BasicSearchJob, including its status, results, and arguments. ```APIDOC ## Get Information Available BasicSearchJob information includes `title`, `description`, `job_id`, `arguments`, `created_at`, `started_at`, `finished_at`, `status`, `error_message` and `result`. ```python job.status job.result job.error_message job.arguments ``` ### Attributes * **title** (str) - The title of the search job. * **description** (str) - The description of the search job. * **job_id** (str) - The unique identifier for the search job. * **arguments** (dict) - The arguments used to create the search job. * **created_at** (str) - The timestamp when the job was created. * **started_at** (str) - The timestamp when the job started execution. * **finished_at** (str) - The timestamp when the job finished execution. * **status** (str) - The current status of the job (e.g., 'pending', 'running', 'completed', 'failed'). * **error_message** (str) - If the job failed, this contains the error message. * **result** (SearchResult or FusionSearchResult) - The result of the search job. This will be a `SearchResult` or `FusionSearchResult` object if the job completed successfully. ``` -------------------------------- ### List or Get Benchmark Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/applications/sextant.md Retrieve a list of all available benchmarks or fetch a specific benchmark by its name. ```python # list all benchmarks. benchmarks = sextant.list_benchmarks() # get benchmark with given name. benchmark = sextant.get_benchmark("test_01") ``` -------------------------------- ### Activate Fish Completion (Click 7.x) Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/tensorbay_cli/completion.md Place this command in `~/.config/fish/completions/gas.fish` to enable Fish tab completion for `gas` when using Click version 7.x. ```fish eval (env _GAS_COMPLETE=source_fish gas) ``` -------------------------------- ### Create OSS Storage Config Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/client/gas.md Creates an authentication storage configuration for Alibaba Cloud OSS. ```APIDOC ## create_oss_storage_config(name, file_path, *, endpoint, accesskey_id, accesskey_secret, bucket_name) ### Description Create an oss auth storage config. ### Parameters * **name** (*str*) – The required auth storage config name. * **file_path** (*str*) – dataset storage path of the bucket. * **endpoint** (*str*) – endpoint of the oss. * **accesskey_id** (*str*) – accesskey_id of the oss. * **accesskey_secret** (*str*) – accesskey_secret of the oss. * **bucket_name** (*str*) – bucket_name of the oss. ### Returns The cloud client of this dataset. * **Return type:** [*CloudClient*](cloud_storage.md#tensorbay.client.cloud_storage.CloudClient) ``` -------------------------------- ### Show Commit Logs from Revision Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/tensorbay_cli/cli_commands.md Retrieves commit logs starting from a specific revision of the dataset. ```bash $ gas log tb:@ ``` -------------------------------- ### Initialize and Configure MultiPolyline2DSubcatalog Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/label/label_polyline.md Create an empty `MultiPolyline2DSubcatalog` and then programmatically add tracking information, categories, and attributes. This is useful for dynamically building subcatalog configurations. ```python >>> from tensorbay.label import CategoryInfo, AttributeInfo >>> multi_polyline2d_subcatalog = MultiPolyline2DSubcatalog() >>> multi_polyline2d_subcatalog.is_tracking = True >>> multi_polyline2d_subcatalog.add_category(CategoryInfo("a")) >>> multi_polyline2d_subcatalog.add_attribute( AttributeInfo("gender", enum=["female", "male"])) >>> multi_polyline2d_subcatalog MultiPolyline2DSubcatalog( (is_tracking): True, (categories): NameList [...], (attributes): NameList [...] ) ``` -------------------------------- ### Creating a PanopticMask Label Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/label_format/PanopticMask.md Example of how to create a PanopticMask label object in Python using the TensorBay SDK. ```APIDOC ## Create PanopticMask Label ```python from tensorbay.label import PanopticMask panoptic_mask_label = PanopticMask(local_path="") panoptic_mask_label.all_category_ids = {1: 2, 2: 2} print(panoptic_mask_label) ``` ### NOTE In `PanopticMask`, the key and value of `all_category_ids` are instance ID and category ID, respectively, both of which should be integers. ``` -------------------------------- ### BasicSearchJob.result Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/client/job.md Gets the result of the BasicSearchJob. The result can be a SearchResult or FusionSearchResult, or None if the job has not completed or produced a result. ```APIDOC ## property BasicSearchJob.result ### Description Get the result of the BasicSearchJob. ### Returns The search result of the BasicSearchJob. ### Return type [*SearchResult*](search.md#tensorbay.client.search.SearchResult) | [*FusionSearchResult*](search.md#tensorbay.client.search.FusionSearchResult) | None ``` -------------------------------- ### Sextant Client Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/reference/api/apps/sextant.md Initialize the Sextant client to interact with the Graviti Marketplace's Sextant app. ```APIDOC ## Sextant ### Description This class defines the Sextant client for interacting with the Graviti Marketplace. ### Parameters - **access_key** (str) - User’s access key. - **url** (str) - The URL of the graviti gas website. Defaults to ''. ``` -------------------------------- ### Prepare and Upload Dataset Source: https://github.com/graviti-ai/tensorbay-python-sdk/blob/main/docs/source/quick_start/getting_started_with_tensorbay.md Organize local data into a TensorBay Dataset object, create segments, append data, and then upload it to TensorBay. Ensure to commit the changes for version control. ```python from tensorbay.dataset import Data, Dataset # Organize the local dataset by the "Dataset" class before uploading. dataset = Dataset("") # TensorBay uses "segment" to separate different parts in a dataset. segment = dataset.create_segment() segment.append(Data("0000001.jpg")) segment.append(Data("0000002.jpg")) dataset_client = gas.upload_dataset(dataset, jobs=8) # TensorBay provides dataset version control feature, commit the uploaded data before using it. dataset_client.commit("Initial commit") ```