Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.

Uporabite računalniški vid za merjenje donosa v kmetijstvu z oznakami po meri Amazon Rekognition

In the agriculture sector, the problem of identifying and counting the amount of fruit on trees plays an important role in crop estimation. The concept of renting and leasing a tree is becoming popular, where a tree owner leases the tree every year before the harvest based on the estimated fruit yeild. The common practice of manually counting fruit is a time-consuming and labor-intensive process. It’s one of the hardest but most important tasks in order to obtain better results in your crop management system. This estimation of the amount of fruit and flowers helps farmers make better decisions—not only on only leasing prices, but also on cultivation practices and plant disease prevention.

This is where an automated machine learning (ML) solution for computer vision (CV) can help farmers. Oznake po meri za ponovno odstranjevanje Amazon je popolnoma upravljana storitev računalniškega vida, ki razvijalcem omogoča izdelavo modelov po meri za razvrščanje in prepoznavanje predmetov na slikah, ki so specifične in edinstvene za vaše podjetje.

Rekognition Custom Labels ne zahteva, da imate predhodno strokovno znanje o računalniškem vidu. Začnete lahko tako, da preprosto naložite na desetine slik namesto na tisoče. Če so slike že označene, lahko začnete učiti model v samo nekaj klikih. Če ne, jih lahko označite neposredno v konzoli Rekognition Custom Labels ali uporabite Amazon SageMaker Ground Truth da jih označimo. Rekognition Custom Labels uporablja učenje prenosa za samodejno pregledovanje podatkov o usposabljanju, izbiro pravega ogrodja in algoritma modela, optimizacijo hiperparametrov in usposabljanje modela. Ko ste zadovoljni z natančnostjo modela, lahko začnete gostiti usposobljeni model s samo enim klikom.

In this post, we showcase how you can build an end-to-end solution using Rekognition Custom Labels to detect and count fruit to measure agriculture yield.

Pregled rešitev

We create a custom model to detect fruit using the following steps:

  1. Label a dataset with images containing fruit using Amazon SageMaker Ground Truth.
  2. Create a project in Rekognition Custom Labels.
  3. Import your labeled dataset.
  4. Usposobite model.
  5. Preizkusite nov model po meri s samodejno ustvarjeno končno točko API-ja.

Rekognition Custom Labels lets you manage the ML model training process on the Amazon Rekognition console, which simplifies the end-to-end model development and inference process.

Predpogoji

To create an agriculture yield measuring model, you first need to prepare a dataset to train the model with. For this post, our dataset is composed of images of fruit. The following images show some examples.

We sourced our images from our own garden. You can download the image files from the GitHub repo.

For this post, we only use a handful of images to showcase the fruit yield use case. You can experiment further with more images.

Za pripravo nabora podatkov izvedite naslednje korake:

  1. Ustvari Preprosta storitev shranjevanja Amazon (Amazon S3) vedro.
  2. Create two folders inside this bucket, called raw_data in test_data, to store images for labeling and model testing.
  3. Izberite Pošiljanje to upload the images to their respective folders from the GitHub repo.
    Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.

The uploaded images aren’t labeled. You label the images in the following step.

Label your dataset using Ground Truth

To train the ML model, you need labeled images. Ground Truth provides an easy process to label the images. The labeling task is performed by a human workforce; in this post, you create a private workforce. You can use Amazon Mehanični Turk for labeling at scale.

Ustvarite delovno silo za označevanje

Let’s first create our labeling workforce. Complete the following steps:

  1. Na konzoli SageMaker pod Ground Resuth v podoknu za krmarjenje izberite Označevanje delovne sile.
  2. o Zasebno izberite jeziček Ustvarite zasebno ekipo.
    Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.
  3. za Ime ekipe, enter a name for your workforce (for this post, labeling-team).
  4. Izberite Ustvarite zasebno ekipo.
    Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.
  5. Izberite Invite new workers.
    Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.
  6. v Add workers by email address section, enter the email addresses of your workers. For this post, enter your own email address.
  7. Izberite Povabite nove delavce.
    Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.

You have created a labeling workforce, which you use in the next step while creating a labeling job.

Ustvarite opravilo označevanja Ground Truth

To great your labeling job, complete the following steps:

  1. Na konzoli SageMaker pod Ground Resuth, izberite Označevanje delovnih mest.
  2. Izberite Ustvari nalogo za označevanje.
    Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.
  3. za Ime delovnega mesta, vnesite fruits-detection.
  4. Izberite Želim določiti ime atributa oznake, ki se razlikuje od imena opravila označevanja.
  5. za Ime atributa oznake¸ vnesite Labels.
  6. za Nastavitev vhodnih podatkovtako, da izberete Samodejna nastavitev podatkov.
  7. za Lokacija S3 za vhodne nize podatkov, enter the S3 location of the images, using the bucket you created earlier (s3://{your-bucket-name}/raw-data/images/).
  8. za S3 location for output datasetstako, da izberete Specify a new location and enter the output location for annotated data (s3://{your-bucket-name}/annotated-data/).
  9. za Vrsta podatkov, izberite Image.
  10. Izberite Complete data setup.
    This creates the image manifest file and updates the S3 input location path. Wait for the message “Input data connection successful.”
    Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.
  11. Razširi Dodatna konfiguracija.
  12. Potrdite Full dataset je izbran.
    This is used to specify whether you want to provide all the images to the labeling job or a subset of images based on filters or random sampling.
    Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.
  13. za Kategorija nalog, izberite Image because this is a task for image annotation.
  14. Because this is an object detection use case, for Izbor nalogtako, da izberete Omejitveni okvir.
  15. Ostale možnosti pustite privzete in izberite Naslednji.
    Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.
  16. Izberite Naslednji.
    Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.
    Now you specify your workers and configure the labeling tool.
  17. za Vrste delavcevtako, da izberete Zasebno.For this post, you use an internal workforce to annotate the images. You also have the option to select a public contractual workforce (Amazon Mechanical Turk) or a partner workforce (Vendor managed) depending on your use case.
  18. For Private teams¸ choose the team you created earlier.Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.
  19. Leave the other options as default and scroll down to Orodje za označevanje omejevalnih okvirjev.It’s essential to provide clear instructions here in the labeling tool for the private labeling team. These instructions acts as a guide for annotators while labeling. Good instructions are concise, so we recommend limiting the verbal or textual instructions to two sentences and focusing on visual instructions. In the case of image classification, we recommend providing one labeled image in each of the classes as part of the instructions.
  20. Add two labels: fruit in no_fruit.
  21. Enter detailed instructions in the Description field to provide instructions to the workers. For example: You need to label fruits in the provided image. Please ensure that you select label 'fruit' and draw the box around the fruit just to fit the fruit for better quality of label data. You also need to label other areas which look similar to fruit but are not fruit with label 'no_fruit'.You can also optionally provide examples of good and bad labeling images. You need to make sure that these images are publicly accessible.
  22. Izberite ustvarjanje to create the labeling job.
    Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.

After the job is successfully created, the next step is to label the input images.

Start the labeling job

Once you have successfully created the job, the status of the job is InProgress. This means that the job is created and the private workforce is notified via email regarding the task assigned to them. Because you have assigned the task to yourself, you should receive an email with instructions to log in to the Ground Truth Labeling project.

Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.

  1. Open the email and choose the link provided.
  2. Enter the user name and password provided in the email.
    You may have to change the temporary password provided in the email to a new password after login.
  3. After you log in, select your job and choose Začni delati.
    Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.
    You can use the provided tools to zoom in, zoom out, move, and draw bounding boxes in the images.
  4. Choose your label (fruit or no_fruit) and then draw a bounding box in the image to annotate it.
  5. Ko končate, izberite Prijave se.

Now you have correctly labeled images that will be used by the ML model for training.

Create your Amazon Rekognition project

To create your agriculture yield measuring project, complete the following steps:

  1. Na konzoli Amazon Rekogservation izberite Oznake po meri.
  2. Izberite Odkrij več.
  3. za Ime Projekta, vnesite fruits_yield.
  4. Izberite Ustvarite projekt.
    Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.

Projekt lahko ustvarite tudi na projekti stran. Dostopate lahko do projekti page via the navigation pane. The next step is to provide images as input.

Uvozite svoj nabor podatkov

To create your agriculture yield measuring model, you first need to import a dataset to train the model with. For this post, our dataset is already labeled using Ground Truth.

  1. za Uvozi sliketako, da izberete Uvozite slike, označene s SageMaker Ground Truth.
    Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.
  2. za Manifest file location, enter the S3 bucket location of your manifest file (s3://{your-bucket-name}/fruits_image/annotated_data/fruits-labels/manifests/output/output.manifest).
  3. Izberite Ustvari nabor podatkov.
    Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.

You can see your labeled dataset.

Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.

Now you have your input dataset for the ML model to start training on them.

Usposobite svoj model

Ko označite svoje slike, ste pripravljeni usposobiti svoj model.

  1. Izberite Model vlaka.
  2. za Izberite projekt, choose your project fruits_yield.
  3. Izberite Model vlaka.
    Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.

Wait for the training to complete. Now you can start testing the performance for this trained model.

Preizkusite svoj model

Your agriculture yield measuring model is now ready for use and should be in the Running state. To test the model, complete the following steps:

Step 1 : Start the model

On your model details page, on the Uporabi model izberite jeziček Začetek.
Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.
Rekognition Custom Labels also provides the API calls for starting, using, and stopping your model.

Step 2 : Test the model

When the model is in the Running state, you can use the sample testing script analyzeImage.py to count the amount of fruit in an image.

  1. Download this script from of the GitHub repo.
  2. Edit this file to replace the parameter bucket with your bucket name and model with your Amazon Rekognition model ARN.

We use the parameters photo in min_confidence as input for this Python script.

Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.

You can run this script locally using the Vmesnik ukazne vrstice AWS (AWS CLI) or using AWS CloudShell. In our example, we ran the script via the CloudShell console. Note that CloudShell is brezplačno za uporabo.

Make sure to install the required dependences using the command pip3 install boto3 PILLOW če še ni nameščen.
Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.

  1. Naložite datoteko analyzeImage.py to CloudShell using the Proces meni.
    Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.

The following screenshot shows the output, which detected two fruits in the input image. We supplied 15.jpeg as the photo argument and 85 as the min_confidence vrednost.

Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.

The following example shows image 15.jpeg with two bounding boxes.

Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.

You can run the same script with other images and experiment by changing the confidence score further.

Step 3:  Stop the model

When you’re done, remember to stop model to avoid incurring in unnecessary charges. On your model details page, on the Use model tab, choose Stop.

Čiščenje

To avoid incurring unnecessary charges, delete the resources used in this walkthrough when not in use. We need to delete the Amazon Rekognition project and the S3 bucket.

Delete the Amazon Rekognition project

To delete the Amazon Rekognition project, complete the following steps:

  1. Na konzoli Amazon Rekogservation izberite Uporabite oznake po meri.
  2. Izberite Začnite.
  3. V podoknu za krmarjenje izberite projekti.
  4. o projekti page, select the project that you want to delete.
    1. Izberite Brisanje.
      O Izbriši projekt se prikaže pogovorno okno.
  5. If the project has no associated models:
    1. Vnesite odstrani to delete the project.
    2. Izberite Brisanje to delete the project.
  6. If the project has associated models or datasets:
    1. Vnesite odstrani to confirm that you want to delete the model and datasets.
    2. Izberi bodisi Delete associated models, Delete associated datasetsali Izbrišite povezane nabore podatkov in modele, depending on whether the model has datasets, models, or both.

    Model deletion might take a while to complete. Note that the Amazon Rekognition console can’t delete models that are in training or running. Try again after stopping any running models that are listed, and wait until the models listed as training are complete. If you close the dialog box during model deletion, the models are still deleted. Later, you can delete the project by repeating this procedure.

  7. Vnesite odstrani to confirm that you want to delete the project.
  8. Izberite Brisanje to delete the project.

Delete your S3 bucket

You first need to empty the bucket and then delete it.

  1. o Amazon S3 konzolo, izberite Žlice.
  2. Select the bucket that you want to empty, then choose prazna.
  3. Confirm that you want to empty the bucket by entering the bucket name into the text field, then choose prazna.
  4. Izberite Brisanje.
  5. Confirm that you want to delete the bucket by entering the bucket name into the text field, then choose Izbriši vedro.

zaključek

In this post, we showed you how to create an object detection model with Rekognition Custom Labels. This feature makes it easy to train a custom model that can detect an object class without needing to specify other objects or losing accuracy in its results.

Če želite več informacij o uporabi oznak po meri, glejte Kaj so nalepke po meri Amazon Rekogservation?


O avtorjih

Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.Dhiraj Thakur je arhitekt rešitev pri Amazon Web Services. Sodeluje s strankami in partnerji AWS, da bi zagotovil smernice o sprejemanju oblaka v podjetju, migraciji in strategiji. Navdušen je nad tehnologijo in uživa v gradnji in eksperimentiranju na področju analitike in AI/ML.

Uporabite računalniški vid za merjenje donosa v kmetijstvu z Amazon Rekognition Custom Labels PlatoBlockchain Data Intelligence. Navpično iskanje. Ai.Sameer Goel is a Sr. Solutions Architect in the Netherlands, who drives customer success by building prototypes on cutting-edge initiatives. Prior to joining AWS, Sameer graduated with a master’s degree from Boston, with a concentration in data science. He enjoys building and experimenting with AI/ML projects on Raspberry Pi. You can find him on LinkedIn.

Časovni žig:

Več od Strojno učenje AWS