Updated on 2022-02-22 GMT+08:00

Creating a Model Instance

Create a model instance based on the skill model. HiLens Kit cameras can use the models powered by Ascend 310 for inference. Use this method to construct a model for subsequent inference.

When the returned object is destructed, the corresponding model resource is released.

Currently, common models and encrypted models can be created.

  • API calling

    hilens.Model(filepath)

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Type

    Description

    filepath

    Yes

    Character string

    Path of the model file.

    You can view the path of the model file by uploading the model file when creating a skill and entering the skill content.

    • Method 1: Add multiple models to the Model field. For details about how to obtain the model path, see Obtaining Model Paths.
    • Method 2: Compress and upload multiple models and code to OBS in advance. Select Upload from OBS for Code Entry Mode. In this case, the path of the model file is the relative path of the model relative to the file where the code is located.
  • Return value

    <class'hilens.Model'> model object.

    If the model fails to be constructed, the system displays "CreateError" and an error code is recorded in the log (for example, 0x1013011 indicates that the model path is incorrect).