Help Center > > Best Practices> Yunbao Detection (Using ExeML for Object Detection)

Yunbao Detection (Using ExeML for Object Detection)

Updated at: Sep 06, 2019 GMT+08:00

ModelArts provides ExeML for service developers, freeing you from model development and parameter tuning. With ExeML, you can finish an AI development project in just three steps, including data labeling, auto training, and service deployment.

This section provides an example of how to detect Yunbao, the mascot of HUAWEI CLOUD, to help you quickly get started with ModelArts. This example is an object detection project. By using the built-in Yunbao image dataset, the system automatically trains and generates a detection model, and deploys the generated model as a real-time service. After the deployment is completed, you can use the real-time service to identify whether an input image contains Yunbao.

Before you start, carefully complete the preparations described in Preparations in advance. To use ExeML to build a model, perform the following steps:

Preparations

  • You have registered with HUAWEI CLOUD and checked the account status before using ModelArts. The account cannot be in arrears or frozen.
  • Obtain the AK/SK of the account and configure the AK/SK in Settings of ModelArts.
  • You have created a bucket and folder in OBS for storing the sample dataset. In this example, create an OBS bucket named test-modelarts and folder named dataset-yunbao.

    For details about how to create an OBS bucket and folder, see Creating a Bucket and Creating a Folder. For normal data access, ensure that the created OBS bucket and ModelArts are in the same region.

Step 1: Prepare Data

ModelArts provides a sample dataset of Yunbao named Yunbao-Data-Custom. This example uses this dataset to build a model. Perform the following operations to upload the dataset to the OBS directory test-modelarts/dataset-yunbao created in preparation.

If you want to use your own dataset, skip this step, upload the dataset to the OBS folder, and select this directory in Step 2: Create an Object Detection Project.

  1. Download the Yunbao-Data-Custom dataset to the local PC.
  2. Decompress the Yunbao-Data-Custom.zip file to the Yunbao-Data-Custom directory on the local PC.
  3. Upload all files in the Yunbao-Data-Custom directory to the test-modelarts/dataset-yunbao directory on OBS. For details about how to upload files, see Uploading a File.

    The obtained dataset has two directories: eval and train. The data stored in train is used for model training, and the data stored in eval can be used for model prediction.

Step 2: Create an Object Detection Project

  1. On the ModelArts management console, click ExeML in the left navigation pane.
  2. In the Object Detection box, click Create Project. On the Create Object Detection Project page that is displayed, enter the project name and select the training data. The OBS path of the Yunbao dataset is /test-modelarts/dataset-yunbao/train/.
    NOTE:

    The Yunbao dataset has two directories: eval and train. Select the data in the train directory for training. Otherwise, an error message is displayed, indicating that OBS has invalid data. As a result, the project will fail to create.

    Figure 1 Creating an object detection project

  3. Click Create Project. The object detection project is created. After the project is created, the ExeML page is displayed and data source synchronization is automatically performed.

Step 3: Label Data

For an object detection project, labeling data is to label an object in an image, and assign a label to it. The labeled data is used for model training. In the Yunbao dataset, part of data has been labeled. You can label the unlabeled data for trial use.

  1. On the ExeML page, click the project name. The page for building an ExeML model is displayed.

    Data source synchronization is automatically performed when you create an ExeML project. Data source synchronization takes a certain period of time. If the synchronization fails, you can click Synchronize Data Source to manually execute the synchronization.

  2. On the Label Data tab page, click the Unlabeled tab. All unlabeled images are displayed. Click an image to go to the labeling page.
  3. Left-click and drag the mouse to select the area where Yunbao is located. In the dialog box that is displayed, enter the label name, for example, yunbao, and press Enter. After the labeling is complete, the status of the image changes to Labeled in the left Image Catalog pane.
    You can select another image from the left Image Catalog pane and repeat the preceding steps to label the image. If an image contains more than one Yunbao, you can label all. You are advised to label all images in the dataset to train a model with better precision.
    Figure 2 Image labeling for object detection
  4. After all the images are labeled, click Save and Return in the upper right corner to return to the data labeling page. On the Labeled tab page, you can view the labeled images and view the label names and quantity in the right pane.

Step 4: Generate a Model with ExeML

  1. After labeling the data, set the training parameters on the Label Data tab page. You are advised to set the training duration within one hour for the first time, and adjust the duration based on the training precision then. You can also click Advanced Settings to set the inference duration and training version.
    In this example, the training duration is less than 1 hour and Advanced Settings is disabled.
    Figure 3 Setting training parameters
  2. Click Train to start the auto model training. The training takes a certain period of time. If you close or exit the page, the system continues training until it is completed.
    After the training is completed, you can view the training details on the page, such as the accuracy, evaluation result, custom parameters, and class statistics.
    Figure 4 Model training

Step 5: Deploy the Model as a Real-Time Service

  1. On the Train Model tab page, wait until the training status changes to Running Success. Click Deploy in the Version Manager pane to deploy the object detection model as a real-time service.
    Figure 5 Deploying a service
  2. After the deployment is started, the system automatically switches to the Service Deployment tab page. This page displays the deployment progress and status.
    The deployment takes a certain period of time. After the deployment is completed, the status in the Version Manager pane changes to Deployment Success.
    Figure 6 Deployment progress

Step 6: Test the Service

After the model is deployed, you can test the service using an image.

  1. On the Deployment Online tab page, select the service version that is successfully deployed, and click Upload to upload a local image.
    Figure 7 Uploading an image
  2. Select an image from a local environment. The image must contain Yunbao. Click Predict to perform the test.

    After the prediction is completed, the label name yunbao, location coordinates, and confidence score are displayed in the prediction result pane on the right. In the prediction result, detection_boxes indicates the location of the object, detection_scores indicates the detection score of yunbao.

    If the model accuracy does not meet your expectation, add images on the Label Data tab page, label the images, and train and deploy the model again.

    NOTE:

    A running real-time service keeps consuming the resources. If you do not need to use the real-time service, you are advised to click Stop in the Version Manager pane to stop the service and avoid unnecessary charging. If you want to use the service again, click Start.

    Figure 8 Test result

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel