Forums - code help

2 posts / 0 new
Last post
code help
MarkWu
Join Date: 8 May 22
Posts: 37
Posted: Mon, 2022-07-04 02:36

Hi,

I followed the code in the demo and ran it on my phone, but the results I got are inconsistent with the results I got using the benchmark tool. I want to ask for help.

My device is Snapdragon 888, and the compilation environment is ubuntu20.04.

My code:

zdl::DlSystem::TensorShape tensorShape;
tensorShape = snpe->getInputDimensions();
 
size_t batchSize = tensorShape.getDimensions()[0];
std::cout << "Batch size for the container is " << batchSize << std::endl;
 
bool execStatus = false;

std::vector<float> inputVec;
 
cv::Mat inputImage = cv::imread(image_path, cv::IMREAD_COLOR);
cv::Mat floatImage;
inputImage.convertTo(floatImage, CV_32F, 1 / 255.0, 0);
 
std::unique_ptr<zdl::DlSystem::ITensor> inputTensor =
zdl::SNPE::SNPEFactory::getTensorFactory().createTensor(tensorShape);

std::copy(inputVec.begin(), inputVec.end(), inputTensor->begin());
 
execStatus = snpe->execute(inputTensor.get(), outputTensorMap);

 

  • Up0
  • Down0
weihuan
Join Date: 12 Apr 20
Posts: 270
Posted: Sat, 2022-07-09 19:28

Dear customer,

Which SNPE version you have tested?

What's type of data format you feeds?

SNPE demo code provided the conversion step to customer if you feed with float data. I assume that you need to change the core flow of float to fixed point and reverse.

BR.

Wei

  • Up0
  • Down0
or Register

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.