Quickly Developing Skills (Developers)
This chapter describes how developers who purchase HiLens Kit devices develop skills using templates and install the skills to devices. After the installation is complete, you can view the skill running effect on the Huawei HiLens console.
The Safety Helmet Detection Template is used as an example to demonstrate the entire process from skill development to skill effect viewing. After the skill is installed, the camera can detect whether workers are wearing safety helmets.
Before you start, carefully complete the preparations described in Preparations. Figure 1 shows the development process.
Preparations
- Register an account. Before using HiLens, check the account status, which cannot be in arrears or frozen.
- Purchase a HiLens Kit device and register it with the HiLens platform.
Step 1: Develop the Skill
- Log in to the Huawei HiLens console, choose Skill Development > Skills in the left navigation pane. The Skill Management page is displayed.
- Click Create Skill in the upper right corner. The Create Skill page is displayed.
- Enter basic information about the skill. For details about the parameters, see Table 1.
Figure 2 Basic skill information
Table 1 Parameter description Parameter
Description
Suggestion
Skill Templates
You can select Create from Scratch or Select Template.
If you have saved a skill template, you can use it to quickly develop the skill. If you select the skill template, its logic code and model will be used by default. You can also edit the skill template.
If no skill template is available in the system, you can use an empty template to develop the skill.
Click Select Template. In the dialog box that is displayed, select the Safety Helmet Detection Template.
Name
Skill name. The name is also used to name the root directory when the skill is delivered to a device.
Enter 3 to 60 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. The name must start with a letter and end with a letter or digit.
NOTE:The skill market does not allow duplicate skill names. Therefore, if you want to release a skill to the skill market, use a globally unique name to name your skill.
You are advised to name skills in the format of brand + application name.
Version
Skill version.
The format is number.number.number, for example, 2.1.3. Each number ranges from 0 to 999. When it has two or more digits, it cannot start with 0.
For example, 1.0.0.
Chip
Chip supported by the skill. For skills running on HiLens Kit devices, select the Ascend 310 chip.
Ascend 310
Skill Code Value
Used for skill verification to prevent fake skills.
Use the hash check value in the template. You do not need to set this parameter.
Application Scenario
Application scenario of the skill, such as Smart Campus, Smart Home, Smart In Vehicle Device, Smart Mall and Supermarket, and Others.
You can directly use the template model and do not need to set this parameter.
Icon
Icon of the skill
This parameter is optional.
OS Platform
OS where the skill runs, including Linux, Android, iOS, LiteOS, and Windows.
Linux
Description
Detailed description about the skill,
You can enter a maximum of 2,048 characters. Special characters ~^$%& are not allowed.
Enter the skill output mode based on the template.
- HDMI: The video data is output to the display through the HDMI port of the device.
- RTMP: The video data is output to a server in real time for users to view.
- H264_FILE: The video data is output as files to OBS for users to view.
- Set the skill content. For details about the parameters, see Table 2.
In this example, an existing template is used to develop the skill. The skill content uses the model and code of the template by default. You can use the default information or edit it as required. The parameters vary if you use an empty template to develop the skill. For details, see the Huawei HiLens User Guide.
Figure 3 Setting the skill content
Table 2 Skill content parameters Parameter
Description
Suggestion
Skill Format
Format of the skill to be created. Two formats are available: Skill package and Container image.
You can directly use the template model and do not need to set this parameter.
Runtime Language
Runtime language of the logic code. Currently, the value can be Python3.7 or C/C++. If the C/C++ language is selected for development, online code compilation is not supported. Developers need to develop and compile the code offline, package the code in the Linux environment, and upload the package the OBS.
You can directly use the template model and do not need to set this parameter.
Function Execution Entry
The startup of a skill uses the code execution file as the entry, which is similar to the main function of the C language. The main file must be in the level-1 directory.
- The main file of a skill in the Skill package format must be in the root directory of the skill package. For example, end the file of a Python skill with .py.
- For a skill in the Container image format, if ENTTRYPOINT has been configured for dockerfile, the description can be left blank. Otherwise, you need to enter the path to the execution file within the image.
The file name can contain a maximum of 1,024 characters, consisting of letters, digits, and underscores (_). Special characters #~^ are not allowed.
You can directly use the template model and do not need to set this parameter.
Model
Core algorithm of the skill to be created. The model can be trained locally or in ModelArts and then be imported to Huawei HiLens. Click the plus sign (+). In the dialog box that is displayed, select a model from the model management list on the Huawei HiLens platform.
You can directly use the template model and do not need to set this parameter.
Code Entry Mode
Upload mode of the logic code.
- Online Compilation
Use the logic code for developing skills online to automatically generate a .zip package and upload it to OBS. Huawei HiLens automatically creates an OBS bucket for storing the skill package. The bucket is named in the <project_id>-hilens-skill format. You can go to the OBS console, find the OBS bucket with the corresponding name, and obtain the code package file edited online.
- Upload From OBS
You can develop complex project code offline, manually generate a .zip or .tar.gz package, upload it to OBS, and select the .zip or .tar.gz package from OBS here.
- Select Container Image
For skills in the container image format, you can upload their container image files to SWR in advance. For details, see Uploading Images Through the Docker Client.
You can directly use the template model and do not need to set this parameter.
- Configure runtime configurations. The Runtime Configuration is used to configure the parameters required by the skill for users who use the skill. The configuration parameters provided by the template can be directly used.
- Enter basic information about the skill. For details about the parameters, see Table 1.
- After setting and confirming all skill development parameters, click OK on the right.
The developed skill is stored on the Skill Development > Skill Management page. You can view the skill status this page.
Figure 4 Skill Management
Step 2: Install the Skill
- Choose Skill Development > Skills, select the developed skill, and click Install in the Operation column.
- In the dialog box that is displayed, select the device to which the skill is installed and click Install. After the installation is successful, click OK.
During the installation, the Huawei HiLens console will deliver the skill package to the device. It takes some time to deliver the skill package. You can view the skill installation progress in the progress bar. After the delivery is complete, the progress bar displays Installation succeeded. See Figure 5.
Step 3: Start the Skill
- Use the HDMI video cable to connect the video output port of the HiLens device to the display.
- In the navigation pane, choose Device Management > Devices. The Devices page is displayed.
- Click Manage Skill of the registered device. The status of the installed Safety Helmet Detection skill is Stopped. Click Start in the Operation column and click OK to start the skill on the device.
The skill status changes to Running after a short period of time, indicating that the skill is successfully running on the device. Then, you can view the skill output data on the display.
Table 3 describes the skill statuses.
Figure 6 Viewing the installed skill
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot