Object Detection Using Yolov5

Introduction

This article describes how to build and test Object Detection using the Yolov5 algorithm in Fortanix Confidential AI.

Prerequisites

  • An image for object detection. Image can be in the format: bmp, jpg, jpeg, png, tif, tiff, dng.
  • A user signed in to a Confidential AI account.

For instructions to sign up and log in, refer to our User’s guide: Sign up for Confidential AI.

Building the Model

Data Ingestion

  1. On the Data Ingestion page, click CREATE DATASET, and select Image Dataset. Yolov_createdataset.pngFigure 1: Create image dataset
  2. Dataset name - Enter a name for your dataset. 
  3. Select the Upload a file option if you want to upload your data directly to the Fortanix Confidential AI platform.
  4. In the File Upload section, upload the image file.
  5. To track what the data is used for; you can optionally add Labels in the form of “Key:Value” pairs.
  6. Click CREATE DATASET to save the data. Yolov_createdataset1.pngFigure 2: Create image dataset
    The following input image is uploaded in this example.
    Yolov_image.pngFigure 3: Image dataset
  7. You will now see the saved dataset in the dataset table.
NOTE
For image datasets, the Fortanix Confidential AI Data Preparation, and Build Model phases are not applicable.

Data Inference

In this stage, the data is passed through a machine learning model to identify and predict the objects in the image.

  1. In the INFERENCE tab, click BUILD INFERENCE to predict the data output.
  2. In the Build Inference form, enter the Inference flow name, that is, the name of the inference model.
  3. In the Select model section, select FORTANIX, and then select Object detection algorithm from the drop down.
  4. In the Select input dataset field, select the input dataset you created in the first phase that you want to pass through a machine learning model. The input dataset list will be filtered by the input file format of the model selected in the previous step.
  5. In the Output Configuration field, enter the name of the output dataset that will contain the predicted output.
  6. The output dataset will be encrypted; hence Encrypt Dataset is enabled to add an extra layer of protection to the output data. Copy or download the encryption key to decrypt the output data for viewing.
  7. Click CREATE INFERENCE FLOW to pass the data through a machine learning model and predict the output. Yolov_CreateInference.pngFigure 4: Build inference
  8. The inference is successfully created. Click RUN below the inference workflow to run the model and predict the output. Yolov_RunInference.pngFigure 5: Run inference
  9. If the model was executed successfully, you would see the status of the execution under the Execution Log. Click the Execution Log link to view the log details. Yolov_InferenceSuccess.pngFigure 6: Inference success
  10. After the execution is completed successfully, the output is now predicted and ready to be viewed. To view the output, click the DOWNLOAD button. Yolov_InferenceOutput.pngFigure 7: Download output
  11. In the DOWNLOAD dialog box, enter the Encryption key to decrypt the output. CAI_DecryptionKey.pngFigure 8: Decrypt output
  12. A *.tar.gz file is generated on your local machine. Extract the contents of the file. The object detected output images appear as shown below.
    3b60e190-f622-41b0-a2cc-715fcfc98513.jpg
    Figure 9: Output

Comments

Please sign in to leave a comment.

Was this article helpful?
0 out of 0 found this helpful