D'autres exemples de AWS SDK sont disponibles dans le référentiel AWS Doc SDK Examples GitHub .
Les traductions sont fournies par des outils de traduction automatique. En cas de conflit entre le contenu d'une traduction et celui de la version originale en anglais, la version anglaise prévaudra.
Utilisation DescribeDataset
avec un AWS SDK
L'exemple de code suivant montre comment utiliserDescribeDataset
.
Pour plus d'informations, consultez la section Affichage de votre jeu de données.
- Python
-
- SDK pour 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.")