Hay más ejemplos de AWS SDK disponibles en el GitHub repositorio de ejemplos de AWS Doc SDK.
Las traducciones son generadas a través de traducción automática. En caso de conflicto entre la traducción y la version original de inglés, prevalecerá la version en inglés.
Úselo DescribeDataset con un SDK AWS
En el siguiente ejemplo de código, se muestra cómo utilizar DescribeDataset.
Para obtener información, consulte Visualizar su conjunto de datos.
- Python
-
- SDK para Python (Boto3)
-
class Datasets:
@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.")