支援終止通知:在 2025 年 10 月 31 日, AWS 將停止對 Amazon Lookout for Vision 的支援。2025 年 10 月 31 日之後,您將無法再存取 Lookout for Vision 主控台或 Lookout for Vision 資源。如需詳細資訊,請造訪此部落格文章。
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
檢視資料集
專案可以有一個資料集,用於訓練和測試模型。或者,您可以有單獨的訓練和測試資料集。您可以使用 主控台來檢視資料集。您也可以使用 DescribeDataset
操作來取得資料集 (訓練或測試) 的相關資訊。
檢視專案中的資料集 (主控台)
執行下列程序的步驟,在主控台中檢視專案的資料集。
檢視專案中的資料集 (SDK)
您可以使用 DescribeDataset
操作來取得與專案相關聯的訓練或測試資料集的相關資訊。
檢視資料集 (SDK)
-
如果您尚未這麼做,請安裝並設定 AWS CLI 和 AWS SDKs。如需詳細資訊,請參閱步驟 4:設定 AWS CLI 和 SDK AWS SDKs。
使用下列範例程式碼來檢視資料集。
- CLI
-
變更下列值:
aws lookoutvision describe-dataset --project-name project name
\
--dataset-type train 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;
}