终止支持通知:2025年10月31日, AWS 将停止对亚马逊 Lookout for Vision 的支持。2025 年 10 月 31 日之后,你将无法再访问 Lookout for Vision 主机或 Lookout for Vision 资源。如需更多信息,请访问此博客文章。
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
查看您的数据集
一个项目可以有单个数据集,用于训练和测试模型。或者,您可以使用单独的训练数据集和测试数据集。您可以使用控制台查看自己的数据集。您还可以使用 DescribeDataset 操作来获取与数据集(训练或测试)有关的信息。
        查看项目中的数据集(控制台)
        执行以下过程中的步骤,可以在控制台中查看项目的数据集。
        
     
        查看项目中的数据集(SDK)
        您可以使用 DescribeDataset 操作,获取与项目关联的训练或测试数据集的信息。
        查看您的数据集(SDK)
- 
                            如果您尚未这样做,请安装并配置 AWS CLI 和 AWS SDKs。有关更多信息,请参阅 第 4 步:设置 AWS CLI 和 AWS SDKs。 
- 使用以下示例代码查看数据集。 - 
                    - CLI
-   
                            更改以下值: aws lookoutvision describe-dataset --project-name project name\
  --dataset-typetrain or test\
  --profile lookoutvision-access
 
- Python
- 
                            此代码取自 AWS 文档 SDK 示例 GitHub 存储库。请在此处查看完整示例。     @staticmethod
    def describe_dataset(lookoutvision_client, project_name, dataset_type):
        """
        Gets information about a Lookout for Vision dataset.
        :param lookoutvision_client: A Boto3 Lookout for Vision client.
        :param project_name: The name of the project that contains the dataset that
                             you want to describe.
        :param dataset_type: The type (train or test) of the dataset that you want
                             to describe.
        """
        try:
            response = lookoutvision_client.describe_dataset(
                ProjectName=project_name, DatasetType=dataset_type
            )
            print(f"Name: {response['DatasetDescription']['ProjectName']}")
            print(f"Type: {response['DatasetDescription']['DatasetType']}")
            print(f"Status: {response['DatasetDescription']['Status']}")
            print(f"Message: {response['DatasetDescription']['StatusMessage']}")
            print(f"Images: {response['DatasetDescription']['ImageStats']['Total']}")
            print(f"Labeled: {response['DatasetDescription']['ImageStats']['Labeled']}")
            print(f"Normal: {response['DatasetDescription']['ImageStats']['Normal']}")
            print(f"Anomaly: {response['DatasetDescription']['ImageStats']['Anomaly']}")
        except ClientError:
            logger.exception("Service error: problem listing datasets.")
            raise
        print("Done.")
 
- Java V2
- 
                            此代码取自 AWS 文档 SDK 示例 GitHub 存储库。请在此处查看完整示例。 /**
 * Gets the description for a Amazon Lookout for Vision dataset.
 * 
 * @param lfvClient   An Amazon Lookout for Vision client.
 * @param projectName The name of the project in which you want to describe a
 *                    dataset.
 * @param datasetType The type of the dataset that you want to describe (train
 *                    or test).
 * @return DatasetDescription A description of the dataset.
 */
public static DatasetDescription describeDataset(LookoutVisionClient lfvClient,
                String projectName,
                String datasetType) throws LookoutVisionException {
        logger.log(Level.INFO, "Describing {0} dataset for project {1}",
                        new Object[] { datasetType, projectName });
        DescribeDatasetRequest describeDatasetRequest = DescribeDatasetRequest.builder()
                        .projectName(projectName)
                        .datasetType(datasetType)
                        .build();
        DescribeDatasetResponse describeDatasetResponse = lfvClient.describeDataset(describeDatasetRequest);
        DatasetDescription datasetDescription = describeDatasetResponse.datasetDescription();
        logger.log(Level.INFO, "Project: {0}\n"
                        + "Created: {1}\n"
                        + "Type: {2}\n"
                        + "Total: {3}\n"
                        + "Labeled: {4}\n"
                        + "Normal: {5}\n"
                        + "Anomalous: {6}\n",
                        new Object[] {
                                        datasetDescription.projectName(),
                                        datasetDescription.creationTimestamp(),
                                        datasetDescription.datasetType(),
                                        datasetDescription.imageStats().total().toString(),
                                        datasetDescription.imageStats().labeled().toString(),
                                        datasetDescription.imageStats().normal().toString(),
                                        datasetDescription.imageStats().anomaly().toString(),
                        });
        return datasetDescription;
}