Creazione di un progetto - Rekognition

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

Creazione di un progetto

Un progetto gestisce le versioni del modello, il set di dati di addestramento e il set di dati di test per un modello. Puoi creare un progetto con la console Amazon Rekognition Custom Labels o con l'API. Per altre attività del progetto, ad esempio l'eliminazione di un progetto, vedereGestione un progetto Amazon Rekognition Custom Labels.

Creazione di un progetto Amazon Rekognition Custom Labels (console)

Puoi utilizzare la console Amazon Rekognition Custom Labels per creare un progetto. La prima volta che usi la console in una nuovaAWS regione, Amazon Rekognition Custom Labels chiede di creare un bucket Amazon S3 (bucket console) nel tuoAWS account. Il bucket viene utilizzato per archiviare i file di progetto. Non puoi utilizzare la console Amazon Rekognition Custom Labels a meno che non viene creato il bucket della console.

Puoi utilizzare la console Amazon Rekognition Custom Labels per creare un progetto.

Per creare un progetto (console)
  1. Accedere aAWS Management Console e aprire la console Amazon Rekognition all'indirizzo https://console.aws.amazon.com/rekognition/.

  2. Nel riquadro a sinistra, scegliere Usa etichette personalizzate. Viene visualizzata la pagina iniziale delle etichette personalizzate di Amazon Rekognition.

  3. Nella landing page di Amazon Rekognition Custom Labels, scegli Inizia.

  4. Nel riquadro a sinistra, scegliere Progetti.

  5. Scegliere Create project (Crea progetto).

  6. In Project name (Nome progetto) immettere un nome per il progetto.

  7. Scegli Crea progetto per creare il tuo progetto.

  8. Segui i passaggiCreazione di dataset di addestramento e test per creare i set di dati di formazione e test per il tuo progetto.

Creazione di un progetto Amazon Rekognition Custom Labels (SDK)

Puoi creare un progetto Amazon Rekognition Custom Labels chiamando CreateProject. La risposta è un Amazon Resource Name (Amazon Resource Name) che identifica il progetto. Dopo aver creato un progetto, si creano set di dati per addestrare e testare un modello. Per ulteriori informazioni, consulta Creazione di dataset di addestramento e test con immagini.

Per creare un progetto (SDK)
  1. Se non l'hai ancora fatto, installa e configura l'AWS CLIeliminazioneAWS delle unità. Per ulteriori informazioni, consulta Passaggio 4: Configurazione di AWS CLI e SDK AWS.

  2. Usa il seguente codice per creare un progetto.

    AWS CLI

    L'esempio seguente crea un progetto e ne visualizza l'ARN.

    Cambia il valoreproject-name di con il nome del progetto che desideri creare.

    aws rekognition create-project --project-name my_project \ --profile custom-labels-access
    Python

    L'esempio seguente crea un progetto e ne visualizza l'ARN. Fornisci i seguenti argomenti della riga di comando:

    • project_name— il nome del progetto che desideri creare.

    # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 import argparse import logging import boto3 from botocore.exceptions import ClientError logger = logging.getLogger(__name__) def create_project(rek_client, project_name): """ Creates an Amazon Rekognition Custom Labels project :param rek_client: The Amazon Rekognition Custom Labels Boto3 client. :param project_name: A name for the new prooject. """ try: #Create the project. logger.info("Creating project: %s",project_name) response=rek_client.create_project(ProjectName=project_name) logger.info("project ARN: %s",response['ProjectArn']) return response['ProjectArn'] except ClientError as err: logger.exception("Couldn't create project - %s: %s", project_name, err.response['Error']['Message']) raise def add_arguments(parser): """ Adds command line arguments to the parser. :param parser: The command line parser. """ parser.add_argument( "project_name", help="A name for the new project." ) def main(): logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s") try: # Get command line arguments. parser = argparse.ArgumentParser(usage=argparse.SUPPRESS) add_arguments(parser) args = parser.parse_args() print(f"Creating project: {args.project_name}") # Create the project. session = boto3.Session(profile_name='custom-labels-access') rekognition_client = session.client("rekognition") project_arn=create_project(rekognition_client, args.project_name) print(f"Finished creating project: {args.project_name}") print(f"ARN: {project_arn}") except ClientError as err: logger.exception("Problem creating project: %s", err) print(f"Problem creating project: {err}") if __name__ == "__main__": main()
    Java V2

    L'esempio seguente crea un progetto e ne visualizza l'ARN.

    Fornisci il seguente argomento della riga di comando:

    • project_name— il nome del progetto che desideri creare.

    /* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package com.example.rekognition; import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.rekognition.RekognitionClient; import software.amazon.awssdk.services.rekognition.model.CreateProjectRequest; import software.amazon.awssdk.services.rekognition.model.CreateProjectResponse; import software.amazon.awssdk.services.rekognition.model.RekognitionException; import java.util.logging.Level; import java.util.logging.Logger; public class CreateProject { public static final Logger logger = Logger.getLogger(CreateProject.class.getName()); public static String createMyProject(RekognitionClient rekClient, String projectName) { try { logger.log(Level.INFO, "Creating project: {0}", projectName); CreateProjectRequest createProjectRequest = CreateProjectRequest.builder().projectName(projectName).build(); CreateProjectResponse response = rekClient.createProject(createProjectRequest); logger.log(Level.INFO, "Project ARN: {0} ", response.projectArn()); return response.projectArn(); } catch (RekognitionException e) { logger.log(Level.SEVERE, "Could not create project: {0}", e.getMessage()); throw e; } } public static void main(String[] args) { final String USAGE = "\n" + "Usage: " + "<project_name> <bucket> <image>\n\n" + "Where:\n" + " project_name - A name for the new project\n\n"; if (args.length != 1) { System.out.println(USAGE); System.exit(1); } String projectName = args[0]; String projectArn = null; ; try { // Get the Rekognition client. RekognitionClient rekClient = RekognitionClient.builder() .credentialsProvider(ProfileCredentialsProvider.create("custom-labels-access")) .region(Region.US_WEST_2) .build(); // Create the project projectArn = createMyProject(rekClient, projectName); System.out.println(String.format("Created project: %s %nProject ARN: %s", projectName, projectArn)); rekClient.close(); } catch (RekognitionException rekError) { logger.log(Level.SEVERE, "Rekognition client error: {0}", rekError.getMessage()); System.exit(1); } } }
  3. Nota il nome dell'ARN del progetto visualizzato nella risposta. Sarà necessario per creare un modello.

  4. Segui i passaggiCreare dataset di addestramento e test (SDK) per creare i set di dati di formazione e test per il tuo progetto.