Forums - How to make the AI model run independently on the mobile end?

1 post / 0 new
How to make the AI model run independently on the mobile end?
gdwanyq
Join Date: 1 Sep 18
Posts: 3
Posted: Tue, 2018-09-25 01:47

In the tutorial of SNPE (1.19.2), the example is to compile source code into executable files. When running the AI model on the phone, we need to run with the command line on the PC end. How to make the AI model run independently on the mobile end?

 

  We try to simply modify “main.cpp”, compile the source code of the example into a dynamic library file (“.so” format), and call it at the HAL layer on the phone. But it never succeeded. By adjusting the position of “return 0;” in the “main.cpp”, we find that when running to “snpe->function” (such as, the 168th line in “main.cpp”), the run got stuck.

The attached is the modified “main.cpp”.

 

  Is our idea of calling dynamic library files in HAL layer correct? If it is correct, we hoped for your guidance about the question. In addition, how can the AI model run independently on the mobile phone end? We hope you can give some practical suggestions. Thanks very much anyway.

 

The lines 44-54 in "main.cpp"  are modified as following:
int SnpeDLC(void)
{
    enum {UNKNOWN, USERBUFFER, ITENSOR};
    enum {CPUBUFFER, GLBUFFER};
    // Command line arguments
    static std::string dlc = "bvlc_alexnet.dlc";
    static std::string OutputDir = "output";
    const char* inputFile = "target_raw_list.txt";
    std::string bufferTypeStr = "USERBUFFER";
    std::string userBufferSourceStr = "CPUBUFFER";
 
The line 54-107  are annotated in "main.cpp".
 
  • Up0
  • Down0

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.