Search Result#

Search Result from Dataset#

TensorBay SDK allows create SearchResult via BasicSearchJob.

from tensorbay import GAS

# Please visit `https://gas.graviti.com/tensorbay/developer` to get the AccessKey.
gas = GAS("<YOUR_ACCESSKEY>")
dataset_client = gas.get_dataset("<DATASET_NAME>")

job = dataset_client.basic_search.create_job(
    title="search example",
    description="search description",
    conjunction="and",
    unit="file",
    filters=[
        (
            "category",
            "in",
            [
                "human.pedestrian.adult",
                "human.pedestrian.child",
                "human.pedestrian.construction_worker",
            ],
            "BOX3D",
        ),
        ("size", ">", 0),
        ("withLabel", "=", True),
        ("attribute", "in", {"attribute_1": [True, False], "attribute_2": [1, 2]}, "BOX3D"),
    ],
)
search_result = job.result

Get Label Statistics#

The label statistics of the search result can be obtained by get_label_statistics()

search_result.get_label_statistics()

List Segment Names#

All segment names can be obtained by list_segment_names()

search_result.list_segment_names()

List Data#

Required data of the specific segment can be obtained by list_data()

search_result.list_data(segment_name="<SEGMENT_NAME>")

Search Result from Fusion Dataset#

TensorBay SDK allows create FusionSearchResult via BasicSearchJob.

fusion_dataset_client = gas.get_dataset("<DATASET_NAME>", is_fusion=True)

job = dataset_client.basic_search.create_job(
    title="search example",
    description="search description",
    conjunction="and",
    unit="frame",
    filters=[
        ("sensor", "in", ["CAM_BACK_RIGHT", "CAM_FRONT"]),
        ("size", ">", 0),
        ("withLabel", "=", True),
        ("attribute", "in", {"attribute_1": [True, False], "attribute_2": [1, 2]}, "BOX3D"),
    ],
)
fusion_search_result = job.result

FusionSearchResult can also get label statistics and list segment names in the same way as searchResult.

fusion_search_result.get_label_statistics()

fusion_search_result.list_segment_names()

List Frames#

Required frames of the specific segment can be obtained by list_frames()

fusion_search_result.list_frames(segment_name="<SEGMENT_NAME>")

Get Sensors#

The sensors of the specific segment can be obtained by get_sensors()

fusion_search_result.get_sensors(segment_name="<SEGMENT_NAME>")