Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2.5 #8

Merged
merged 3 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
feat: update quantized model for DSP runtime.
  • Loading branch information
gesanqiu committed Feb 24, 2023
commit 7b595df24ade0d9cf2e9c88d13e0d5a91dbaaa98
Binary file modified lib/libAlgYolov5s.so
Binary file not shown.
Binary file modified lib/libYOLOv5s.so
Binary file not shown.
Binary file added model/yolov5s_v2.5_quantized.dlc
Binary file not shown.
13 changes: 8 additions & 5 deletions snpetask/SNPETask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @Author: Ricardo Lu<[email protected]>
* @Date: 2022-05-18 09:48:36
* @LastEditors: Ricardo Lu
* @LastEditTime: 2023-02-23 09:07:57
* @LastEditTime: 2023-02-24 15:08:41
*/


Expand Down Expand Up @@ -93,6 +93,9 @@ bool SNPETask::init(const std::string& model_path, const runtime_t runtime)
case DSP:
m_runtime = SNPE_RUNTIME_DSP;
break;
case DSP_FIXED8:
m_runtime = SNPE_RUNTIME_DSP_FIXED8_TF;
break;
case AIP:
m_runtime = SNPE_RUNTIME_AIP_FIXED8_TF;
break;
Expand Down Expand Up @@ -150,8 +153,8 @@ bool SNPETask::init(const std::string& model_path, const runtime_t runtime)
}
m_inputShapes.emplace(name, tensorShape);

size_t bufferElementSize = Snpe_IBufferAttributes_GetElementSize(bufferAttributesOptHandle);
createUserBuffer(m_inputUserBufferMap, m_inputTensors, m_inputUserBuffers, bufferShapeHandle, name, bufferElementSize);
// size_t bufferElementSize = Snpe_IBufferAttributes_GetElementSize(bufferAttributesOptHandle);
createUserBuffer(m_inputUserBufferMap, m_inputTensors, m_inputUserBuffers, bufferShapeHandle, name, sizeof(float));

Snpe_IBufferAttributes_Delete(bufferAttributesOptHandle);
Snpe_TensorShape_Delete(bufferShapeHandle);
Expand Down Expand Up @@ -181,8 +184,8 @@ bool SNPETask::init(const std::string& model_path, const runtime_t runtime)
}
m_outputShapes.emplace(name, tensorShape);

size_t bufferElementSize = Snpe_IBufferAttributes_GetElementSize(bufferAttributesOptHandle);
createUserBuffer(m_outputUserBufferMap, m_outputTensors, m_outputUserBuffers, bufferShapeHandle, name, bufferElementSize);
// size_t bufferElementSize = Snpe_IBufferAttributes_GetElementSize(bufferAttributesOptHandle);
createUserBuffer(m_outputUserBufferMap, m_outputTensors, m_outputUserBuffers, bufferShapeHandle, name, sizeof(float));

Snpe_IBufferAttributes_Delete(bufferAttributesOptHandle);
Snpe_TensorShape_Delete(bufferShapeHandle);
Expand Down
4 changes: 2 additions & 2 deletions test/test_image/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"model-path":"../model/yolov5s_v2.5.dlc",
"runtime":"CPU",
"model-path":"../model/yolov5s_v2.5_quantized.dlc",
"runtime":"DSP",
"labels":85,
"grids":25200,
"input-layers":[
Expand Down
4 changes: 3 additions & 1 deletion test/test_image/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @Author: Ricardo Lu<[email protected]>
* @Date: 2022-05-18 16:51:10
* @LastEditors: Ricardo Lu
* @LastEditTime: 2022-12-15 05:05:45
* @LastEditTime: 2023-02-24 15:02:47
*/

#include <string>
Expand Down Expand Up @@ -34,6 +34,8 @@ static runtime_t device2runtime(std::string & device)
return GPU_FLOAT16;
} else if (0 == device.compare("dsp")) {
return DSP;
} else if (0 == device.compare("dsp_fixed8")) {
return DSP_FIXED8;
} else if (0 == device.compare("aip")) {
return AIP;
} else {
Expand Down