Tüm Ürünler
Search
Belge Merkezi

Intelligent Media Management:Create a dataset

Son Güncelleme:Oct 05, 2026

Veri kümesi, meta verileri depolamak ve yönetmek için kullanılan bir konteynerdir. Bu konuda veri kümesinin nasıl oluşturulacağı açıklanmaktadır.

Kullanım notları

  • İlişkili olmayan dosyaları farklı veri kümelerinde, ilişkili dosyaları ise aynı veri kümesinde saklayın.

  • Bir projedeki veri kümesi sayısı, projenin sınırını aşamaz.

  • Bir veri kümesindeki dosya sayısı, bu veri kümesinin sınırını aşamaz. Bir projedeki tüm veri kümelerindeki toplam dosya sayısı da projenin sınırını aşamaz.

  • Bir veri kümesine bağlı olan paket sayısı, bu veri kümesinin sınırını aşamaz. Bir projedeki tüm veri kümelerine bağlı toplam paket sayısı da projenin sınırını aşamaz.

  • Meta veri dizini oluştururken, veri kümesinin iş akışı şablonu projenin iş akışı şablonuna göre önceliklidir. Veri kümesinde bir iş akışı şablonu yoksa IMM projenin şablonunu kullanır. İş akışı şablonları hakkında daha fazla bilgi için bkz. İş akışı şablonları ve operatörler.

Ön koşullar

  • Bir AccessKey çifti oluşturdunuz. Daha fazla bilgi için bkz. AccessKey çifti oluşturun.

  • OSS hizmetini etkinleştirdiniz, bir paket oluşturdunuz ve pakete dosyalar yüklediniz. Daha fazla bilgi için bkz. Dosyaları yükleyin.

  • IMM hizmetini etkinleştirdiniz. Daha fazla bilgi için bkz. IMM'i etkinleştirin.

  • IMM konsolunda bir proje oluşturdunuz. Daha fazla bilgi için bkz. Proje oluşturun.

    Not
    • Proje oluşturmak için CreateProject API işlemini de çağırabilirsiniz. Daha fazla bilgi için bkz. Proje oluşturun.

    • Belirtilen bir bölgedeki tüm projeleri listelemek için ListProjects API işlemini çağırabilirsiniz.

Yordam

1. Adım: Veri kümesi oluşturma

Bu örnekte, test-project projesinde test-dataset adlı, Dataset 1 açıklamasına sahip ve Official:ImageManagement şablonunu kullanan bir veri kümesi oluşturmak için CreateDataset API işlemi çağrılır.

  • Örnek istek

    {
     "ProjectName": "test-project",
     "DatasetName": "test-dataset",
     "Description": "Dataset 1",
     "TemplateId": "Official:ImageManagement"
    }
  • Örnek yanıt

    {
        "RequestId": "9AB4BD43-C4E5-06AA-A7AB-****",
        "Dataset": {
            "FileCount": 0,
            "BindCount": 0,
            "ProjectName": "test-project",
            "CreateTime": "2022-07-05T10:43:32.429344821+08:00",
            "DatasetMaxTotalFileSize": 90000000000000000,
            "DatasetMaxRelationCount": 100000000000,
            "DatasetMaxFileCount": 100000000,
            "DatasetName": "test-dataset",
            "DatasetMaxBindCount": 10,
            "UpdateTime": "2022-07-05T10:43:32.429344821+08:00",
            "DatasetMaxEntityCount": 10000000000,
            "TotalFileSize": 0,
            "TemplateId": "Official:ImageManagement"
        }
    }
  • Tam örnek kod (Python SDK v1.27.3)

    # -*- coding: utf-8 -*-
    
    import os
    from alibabacloud_imm20200930.client import Client as imm20200930Client
    from alibabacloud_tea_openapi import models as open_api_models
    from alibabacloud_imm20200930 import models as imm_20200930_models
    from alibabacloud_tea_util import models as util_models
    from alibabacloud_tea_util.client import Client as UtilClient
    
    class Sample:
        def __init__(self):
            pass
    
        @staticmethod
        def create_client(
            access_key_id: str,
            access_key_secret: str,
        ) -> imm20200930Client:
            """
            Use your AccessKey ID and AccessKey secret to initialize the client.
            @param access_key_id:
            @param access_key_secret:
            @return: Client
            @throws Exception
            """
            config = open_api_models.Config(
                access_key_id=access_key_id,
                access_key_secret=access_key_secret
            )
            # Specify the endpoint.
            config.endpoint = f'imm.cn-shenzhen.aliyuncs.com'
            return imm20200930Client(config)
    
        @staticmethod
        def main() -> None:
            # An Alibaba Cloud account AccessKey pair can perform all API operations. For security, we recommend using a RAM user for API access or routine O&M.
            # Do not hard-code your AccessKey ID and AccessKey secret in the code. This practice can lead to security risks if the keys are leaked.
            # This example retrieves an AccessKey pair from environment variables for authentication. For more information about how to configure environment variables, see https://www.alibabacloud.com/help/document_detail/2361894.html.
            imm_access_key_id = os.getenv("AccessKeyId")
            imm_access_key_secret = os.getenv("AccessKeySecret")
            client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
            create_dataset_request = imm_20200930_models.CreateDatasetRequest(
                project_name='test-project',
                dataset_name='test-dataset',
                description='Dataset 1',
                template_id='Official:ImageManagement'
            )
            runtime = util_models.RuntimeOptions()
            try:
                # Print the response of the API operation.
                response = client.create_dataset_with_options(create_dataset_request, runtime)
                print(response.body.to_map())
            except Exception as error:
                # Print the error message if an error occurs.
                UtilClient.assert_as_string(error.message)
                print(error)
    
    if __name__ == '__main__':
        Sample.main()

(İsteğe bağlı) 2. Adım: Veri kümesini sorgulama

Bu örnekte, test-project projesindeki test-dataset adlı veri kümesini sorgulamak için GetDataset API işlemi çağrılır.

  • Örnek istek

    {
     "ProjectName": "test-project",
     "DatasetName": "test-dataset"
    }
  • Örnek yanıt

    {
        "RequestId": "9AB4BD43-C4E5-06AA-E4B2-****",
        "Dataset": {
            "FileCount": 0,
            "BindCount": 0,
            "ProjectName": "test-project",
            "CreateTime": "2022-07-05T10:43:32.429344821+08:00",
            "DatasetMaxTotalFileSize": 90000000000000000,
            "DatasetMaxRelationCount": 100000000000,
            "DatasetMaxFileCount": 100000000,
            "DatasetName": "test-dataset",
            "DatasetMaxBindCount": 10,
            "UpdateTime": "2022-07-05T10:43:32.429344821+08:00",
            "DatasetMaxEntityCount": 10000000000,
            "TotalFileSize": 0,
            "TemplateId": "Official:ImageManagement"
        }
    }
  • Tam örnek kod (Python SDK v1.27.3)

    # -*- coding: utf-8 -*-
    
    import os
    from alibabacloud_imm20200930.client import Client as imm20200930Client
    from alibabacloud_tea_openapi import models as open_api_models
    from alibabacloud_imm20200930 import models as imm_20200930_models
    from alibabacloud_tea_util import models as util_models
    from alibabacloud_tea_util.client import Client as UtilClient
    
    class Sample:
        def __init__(self):
            pass
    
        @staticmethod
        def create_client(
            access_key_id: str,
            access_key_secret: str,
        ) -> imm20200930Client:
            """
            Use your AccessKey ID and AccessKey secret to initialize the client.
            @param access_key_id:
            @param access_key_secret:
            @return: Client
            @throws Exception
            """
            config = open_api_models.Config(
                access_key_id=access_key_id,
                access_key_secret=access_key_secret
            )
            # Specify the endpoint.
            config.endpoint = f'imm.cn-shenzhen.aliyuncs.com'
            return imm20200930Client(config)
    
        @staticmethod
        def main() -> None:
            # An Alibaba Cloud account AccessKey pair can perform all API operations. For security, we recommend using a RAM user for API access or routine O&M.
            # Do not hard-code your AccessKey ID and AccessKey secret in the code. This practice can lead to security risks if the keys are leaked.
            # This example retrieves an AccessKey pair from environment variables for authentication. For more information about how to configure environment variables, see https://www.alibabacloud.com/help/document_detail/2361894.html.
            imm_access_key_id = os.getenv("AccessKeyId")
            imm_access_key_secret = os.getenv("AccessKeySecret")
            client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
            get_dataset_request = imm_20200930_models.GetDatasetRequest(
                # Specify the name of the IMM project.
                project_name='test-project',
                # Specify the name of the dataset.
                dataset_name='test-dataset',
                # Do not return statistics, such as the number of files and total file size.
                with_statistics=False
            )
            runtime = util_models.RuntimeOptions()
            try:
                # Print the response of the API operation.
                response = client.get_dataset_with_options(get_dataset_request, runtime)
                print(response.body.to_map())
            except Exception as error:
                # Print the error message if an error occurs.
                UtilClient.assert_as_string(error.message)
                print(error)
    
    if __name__ == '__main__':
        Sample.main()