Compare commits
1 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
1df916f9c2 |
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"python-envs.defaultEnvManager": "ms-python.python:conda",
|
||||
"python-envs.defaultPackageManager": "ms-python.python:conda"
|
||||
}
|
||||
23
README.md
|
|
@ -187,7 +187,30 @@ netrans dump ./yolov5s_crop_hb asymu8
|
|||
- 可通过 Netron 查看 `yolov5s_crop_hb.json` 获取层/子图名称
|
||||
- 支持子图量化和单层量化混合配置
|
||||
- 优先对精度敏感层使用 dfpi16 量化
|
||||
|
||||
## 执行与性能
|
||||
|
||||
### 运行方式
|
||||
|
||||
```bash
|
||||
python yolov5s_crop_hb.py
|
||||
```
|
||||
|
||||
### 性能指标
|
||||
|
||||
| 指标 | 数值 |
|
||||
|------|------|
|
||||
| **推理平台** | 边缘板卡(NPU) |
|
||||
| **u8推理时间** | ~19.7 ms |
|
||||
---
|
||||
|
||||
## 输出示例
|
||||
|
||||
### 目标检测结果
|
||||
|
||||

|
||||
|
||||
> 标出检测框和类别标签。结果图保存路径:`./yolov5s_crop_hb/result.jpg`
|
||||
---
|
||||
|
||||
> *作者 {{liangliangou}}*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,114 @@
|
|||
from websockets.sync.client import connect
|
||||
from jsonrpcclient import request_json, parse_json, Ok, Error
|
||||
import base64
|
||||
import os
|
||||
import numpy as np
|
||||
|
||||
class Client:
|
||||
"""客户端封装类"""
|
||||
|
||||
def __init__(self, uri, max_size=100 * 1024 * 1024, close_timeout=10000):
|
||||
self.websocket = connect(uri, max_size=max_size, close_timeout=close_timeout)
|
||||
|
||||
def _rpc_call(self, req):
|
||||
"""
|
||||
返回结果检查
|
||||
Parameters
|
||||
----------
|
||||
req : 返回结果
|
||||
Returns
|
||||
-------
|
||||
结果或者None
|
||||
"""
|
||||
self.websocket.send(req)
|
||||
for rsp in self.websocket:
|
||||
parsed = parse_json(rsp)
|
||||
if isinstance(parsed, Ok):
|
||||
return parsed.result
|
||||
else :
|
||||
print(f"Expected status 'SUCC', but got : {parsed}")
|
||||
return None
|
||||
|
||||
|
||||
def infer(self, method, *params):
|
||||
"""
|
||||
调用通过add注册的模型,输入np格式的的图像数据,执行推理并返回bytes的张量结果与推理耗时
|
||||
Parameters
|
||||
----------
|
||||
method : 推理模型名称
|
||||
Returns
|
||||
-------
|
||||
推理结果和时间
|
||||
"""
|
||||
encoded_params = [base64.b64encode(np.ascontiguousarray(param)).decode('utf-8') for param in params]
|
||||
req = request_json(method, encoded_params)
|
||||
result = self._rpc_call(req)
|
||||
if result is None:
|
||||
return None
|
||||
else:
|
||||
decode_data = [base64.b64decode(ret) for ret in result['tensor']]
|
||||
return (decode_data, result['infer_time'])
|
||||
|
||||
def add_model(self, *params):
|
||||
"""
|
||||
添加新模型
|
||||
Returns
|
||||
-------
|
||||
模型添加信息
|
||||
"""
|
||||
file_path, method_model = params
|
||||
model_nb_b64 = self._read_binary_file2b64(file_path)
|
||||
req = request_json('add_model', (model_nb_b64, method_model))
|
||||
result = self._rpc_call(req)
|
||||
|
||||
return result
|
||||
|
||||
def delete_model(self, *params):
|
||||
"""
|
||||
删除已通过add注册的模型
|
||||
Returns
|
||||
-------
|
||||
返回删除结果
|
||||
"""
|
||||
req = request_json("delete_model", params)
|
||||
result = self._rpc_call(req)
|
||||
|
||||
return result
|
||||
|
||||
def query(self):
|
||||
"""
|
||||
返回当前系统中所有已注册的JSON-RPC方法(包括系统方法与用户通过add_model注册的推理方法)。
|
||||
Returns
|
||||
-------
|
||||
返回查询到的所以方法
|
||||
"""
|
||||
req = request_json("rpc.list", [])
|
||||
result = self._rpc_call(req)
|
||||
|
||||
return result
|
||||
|
||||
def close(self):
|
||||
"""
|
||||
关闭连接
|
||||
"""
|
||||
self.websocket.close()
|
||||
|
||||
def _read_binary_file2b64(self, file_path):
|
||||
"""
|
||||
二进制文件读取函数:读取模型文件(.nb格式)的二进制数据,转换成Base64编码
|
||||
Args:
|
||||
file_path: str - 模型文件的路径(如"./resnet18.nb")
|
||||
Returns:W
|
||||
b64 - Base64编码
|
||||
"""
|
||||
if not os.path.exists(file_path):
|
||||
raise FileNotFoundError(f"二进制文件不存在:{file_path}")
|
||||
|
||||
with open(file_path, 'rb') as f:
|
||||
binary_data = f.read()
|
||||
model_nb_b64 = base64.b64encode(binary_data).decode('utf-8')
|
||||
return model_nb_b64
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
def fiducial_e(value, real):
|
||||
"""计算归一化的绝对误差,通过计算fe的均值和最大值来评估,值越接近0越好
|
||||
|
||||
Parameters
|
||||
----------
|
||||
Returns
|
||||
-------
|
||||
返回fe值,通过fe.max和fe.mean评估
|
||||
"""
|
||||
fe = abs(value - real) / (real.max() - real.min())
|
||||
return fe
|
||||
BIN
yolov5s/0.jpg
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 220 KiB |
|
|
@ -1 +1 @@
|
|||
0.0 0.0 0.0 255.0 255.0 255.0
|
||||
0.0 0.0 0.0 1.0 1.0 1.0
|
||||
|
|
@ -7,7 +7,6 @@ filegroup(
|
|||
srcs =
|
||||
[
|
||||
"vnn_yolov5sasymu8.c",
|
||||
"vnn_yolov5sasymu8_tensor.c",
|
||||
"vnn_yolov5sasymu8.h",
|
||||
"vnn_post_process.c",
|
||||
"vnn_post_process.h",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"Version": "0.0.1"
|
||||
},
|
||||
"Layers": {
|
||||
"node_100175": {
|
||||
"node_100178": {
|
||||
"inputs": [],
|
||||
"outputs": ["out0"],
|
||||
"op": "TensorMul",
|
||||
|
|
@ -23,8 +23,8 @@
|
|||
"output_dma_mem_attr": "0"
|
||||
}
|
||||
},
|
||||
"node_100176": {
|
||||
"inputs": ["@node_100175:out0"],
|
||||
"node_100179": {
|
||||
"inputs": ["@node_100178:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "Concat",
|
||||
"parameters": {
|
||||
|
|
@ -47,8 +47,8 @@
|
|||
"axis": 0
|
||||
}
|
||||
},
|
||||
"node_100177": {
|
||||
"inputs": ["@node_100176:out0"],
|
||||
"node_100180": {
|
||||
"inputs": ["@node_100179:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "Reshape",
|
||||
"parameters": {
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
"output_dma_mem_attr": "0"
|
||||
}
|
||||
},
|
||||
"node_100178": {
|
||||
"node_100181": {
|
||||
"inputs": [],
|
||||
"outputs": ["out0"],
|
||||
"op": "TensorMul",
|
||||
|
|
@ -81,8 +81,8 @@
|
|||
"output_dma_mem_attr": "0"
|
||||
}
|
||||
},
|
||||
"node_100179": {
|
||||
"inputs": ["@node_100178:out0"],
|
||||
"node_100182": {
|
||||
"inputs": ["@node_100181:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "Concat",
|
||||
"parameters": {
|
||||
|
|
@ -105,8 +105,8 @@
|
|||
"axis": 0
|
||||
}
|
||||
},
|
||||
"node_100180": {
|
||||
"inputs": ["@node_100179:out0"],
|
||||
"node_100183": {
|
||||
"inputs": ["@node_100182:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "Reshape",
|
||||
"parameters": {
|
||||
|
|
@ -120,7 +120,7 @@
|
|||
"output_dma_mem_attr": "0"
|
||||
}
|
||||
},
|
||||
"node_100181": {
|
||||
"node_100184": {
|
||||
"inputs": [],
|
||||
"outputs": ["out0"],
|
||||
"op": "TensorMul",
|
||||
|
|
@ -139,8 +139,8 @@
|
|||
"output_dma_mem_attr": "0"
|
||||
}
|
||||
},
|
||||
"node_100182": {
|
||||
"inputs": ["@node_100181:out0"],
|
||||
"node_100185": {
|
||||
"inputs": ["@node_100184:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "Concat",
|
||||
"parameters": {
|
||||
|
|
@ -163,8 +163,8 @@
|
|||
"axis": 0
|
||||
}
|
||||
},
|
||||
"node_100183": {
|
||||
"inputs": ["@node_100182:out0"],
|
||||
"node_100186": {
|
||||
"inputs": ["@node_100185:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "Reshape",
|
||||
"parameters": {
|
||||
|
|
@ -178,8 +178,8 @@
|
|||
"output_dma_mem_attr": "0"
|
||||
}
|
||||
},
|
||||
"node_100184": {
|
||||
"inputs": ["@node_100177:out0", "@node_100180:out0", "@node_100183:out0"],
|
||||
"node_100187": {
|
||||
"inputs": ["@node_100180:out0", "@node_100183:out0", "@node_100186:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "Concat",
|
||||
"parameters": {
|
||||
|
|
@ -197,10 +197,25 @@
|
|||
"input_2_dma_mem_attr": "0",
|
||||
"output_dtype": "kUInt8",
|
||||
"output_shape": ["[85", " 25200", " 1]"],
|
||||
"output_lifetime": "kOutput",
|
||||
"output_lifetime": "kTransient",
|
||||
"output_dma_mem_attr": "0",
|
||||
"axis": 1
|
||||
}
|
||||
},
|
||||
"node_100188": {
|
||||
"inputs": ["@node_100187:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "TensorCopy",
|
||||
"parameters": {
|
||||
"input_dtype": "kUInt8",
|
||||
"input_shape": ["[85", " 25200", " 1]"],
|
||||
"input_lifetime": "kTransient",
|
||||
"input_dma_mem_attr": "0",
|
||||
"output_dtype": "kFloat32",
|
||||
"output_shape": ["[85", " 25200", " 1]"],
|
||||
"output_lifetime": "kOutput",
|
||||
"output_dma_mem_attr": "0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
"Layers":{
|
||||
"uid_252":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@data_input_uid_189:out0", "@data_input_uid_190:out0", "@data_input_uid_191:out0" ],
|
||||
"inputs": [ "@uid_10000:out0", "@data_input_uid_194:out0", "@data_input_uid_195:out0" ],
|
||||
"inut_shape": [ [ 640, 640, 3, 1 ],[ 6, 6, 3, 32 ],[ 32 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 320, 320, 32, 1 ] ]
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
},
|
||||
"uid_240":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_241:out0", "@data_input_uid_192:out0", "@data_input_uid_193:out0" ],
|
||||
"inputs": [ "@uid_241:out0", "@data_input_uid_196:out0", "@data_input_uid_197:out0" ],
|
||||
"inut_shape": [ [ 320, 320, 32, 1 ],[ 3, 3, 32, 64 ],[ 64 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 160, 160, 64, 1 ] ]
|
||||
|
|
@ -36,14 +36,14 @@
|
|||
},
|
||||
"uid_209":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_224:out0", "@data_input_uid_194:out0", "@data_input_uid_195:out0" ],
|
||||
"inputs": [ "@uid_224:out0", "@data_input_uid_198:out0", "@data_input_uid_199:out0" ],
|
||||
"inut_shape": [ [ 160, 160, 64, 1 ],[ 1, 1, 64, 32 ],[ 32 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 160, 160, 32, 1 ] ]
|
||||
},
|
||||
"uid_220":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_224:out0", "@data_input_uid_196:out0", "@data_input_uid_197:out0" ],
|
||||
"inputs": [ "@uid_224:out0", "@data_input_uid_200:out0", "@data_input_uid_201:out0" ],
|
||||
"inut_shape": [ [ 160, 160, 64, 1 ],[ 1, 1, 64, 32 ],[ 32 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 160, 160, 32, 1 ] ]
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
},
|
||||
"uid_250":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_207:out0", "@data_input_uid_198:out0", "@data_input_uid_199:out0" ],
|
||||
"inputs": [ "@uid_207:out0", "@data_input_uid_202:out0", "@data_input_uid_203:out0" ],
|
||||
"inut_shape": [ [ 160, 160, 32, 1 ],[ 1, 1, 32, 32 ],[ 32 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 160, 160, 32, 1 ] ]
|
||||
|
|
@ -78,7 +78,7 @@
|
|||
},
|
||||
"uid_222":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_238:out0", "@data_input_uid_200:out0", "@data_input_uid_201:out0" ],
|
||||
"inputs": [ "@uid_238:out0", "@data_input_uid_204:out0", "@data_input_uid_205:out0" ],
|
||||
"inut_shape": [ [ 160, 160, 32, 1 ],[ 3, 3, 32, 32 ],[ 32 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 160, 160, 32, 1 ] ]
|
||||
|
|
@ -106,7 +106,7 @@
|
|||
},
|
||||
"uid_181":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_183:out0", "@data_input_uid_202:out0", "@data_input_uid_203:out0" ],
|
||||
"inputs": [ "@uid_183:out0", "@data_input_uid_206:out0", "@data_input_uid_207:out0" ],
|
||||
"inut_shape": [ [ 160, 160, 64, 1 ],[ 1, 1, 64, 64 ],[ 64 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 160, 160, 64, 1 ] ]
|
||||
|
|
@ -120,7 +120,7 @@
|
|||
},
|
||||
"uid_165":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_166:out0", "@data_input_uid_204:out0", "@data_input_uid_205:out0" ],
|
||||
"inputs": [ "@uid_166:out0", "@data_input_uid_208:out0", "@data_input_uid_209:out0" ],
|
||||
"inut_shape": [ [ 160, 160, 64, 1 ],[ 3, 3, 64, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 80, 80, 128, 1 ] ]
|
||||
|
|
@ -134,14 +134,14 @@
|
|||
},
|
||||
"uid_145":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_149:out0", "@data_input_uid_206:out0", "@data_input_uid_207:out0" ],
|
||||
"inputs": [ "@uid_149:out0", "@data_input_uid_210:out0", "@data_input_uid_211:out0" ],
|
||||
"inut_shape": [ [ 80, 80, 128, 1 ],[ 1, 1, 128, 64 ],[ 64 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 80, 80, 64, 1 ] ]
|
||||
},
|
||||
"uid_175":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_149:out0", "@data_input_uid_208:out0", "@data_input_uid_209:out0" ],
|
||||
"inputs": [ "@uid_149:out0", "@data_input_uid_212:out0", "@data_input_uid_213:out0" ],
|
||||
"inut_shape": [ [ 80, 80, 128, 1 ],[ 1, 1, 128, 64 ],[ 64 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 80, 80, 64, 1 ] ]
|
||||
|
|
@ -162,7 +162,7 @@
|
|||
},
|
||||
"uid_195":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_161:out0", "@data_input_uid_210:out0", "@data_input_uid_211:out0" ],
|
||||
"inputs": [ "@uid_161:out0", "@data_input_uid_214:out0", "@data_input_uid_215:out0" ],
|
||||
"inut_shape": [ [ 80, 80, 64, 1 ],[ 1, 1, 64, 64 ],[ 64 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 80, 80, 64, 1 ] ]
|
||||
|
|
@ -176,7 +176,7 @@
|
|||
},
|
||||
"uid_177":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_192:out0", "@data_input_uid_212:out0", "@data_input_uid_213:out0" ],
|
||||
"inputs": [ "@uid_192:out0", "@data_input_uid_216:out0", "@data_input_uid_217:out0" ],
|
||||
"inut_shape": [ [ 80, 80, 64, 1 ],[ 3, 3, 64, 64 ],[ 64 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 80, 80, 64, 1 ] ]
|
||||
|
|
@ -197,7 +197,7 @@
|
|||
},
|
||||
"uid_194":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_143:out0", "@data_input_uid_214:out0", "@data_input_uid_215:out0" ],
|
||||
"inputs": [ "@uid_143:out0", "@data_input_uid_218:out0", "@data_input_uid_219:out0" ],
|
||||
"inut_shape": [ [ 80, 80, 64, 1 ],[ 1, 1, 64, 64 ],[ 64 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 80, 80, 64, 1 ] ]
|
||||
|
|
@ -211,7 +211,7 @@
|
|||
},
|
||||
"uid_163":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_179:out0", "@data_input_uid_216:out0", "@data_input_uid_217:out0" ],
|
||||
"inputs": [ "@uid_179:out0", "@data_input_uid_220:out0", "@data_input_uid_221:out0" ],
|
||||
"inut_shape": [ [ 80, 80, 64, 1 ],[ 3, 3, 64, 64 ],[ 64 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 80, 80, 64, 1 ] ]
|
||||
|
|
@ -239,7 +239,7 @@
|
|||
},
|
||||
"uid_109":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_112:out0", "@data_input_uid_218:out0", "@data_input_uid_219:out0" ],
|
||||
"inputs": [ "@uid_112:out0", "@data_input_uid_222:out0", "@data_input_uid_223:out0" ],
|
||||
"inut_shape": [ [ 80, 80, 128, 1 ],[ 1, 1, 128, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 80, 80, 128, 1 ] ]
|
||||
|
|
@ -253,7 +253,7 @@
|
|||
},
|
||||
"uid_234":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_103:out0", "@data_input_uid_220:out0", "@data_input_uid_221:out0" ],
|
||||
"inputs": [ "@uid_103:out0", "@data_input_uid_224:out0", "@data_input_uid_225:out0" ],
|
||||
"inut_shape": [ [ 80, 80, 128, 1 ],[ 3, 3, 128, 256 ],[ 256 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 256, 1 ] ]
|
||||
|
|
@ -267,14 +267,14 @@
|
|||
},
|
||||
"uid_218":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_219:out0", "@data_input_uid_222:out0", "@data_input_uid_223:out0" ],
|
||||
"inputs": [ "@uid_219:out0", "@data_input_uid_226:out0", "@data_input_uid_227:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 256, 1 ],[ 1, 1, 256, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 128, 1 ] ]
|
||||
},
|
||||
"uid_264":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_219:out0", "@data_input_uid_224:out0", "@data_input_uid_225:out0" ],
|
||||
"inputs": [ "@uid_219:out0", "@data_input_uid_228:out0", "@data_input_uid_229:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 256, 1 ],[ 1, 1, 256, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 128, 1 ] ]
|
||||
|
|
@ -295,7 +295,7 @@
|
|||
},
|
||||
"uid_269":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_258:out0", "@data_input_uid_226:out0", "@data_input_uid_227:out0" ],
|
||||
"inputs": [ "@uid_258:out0", "@data_input_uid_230:out0", "@data_input_uid_231:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 128, 1 ],[ 1, 1, 128, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 128, 1 ] ]
|
||||
|
|
@ -309,7 +309,7 @@
|
|||
},
|
||||
"uid_266":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_267:out0", "@data_input_uid_228:out0", "@data_input_uid_229:out0" ],
|
||||
"inputs": [ "@uid_267:out0", "@data_input_uid_232:out0", "@data_input_uid_233:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 128, 1 ],[ 3, 3, 128, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 128, 1 ] ]
|
||||
|
|
@ -330,7 +330,7 @@
|
|||
},
|
||||
"uid_263":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_246:out0", "@data_input_uid_230:out0", "@data_input_uid_231:out0" ],
|
||||
"inputs": [ "@uid_246:out0", "@data_input_uid_234:out0", "@data_input_uid_235:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 128, 1 ],[ 1, 1, 128, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 128, 1 ] ]
|
||||
|
|
@ -344,7 +344,7 @@
|
|||
},
|
||||
"uid_255":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_261:out0", "@data_input_uid_232:out0", "@data_input_uid_233:out0" ],
|
||||
"inputs": [ "@uid_261:out0", "@data_input_uid_236:out0", "@data_input_uid_237:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 128, 1 ],[ 3, 3, 128, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 128, 1 ] ]
|
||||
|
|
@ -365,7 +365,7 @@
|
|||
},
|
||||
"uid_254":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_232:out0", "@data_input_uid_234:out0", "@data_input_uid_235:out0" ],
|
||||
"inputs": [ "@uid_232:out0", "@data_input_uid_238:out0", "@data_input_uid_239:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 128, 1 ],[ 1, 1, 128, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 128, 1 ] ]
|
||||
|
|
@ -379,7 +379,7 @@
|
|||
},
|
||||
"uid_237":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_249:out0", "@data_input_uid_236:out0", "@data_input_uid_237:out0" ],
|
||||
"inputs": [ "@uid_249:out0", "@data_input_uid_240:out0", "@data_input_uid_241:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 128, 1 ],[ 3, 3, 128, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 128, 1 ] ]
|
||||
|
|
@ -407,7 +407,7 @@
|
|||
},
|
||||
"uid_203":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_204:out0", "@data_input_uid_238:out0", "@data_input_uid_239:out0" ],
|
||||
"inputs": [ "@uid_204:out0", "@data_input_uid_242:out0", "@data_input_uid_243:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 256, 1 ],[ 1, 1, 256, 256 ],[ 256 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 256, 1 ] ]
|
||||
|
|
@ -421,7 +421,7 @@
|
|||
},
|
||||
"uid_230":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_190:out0", "@data_input_uid_240:out0", "@data_input_uid_241:out0" ],
|
||||
"inputs": [ "@uid_190:out0", "@data_input_uid_244:out0", "@data_input_uid_245:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 256, 1 ],[ 3, 3, 256, 512 ],[ 512 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 20, 20, 512, 1 ] ]
|
||||
|
|
@ -435,14 +435,14 @@
|
|||
},
|
||||
"uid_212":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_228:out0", "@data_input_uid_242:out0", "@data_input_uid_243:out0" ],
|
||||
"inputs": [ "@uid_228:out0", "@data_input_uid_246:out0", "@data_input_uid_247:out0" ],
|
||||
"inut_shape": [ [ 20, 20, 512, 1 ],[ 1, 1, 512, 256 ],[ 256 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 20, 20, 256, 1 ] ]
|
||||
},
|
||||
"uid_242":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_228:out0", "@data_input_uid_244:out0", "@data_input_uid_245:out0" ],
|
||||
"inputs": [ "@uid_228:out0", "@data_input_uid_248:out0", "@data_input_uid_249:out0" ],
|
||||
"inut_shape": [ [ 20, 20, 512, 1 ],[ 1, 1, 512, 256 ],[ 256 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 20, 20, 256, 1 ] ]
|
||||
|
|
@ -463,7 +463,7 @@
|
|||
},
|
||||
"uid_256":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_226:out0", "@data_input_uid_246:out0", "@data_input_uid_247:out0" ],
|
||||
"inputs": [ "@uid_226:out0", "@data_input_uid_250:out0", "@data_input_uid_251:out0" ],
|
||||
"inut_shape": [ [ 20, 20, 256, 1 ],[ 1, 1, 256, 256 ],[ 256 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 20, 20, 256, 1 ] ]
|
||||
|
|
@ -477,7 +477,7 @@
|
|||
},
|
||||
"uid_244":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_245:out0", "@data_input_uid_248:out0", "@data_input_uid_249:out0" ],
|
||||
"inputs": [ "@uid_245:out0", "@data_input_uid_252:out0", "@data_input_uid_253:out0" ],
|
||||
"inut_shape": [ [ 20, 20, 256, 1 ],[ 3, 3, 256, 256 ],[ 256 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 20, 20, 256, 1 ] ]
|
||||
|
|
@ -505,7 +505,7 @@
|
|||
},
|
||||
"uid_184":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_198:out0", "@data_input_uid_250:out0", "@data_input_uid_251:out0" ],
|
||||
"inputs": [ "@uid_198:out0", "@data_input_uid_254:out0", "@data_input_uid_255:out0" ],
|
||||
"inut_shape": [ [ 20, 20, 512, 1 ],[ 1, 1, 512, 512 ],[ 512 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 20, 20, 512, 1 ] ]
|
||||
|
|
@ -519,7 +519,7 @@
|
|||
},
|
||||
"uid_169":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_170:out0", "@data_input_uid_252:out0", "@data_input_uid_253:out0" ],
|
||||
"inputs": [ "@uid_170:out0", "@data_input_uid_256:out0", "@data_input_uid_257:out0" ],
|
||||
"inut_shape": [ [ 20, 20, 512, 1 ],[ 1, 1, 512, 256 ],[ 256 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 20, 20, 256, 1 ] ]
|
||||
|
|
@ -561,7 +561,7 @@
|
|||
},
|
||||
"uid_151":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_152:out0", "@data_input_uid_254:out0", "@data_input_uid_255:out0" ],
|
||||
"inputs": [ "@uid_152:out0", "@data_input_uid_258:out0", "@data_input_uid_259:out0" ],
|
||||
"inut_shape": [ [ 20, 20, 1024, 1 ],[ 1, 1, 1024, 512 ],[ 512 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 20, 20, 512, 1 ] ]
|
||||
|
|
@ -575,7 +575,7 @@
|
|||
},
|
||||
"uid_116":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_133:out0", "@data_input_uid_256:out0", "@data_input_uid_257:out0" ],
|
||||
"inputs": [ "@uid_133:out0", "@data_input_uid_260:out0", "@data_input_uid_261:out0" ],
|
||||
"inut_shape": [ [ 20, 20, 512, 1 ],[ 1, 1, 512, 256 ],[ 256 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 20, 20, 256, 1 ] ]
|
||||
|
|
@ -603,14 +603,14 @@
|
|||
},
|
||||
"uid_174":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_189:out0", "@data_input_uid_258:out0", "@data_input_uid_259:out0" ],
|
||||
"inputs": [ "@uid_189:out0", "@data_input_uid_262:out0", "@data_input_uid_263:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 512, 1 ],[ 1, 1, 512, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 128, 1 ] ]
|
||||
},
|
||||
"uid_216":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_189:out0", "@data_input_uid_260:out0", "@data_input_uid_261:out0" ],
|
||||
"inputs": [ "@uid_189:out0", "@data_input_uid_264:out0", "@data_input_uid_265:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 512, 1 ],[ 1, 1, 512, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 128, 1 ] ]
|
||||
|
|
@ -631,7 +631,7 @@
|
|||
},
|
||||
"uid_200":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_214:out0", "@data_input_uid_262:out0", "@data_input_uid_263:out0" ],
|
||||
"inputs": [ "@uid_214:out0", "@data_input_uid_266:out0", "@data_input_uid_267:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 128, 1 ],[ 1, 1, 128, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 128, 1 ] ]
|
||||
|
|
@ -645,7 +645,7 @@
|
|||
},
|
||||
"uid_186":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_188:out0", "@data_input_uid_264:out0", "@data_input_uid_265:out0" ],
|
||||
"inputs": [ "@uid_188:out0", "@data_input_uid_268:out0", "@data_input_uid_269:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 128, 1 ],[ 3, 3, 128, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 128, 1 ] ]
|
||||
|
|
@ -666,7 +666,7 @@
|
|||
},
|
||||
"uid_141":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_158:out0", "@data_input_uid_266:out0", "@data_input_uid_267:out0" ],
|
||||
"inputs": [ "@uid_158:out0", "@data_input_uid_270:out0", "@data_input_uid_271:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 256, 1 ],[ 1, 1, 256, 256 ],[ 256 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 256, 1 ] ]
|
||||
|
|
@ -680,7 +680,7 @@
|
|||
},
|
||||
"uid_121":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_139:out0", "@data_input_uid_268:out0", "@data_input_uid_269:out0" ],
|
||||
"inputs": [ "@uid_139:out0", "@data_input_uid_272:out0", "@data_input_uid_273:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 256, 1 ],[ 1, 1, 256, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 128, 1 ] ]
|
||||
|
|
@ -708,14 +708,14 @@
|
|||
},
|
||||
"uid_81":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_102:out0", "@data_input_uid_270:out0", "@data_input_uid_271:out0" ],
|
||||
"inputs": [ "@uid_102:out0", "@data_input_uid_274:out0", "@data_input_uid_275:out0" ],
|
||||
"inut_shape": [ [ 80, 80, 256, 1 ],[ 1, 1, 256, 64 ],[ 64 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 80, 80, 64, 1 ] ]
|
||||
},
|
||||
"uid_159":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_102:out0", "@data_input_uid_272:out0", "@data_input_uid_273:out0" ],
|
||||
"inputs": [ "@uid_102:out0", "@data_input_uid_276:out0", "@data_input_uid_277:out0" ],
|
||||
"inut_shape": [ [ 80, 80, 256, 1 ],[ 1, 1, 256, 64 ],[ 64 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 80, 80, 64, 1 ] ]
|
||||
|
|
@ -736,7 +736,7 @@
|
|||
},
|
||||
"uid_126":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_142:out0", "@data_input_uid_274:out0", "@data_input_uid_275:out0" ],
|
||||
"inputs": [ "@uid_142:out0", "@data_input_uid_278:out0", "@data_input_uid_279:out0" ],
|
||||
"inut_shape": [ [ 80, 80, 64, 1 ],[ 1, 1, 64, 64 ],[ 64 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 80, 80, 64, 1 ] ]
|
||||
|
|
@ -750,7 +750,7 @@
|
|||
},
|
||||
"uid_100":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_123:out0", "@data_input_uid_276:out0", "@data_input_uid_277:out0" ],
|
||||
"inputs": [ "@uid_123:out0", "@data_input_uid_280:out0", "@data_input_uid_281:out0" ],
|
||||
"inut_shape": [ [ 80, 80, 64, 1 ],[ 3, 3, 64, 64 ],[ 64 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 80, 80, 64, 1 ] ]
|
||||
|
|
@ -771,7 +771,7 @@
|
|||
},
|
||||
"uid_36":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_57:out0", "@data_input_uid_278:out0", "@data_input_uid_279:out0" ],
|
||||
"inputs": [ "@uid_57:out0", "@data_input_uid_282:out0", "@data_input_uid_283:out0" ],
|
||||
"inut_shape": [ [ 80, 80, 128, 1 ],[ 1, 1, 128, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 80, 80, 128, 1 ] ]
|
||||
|
|
@ -785,14 +785,14 @@
|
|||
},
|
||||
"uid_16":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_22:out0", "@data_input_uid_280:out0", "@data_input_uid_281:out0" ],
|
||||
"inputs": [ "@uid_22:out0", "@data_input_uid_284:out0", "@data_input_uid_285:out0" ],
|
||||
"inut_shape": [ [ 80, 80, 128, 1 ],[ 1, 1, 128, 255 ],[ 255 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 80, 80, 255, 1 ] ]
|
||||
},
|
||||
"uid_137":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_22:out0", "@data_input_uid_282:out0", "@data_input_uid_283:out0" ],
|
||||
"inputs": [ "@uid_22:out0", "@data_input_uid_286:out0", "@data_input_uid_287:out0" ],
|
||||
"inut_shape": [ [ 80, 80, 128, 1 ],[ 3, 3, 128, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 128, 1 ] ]
|
||||
|
|
@ -834,14 +834,14 @@
|
|||
},
|
||||
"uid_78":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_98:out0", "@data_input_uid_284:out0", "@data_input_uid_285:out0" ],
|
||||
"inputs": [ "@uid_98:out0", "@data_input_uid_288:out0", "@data_input_uid_289:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 256, 1 ],[ 1, 1, 256, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 128, 1 ] ]
|
||||
},
|
||||
"uid_153":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_98:out0", "@data_input_uid_286:out0", "@data_input_uid_287:out0" ],
|
||||
"inputs": [ "@uid_98:out0", "@data_input_uid_290:out0", "@data_input_uid_291:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 256, 1 ],[ 1, 1, 256, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 128, 1 ] ]
|
||||
|
|
@ -883,21 +883,21 @@
|
|||
},
|
||||
"uid_61":{
|
||||
"op": "MULTIPLY",
|
||||
"inputs": [ "@uid_85:out0", "@data_input_uid_288:out0" ],
|
||||
"inputs": [ "@uid_85:out0", "@data_input_uid_292:out0" ],
|
||||
"inut_shape": [ [ 2, 80, 80, 3, 1 ],[ 1, 1, 1, 1, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 2, 80, 80, 3, 1 ] ]
|
||||
},
|
||||
"uid_83":{
|
||||
"op": "MULTIPLY",
|
||||
"inputs": [ "@uid_104:out0", "@data_input_uid_289:out0" ],
|
||||
"inputs": [ "@uid_104:out0", "@data_input_uid_293:out0" ],
|
||||
"inut_shape": [ [ 2, 80, 80, 3, 1 ],[ 1, 1, 1, 1, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 2, 80, 80, 3, 1 ] ]
|
||||
},
|
||||
"uid_135":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_136:out0", "@data_input_uid_290:out0", "@data_input_uid_291:out0" ],
|
||||
"inputs": [ "@uid_136:out0", "@data_input_uid_294:out0", "@data_input_uid_295:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 128, 1 ],[ 1, 1, 128, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 128, 1 ] ]
|
||||
|
|
@ -911,7 +911,7 @@
|
|||
},
|
||||
"uid_59":{
|
||||
"op": "SUBTRACT",
|
||||
"inputs": [ "@uid_83:out0", "@data_input_uid_292:out0" ],
|
||||
"inputs": [ "@uid_83:out0", "@data_input_uid_296:out0" ],
|
||||
"inut_shape": [ [ 2, 80, 80, 3, 1 ],[ 1, 1, 1, 1, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 2, 80, 80, 3, 1 ] ]
|
||||
|
|
@ -925,28 +925,28 @@
|
|||
},
|
||||
"uid_24":{
|
||||
"op": "MULTIPLY",
|
||||
"inputs": [ "@uid_40:out0", "@data_input_uid_293:out0" ],
|
||||
"inputs": [ "@uid_40:out0", "@data_input_uid_297:out0" ],
|
||||
"inut_shape": [ [ 2, 80, 80, 3, 1 ],[ 2, 80, 80, 3, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 2, 80, 80, 3, 1 ] ]
|
||||
},
|
||||
"uid_38":{
|
||||
"op": "ADD",
|
||||
"inputs": [ "@uid_59:out0", "@data_input_uid_294:out0" ],
|
||||
"inputs": [ "@uid_59:out0", "@data_input_uid_298:out0" ],
|
||||
"inut_shape": [ [ 2, 80, 80, 3, 1 ],[ 2, 80, 80, 3, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 2, 80, 80, 3, 1 ] ]
|
||||
},
|
||||
"uid_96":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_118:out0", "@data_input_uid_295:out0", "@data_input_uid_296:out0" ],
|
||||
"inputs": [ "@uid_118:out0", "@data_input_uid_299:out0", "@data_input_uid_300:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 128, 1 ],[ 3, 3, 128, 128 ],[ 128 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 128, 1 ] ]
|
||||
},
|
||||
"uid_23":{
|
||||
"op": "MULTIPLY",
|
||||
"inputs": [ "@uid_38:out0", "@data_input_uid_297:out0" ],
|
||||
"inputs": [ "@uid_38:out0", "@data_input_uid_301:out0" ],
|
||||
"inut_shape": [ [ 2, 80, 80, 3, 1 ],[ 1, 1, 1, 1, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 2, 80, 80, 3, 1 ] ]
|
||||
|
|
@ -981,7 +981,7 @@
|
|||
},
|
||||
"uid_34":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_55:out0", "@data_input_uid_298:out0", "@data_input_uid_299:out0" ],
|
||||
"inputs": [ "@uid_55:out0", "@data_input_uid_302:out0", "@data_input_uid_303:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 256, 1 ],[ 1, 1, 256, 256 ],[ 256 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 256, 1 ] ]
|
||||
|
|
@ -995,14 +995,14 @@
|
|||
},
|
||||
"uid_15":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_21:out0", "@data_input_uid_300:out0", "@data_input_uid_301:out0" ],
|
||||
"inputs": [ "@uid_21:out0", "@data_input_uid_304:out0", "@data_input_uid_305:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 256, 1 ],[ 1, 1, 256, 255 ],[ 255 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 40, 40, 255, 1 ] ]
|
||||
},
|
||||
"uid_131":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_21:out0", "@data_input_uid_302:out0", "@data_input_uid_303:out0" ],
|
||||
"inputs": [ "@uid_21:out0", "@data_input_uid_306:out0", "@data_input_uid_307:out0" ],
|
||||
"inut_shape": [ [ 40, 40, 256, 1 ],[ 3, 3, 256, 256 ],[ 256 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 20, 20, 256, 1 ] ]
|
||||
|
|
@ -1044,14 +1044,14 @@
|
|||
},
|
||||
"uid_75":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_94:out0", "@data_input_uid_304:out0", "@data_input_uid_305:out0" ],
|
||||
"inputs": [ "@uid_94:out0", "@data_input_uid_308:out0", "@data_input_uid_309:out0" ],
|
||||
"inut_shape": [ [ 20, 20, 512, 1 ],[ 1, 1, 512, 256 ],[ 256 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 20, 20, 256, 1 ] ]
|
||||
},
|
||||
"uid_147":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_94:out0", "@data_input_uid_306:out0", "@data_input_uid_307:out0" ],
|
||||
"inputs": [ "@uid_94:out0", "@data_input_uid_310:out0", "@data_input_uid_311:out0" ],
|
||||
"inut_shape": [ [ 20, 20, 512, 1 ],[ 1, 1, 512, 256 ],[ 256 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 20, 20, 256, 1 ] ]
|
||||
|
|
@ -1093,21 +1093,21 @@
|
|||
},
|
||||
"uid_66":{
|
||||
"op": "MULTIPLY",
|
||||
"inputs": [ "@uid_88:out0", "@data_input_uid_308:out0" ],
|
||||
"inputs": [ "@uid_88:out0", "@data_input_uid_312:out0" ],
|
||||
"inut_shape": [ [ 2, 40, 40, 3, 1 ],[ 1, 1, 1, 1, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 2, 40, 40, 3, 1 ] ]
|
||||
},
|
||||
"uid_86":{
|
||||
"op": "MULTIPLY",
|
||||
"inputs": [ "@uid_107:out0", "@data_input_uid_309:out0" ],
|
||||
"inputs": [ "@uid_107:out0", "@data_input_uid_313:out0" ],
|
||||
"inut_shape": [ [ 2, 40, 40, 3, 1 ],[ 1, 1, 1, 1, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 2, 40, 40, 3, 1 ] ]
|
||||
},
|
||||
"uid_129":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_130:out0", "@data_input_uid_310:out0", "@data_input_uid_311:out0" ],
|
||||
"inputs": [ "@uid_130:out0", "@data_input_uid_314:out0", "@data_input_uid_315:out0" ],
|
||||
"inut_shape": [ [ 20, 20, 256, 1 ],[ 1, 1, 256, 256 ],[ 256 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 20, 20, 256, 1 ] ]
|
||||
|
|
@ -1121,7 +1121,7 @@
|
|||
},
|
||||
"uid_64":{
|
||||
"op": "SUBTRACT",
|
||||
"inputs": [ "@uid_86:out0", "@data_input_uid_312:out0" ],
|
||||
"inputs": [ "@uid_86:out0", "@data_input_uid_316:out0" ],
|
||||
"inut_shape": [ [ 2, 40, 40, 3, 1 ],[ 1, 1, 1, 1, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 2, 40, 40, 3, 1 ] ]
|
||||
|
|
@ -1135,28 +1135,28 @@
|
|||
},
|
||||
"uid_27":{
|
||||
"op": "MULTIPLY",
|
||||
"inputs": [ "@uid_45:out0", "@data_input_uid_313:out0" ],
|
||||
"inputs": [ "@uid_45:out0", "@data_input_uid_317:out0" ],
|
||||
"inut_shape": [ [ 2, 40, 40, 3, 1 ],[ 2, 40, 40, 3, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 2, 40, 40, 3, 1 ] ]
|
||||
},
|
||||
"uid_43":{
|
||||
"op": "ADD",
|
||||
"inputs": [ "@uid_64:out0", "@data_input_uid_314:out0" ],
|
||||
"inputs": [ "@uid_64:out0", "@data_input_uid_318:out0" ],
|
||||
"inut_shape": [ [ 2, 40, 40, 3, 1 ],[ 2, 40, 40, 3, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 2, 40, 40, 3, 1 ] ]
|
||||
},
|
||||
"uid_92":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_113:out0", "@data_input_uid_315:out0", "@data_input_uid_316:out0" ],
|
||||
"inputs": [ "@uid_113:out0", "@data_input_uid_319:out0", "@data_input_uid_320:out0" ],
|
||||
"inut_shape": [ [ 20, 20, 256, 1 ],[ 3, 3, 256, 256 ],[ 256 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 20, 20, 256, 1 ] ]
|
||||
},
|
||||
"uid_26":{
|
||||
"op": "MULTIPLY",
|
||||
"inputs": [ "@uid_43:out0", "@data_input_uid_317:out0" ],
|
||||
"inputs": [ "@uid_43:out0", "@data_input_uid_321:out0" ],
|
||||
"inut_shape": [ [ 2, 40, 40, 3, 1 ],[ 1, 1, 1, 1, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 2, 40, 40, 3, 1 ] ]
|
||||
|
|
@ -1191,7 +1191,7 @@
|
|||
},
|
||||
"uid_32":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_53:out0", "@data_input_uid_318:out0", "@data_input_uid_319:out0" ],
|
||||
"inputs": [ "@uid_53:out0", "@data_input_uid_322:out0", "@data_input_uid_323:out0" ],
|
||||
"inut_shape": [ [ 20, 20, 512, 1 ],[ 1, 1, 512, 512 ],[ 512 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 20, 20, 512, 1 ] ]
|
||||
|
|
@ -1205,7 +1205,7 @@
|
|||
},
|
||||
"uid_14":{
|
||||
"op": "CONV2D",
|
||||
"inputs": [ "@uid_20:out0", "@data_input_uid_320:out0", "@data_input_uid_321:out0" ],
|
||||
"inputs": [ "@uid_20:out0", "@data_input_uid_324:out0", "@data_input_uid_325:out0" ],
|
||||
"inut_shape": [ [ 20, 20, 512, 1 ],[ 1, 1, 512, 255 ],[ 255 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 20, 20, 255, 1 ] ]
|
||||
|
|
@ -1254,14 +1254,14 @@
|
|||
},
|
||||
"uid_71":{
|
||||
"op": "MULTIPLY",
|
||||
"inputs": [ "@uid_91:out0", "@data_input_uid_322:out0" ],
|
||||
"inputs": [ "@uid_91:out0", "@data_input_uid_326:out0" ],
|
||||
"inut_shape": [ [ 2, 20, 20, 3, 1 ],[ 1, 1, 1, 1, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 2, 20, 20, 3, 1 ] ]
|
||||
},
|
||||
"uid_89":{
|
||||
"op": "MULTIPLY",
|
||||
"inputs": [ "@uid_110:out0", "@data_input_uid_323:out0" ],
|
||||
"inputs": [ "@uid_110:out0", "@data_input_uid_327:out0" ],
|
||||
"inut_shape": [ [ 2, 20, 20, 3, 1 ],[ 1, 1, 1, 1, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 2, 20, 20, 3, 1 ] ]
|
||||
|
|
@ -1275,28 +1275,28 @@
|
|||
},
|
||||
"uid_69":{
|
||||
"op": "SUBTRACT",
|
||||
"inputs": [ "@uid_89:out0", "@data_input_uid_324:out0" ],
|
||||
"inputs": [ "@uid_89:out0", "@data_input_uid_328:out0" ],
|
||||
"inut_shape": [ [ 2, 20, 20, 3, 1 ],[ 1, 1, 1, 1, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 2, 20, 20, 3, 1 ] ]
|
||||
},
|
||||
"uid_30":{
|
||||
"op": "MULTIPLY",
|
||||
"inputs": [ "@uid_50:out0", "@data_input_uid_325:out0" ],
|
||||
"inputs": [ "@uid_50:out0", "@data_input_uid_329:out0" ],
|
||||
"inut_shape": [ [ 2, 20, 20, 3, 1 ],[ 2, 20, 20, 3, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 2, 20, 20, 3, 1 ] ]
|
||||
},
|
||||
"uid_48":{
|
||||
"op": "ADD",
|
||||
"inputs": [ "@uid_69:out0", "@data_input_uid_326:out0" ],
|
||||
"inputs": [ "@uid_69:out0", "@data_input_uid_330:out0" ],
|
||||
"inut_shape": [ [ 2, 20, 20, 3, 1 ],[ 2, 20, 20, 3, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 2, 20, 20, 3, 1 ] ]
|
||||
},
|
||||
"uid_29":{
|
||||
"op": "MULTIPLY",
|
||||
"inputs": [ "@uid_48:out0", "@data_input_uid_327:out0" ],
|
||||
"inputs": [ "@uid_48:out0", "@data_input_uid_331:out0" ],
|
||||
"inut_shape": [ [ 2, 20, 20, 3, 1 ],[ 1, 1, 1, 1, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 2, 20, 20, 3, 1 ] ]
|
||||
|
|
@ -1322,40 +1322,40 @@
|
|||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 85, 25200, 1 ] ]
|
||||
},
|
||||
"data_input_uid_189":{
|
||||
"op": "DATA_INPUT",
|
||||
"inputs": [ ],
|
||||
"inut_shape": [ [ ] ],
|
||||
"uid_10000":{
|
||||
"op": "PRE_PROCESS",
|
||||
"inputs": [ "@data_input_uid_332:out0" ],
|
||||
"inut_shape": [ [ 640, 640, 3, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ ] ]
|
||||
"output_shape": [ [ 640, 640, 3, 1 ] ]
|
||||
},
|
||||
"data_input_uid_190":{
|
||||
"op": "DATA_INPUT",
|
||||
"inputs": [ ],
|
||||
"inut_shape": [ [ ] ],
|
||||
"uid_20000":{
|
||||
"op": "POST_PROCESS",
|
||||
"inputs": [ "@uid_7:out0" ],
|
||||
"inut_shape": [ [ 85, 25200, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ ] ]
|
||||
"output_shape": [ [ 85, 25200, 1 ] ]
|
||||
},
|
||||
"data_input_uid_191":{
|
||||
"op": "DATA_INPUT",
|
||||
"inputs": [ ],
|
||||
"inut_shape": [ [ ] ],
|
||||
"uid_20001":{
|
||||
"op": "POST_PROCESS",
|
||||
"inputs": [ "@uid_6:out0" ],
|
||||
"inut_shape": [ [ 85, 80, 80, 3, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ ] ]
|
||||
"output_shape": [ [ 85, 80, 80, 3, 1 ] ]
|
||||
},
|
||||
"data_input_uid_192":{
|
||||
"op": "DATA_INPUT",
|
||||
"inputs": [ ],
|
||||
"inut_shape": [ [ ] ],
|
||||
"uid_20002":{
|
||||
"op": "POST_PROCESS",
|
||||
"inputs": [ "@uid_5:out0" ],
|
||||
"inut_shape": [ [ 85, 40, 40, 3, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ ] ]
|
||||
"output_shape": [ [ 85, 40, 40, 3, 1 ] ]
|
||||
},
|
||||
"data_input_uid_193":{
|
||||
"op": "DATA_INPUT",
|
||||
"inputs": [ ],
|
||||
"inut_shape": [ [ ] ],
|
||||
"uid_20003":{
|
||||
"op": "POST_PROCESS",
|
||||
"inputs": [ "@uid_4:out0" ],
|
||||
"inut_shape": [ [ 85, 20, 20, 3, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ ] ]
|
||||
"output_shape": [ [ 85, 20, 20, 3, 1 ] ]
|
||||
},
|
||||
"data_input_uid_194":{
|
||||
"op": "DATA_INPUT",
|
||||
|
|
@ -2294,6 +2294,41 @@
|
|||
"inut_shape": [ [ ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ ] ]
|
||||
},
|
||||
"data_input_uid_328":{
|
||||
"op": "DATA_INPUT",
|
||||
"inputs": [ ],
|
||||
"inut_shape": [ [ ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ ] ]
|
||||
},
|
||||
"data_input_uid_329":{
|
||||
"op": "DATA_INPUT",
|
||||
"inputs": [ ],
|
||||
"inut_shape": [ [ ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ ] ]
|
||||
},
|
||||
"data_input_uid_330":{
|
||||
"op": "DATA_INPUT",
|
||||
"inputs": [ ],
|
||||
"inut_shape": [ [ ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ ] ]
|
||||
},
|
||||
"data_input_uid_331":{
|
||||
"op": "DATA_INPUT",
|
||||
"inputs": [ ],
|
||||
"inut_shape": [ [ ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ ] ]
|
||||
},
|
||||
"data_input_uid_332":{
|
||||
"op": "DATA_INPUT",
|
||||
"inputs": [ ],
|
||||
"inut_shape": [ [ ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ ] ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network application project entry file
|
||||
|
|
@ -43,11 +43,11 @@ static void vnn_ReleaseNeuralNetwork
|
|||
vsi_nn_graph_t *graph
|
||||
)
|
||||
{
|
||||
if (vnn_UseImagePreprocessNode(graph))
|
||||
vnn_ReleaseYolov5sAsymu8( graph, TRUE );
|
||||
if (vnn_UseImagePreprocessNode())
|
||||
{
|
||||
vnn_ReleaseBufferImage();
|
||||
}
|
||||
vnn_ReleaseYolov5sAsymu8( graph, TRUE );
|
||||
}
|
||||
|
||||
static vsi_status vnn_PostProcessNeuralNetwork
|
||||
|
|
@ -108,7 +108,7 @@ static vsi_status vnn_ProcessGraph
|
|||
vsi_status status = VSI_FAILURE;
|
||||
int32_t i,loop;
|
||||
char *loop_s;
|
||||
uint64_t tmsTotal = 0, tmsSig, sigStart, sigEnd;
|
||||
uint64_t tmsStart, tmsEnd, sigStart, sigEnd;
|
||||
float msVal, usVal;
|
||||
|
||||
status = VSI_FAILURE;
|
||||
|
|
@ -120,6 +120,7 @@ static vsi_status vnn_ProcessGraph
|
|||
}
|
||||
|
||||
/* Run graph */
|
||||
tmsStart = get_perf_count();
|
||||
printf("Start run graph [%d] times...\n", loop);
|
||||
for(i = 0; i < loop; i++)
|
||||
{
|
||||
|
|
@ -149,14 +150,13 @@ static vsi_status vnn_ProcessGraph
|
|||
TEST_CHECK_STATUS( status, final );
|
||||
|
||||
sigEnd = get_perf_count();
|
||||
tmsSig = sigEnd - sigStart;
|
||||
msVal = tmsSig / (float)1000000;
|
||||
usVal = tmsSig / (float)1000;
|
||||
tmsTotal += tmsSig;
|
||||
msVal = (sigEnd - sigStart)/(float)1000000;
|
||||
usVal = (sigEnd - sigStart)/(float)1000;
|
||||
printf("Run the %u time: %.2fms or %.2fus\n", (i + 1), msVal, usVal);
|
||||
}
|
||||
msVal = tmsTotal / (float)1000000;
|
||||
usVal = tmsTotal / (float)1000;
|
||||
tmsEnd = get_perf_count();
|
||||
msVal = (tmsEnd - tmsStart)/(float)1000000;
|
||||
usVal = (tmsEnd - tmsStart)/(float)1000;
|
||||
printf("vxProcessGraph execution time:\n");
|
||||
printf("Total %.2fms or %.2fus\n", msVal, usVal);
|
||||
printf("Average %.2fms or %.2fus\n", ((float)usVal)/1000/loop, ((float)usVal)/loop);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network global header file
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network appliction post-process source file
|
||||
|
|
@ -21,9 +21,51 @@
|
|||
/*-------------------------------------------
|
||||
Variable definitions
|
||||
-------------------------------------------*/
|
||||
/*post process for lid: attach_output/out0_0*/
|
||||
int32_t perm_0[] = {0, 1, 2};
|
||||
vsi_nn_postprocess_permute_t permute_for_norm_tensor_0 = {perm_0, 3};
|
||||
vsi_nn_postprocess_dtype_convert_t dtype_convert_for_norm_tensor_0 = {{VSI_NN_DIM_FMT_NCHW, VSI_NN_TYPE_FLOAT32, {VSI_NN_QNT_TYPE_NONE}}};
|
||||
vsi_nn_postprocess_base_t post_process_for_norm_tensor_0[] =
|
||||
{
|
||||
{VSI_NN_POSTPROCESS_PERMUTE, &permute_for_norm_tensor_0},
|
||||
{VSI_NN_POSTPROCESS_DTYPE_CONVERT, &dtype_convert_for_norm_tensor_0},
|
||||
};
|
||||
/*post process for lid: attach_339/out0_1*/
|
||||
int32_t perm_1[] = {0, 1, 2, 3, 4};
|
||||
vsi_nn_postprocess_permute_t permute_for_norm_tensor_1 = {perm_1, 5};
|
||||
vsi_nn_postprocess_dtype_convert_t dtype_convert_for_norm_tensor_1 = {{VSI_NN_DIM_FMT_NCHW, VSI_NN_TYPE_FLOAT32, {VSI_NN_QNT_TYPE_NONE}}};
|
||||
vsi_nn_postprocess_base_t post_process_for_norm_tensor_1[] =
|
||||
{
|
||||
{VSI_NN_POSTPROCESS_PERMUTE, &permute_for_norm_tensor_1},
|
||||
{VSI_NN_POSTPROCESS_DTYPE_CONVERT, &dtype_convert_for_norm_tensor_1},
|
||||
};
|
||||
/*post process for lid: attach_391/out0_2*/
|
||||
int32_t perm_2[] = {0, 1, 2, 3, 4};
|
||||
vsi_nn_postprocess_permute_t permute_for_norm_tensor_2 = {perm_2, 5};
|
||||
vsi_nn_postprocess_dtype_convert_t dtype_convert_for_norm_tensor_2 = {{VSI_NN_DIM_FMT_NCHW, VSI_NN_TYPE_FLOAT32, {VSI_NN_QNT_TYPE_NONE}}};
|
||||
vsi_nn_postprocess_base_t post_process_for_norm_tensor_2[] =
|
||||
{
|
||||
{VSI_NN_POSTPROCESS_PERMUTE, &permute_for_norm_tensor_2},
|
||||
{VSI_NN_POSTPROCESS_DTYPE_CONVERT, &dtype_convert_for_norm_tensor_2},
|
||||
};
|
||||
/*post process for lid: attach_443/out0_3*/
|
||||
int32_t perm_3[] = {0, 1, 2, 3, 4};
|
||||
vsi_nn_postprocess_permute_t permute_for_norm_tensor_3 = {perm_3, 5};
|
||||
vsi_nn_postprocess_dtype_convert_t dtype_convert_for_norm_tensor_3 = {{VSI_NN_DIM_FMT_NCHW, VSI_NN_TYPE_FLOAT32, {VSI_NN_QNT_TYPE_NONE}}};
|
||||
vsi_nn_postprocess_base_t post_process_for_norm_tensor_3[] =
|
||||
{
|
||||
{VSI_NN_POSTPROCESS_PERMUTE, &permute_for_norm_tensor_3},
|
||||
{VSI_NN_POSTPROCESS_DTYPE_CONVERT, &dtype_convert_for_norm_tensor_3},
|
||||
};
|
||||
|
||||
/*{graph_output_idx, postprocess}*/
|
||||
const static vsi_nn_postprocess_map_element_t* postprocess_map = NULL;
|
||||
const static vsi_nn_postprocess_map_element_t postprocess_map[] =
|
||||
{
|
||||
{0, post_process_for_norm_tensor_0, sizeof(post_process_for_norm_tensor_0) / sizeof(vsi_nn_postprocess_base_t)},
|
||||
{1, post_process_for_norm_tensor_1, sizeof(post_process_for_norm_tensor_1) / sizeof(vsi_nn_postprocess_base_t)},
|
||||
{2, post_process_for_norm_tensor_2, sizeof(post_process_for_norm_tensor_2) / sizeof(vsi_nn_postprocess_base_t)},
|
||||
{3, post_process_for_norm_tensor_3, sizeof(post_process_for_norm_tensor_3) / sizeof(vsi_nn_postprocess_base_t)},
|
||||
};
|
||||
|
||||
|
||||
/*-------------------------------------------
|
||||
|
|
@ -166,5 +208,8 @@ const vsi_nn_postprocess_map_element_t * vnn_GetPostProcessMap()
|
|||
|
||||
uint32_t vnn_GetPostProcessMapCount()
|
||||
{
|
||||
return 0;
|
||||
if (postprocess_map == NULL)
|
||||
return 0;
|
||||
else
|
||||
return sizeof(postprocess_map) / sizeof(vsi_nn_postprocess_map_element_t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network appliction post-process header file
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network appliction pre-process source file
|
||||
|
|
@ -10,12 +10,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "jpeglib.h"
|
||||
#include "vsi_nn_pub.h"
|
||||
|
|
@ -27,16 +21,43 @@
|
|||
/*-------------------------------------------
|
||||
Variable definitions
|
||||
-------------------------------------------*/
|
||||
/*pre process for lid: images_270*/
|
||||
vsi_nn_preprocess_source_layout_e source_layout_for_norm_tensor_4 = VSI_NN_SOURCE_LAYOUT_NCHW;
|
||||
vsi_nn_preprocess_source_format_e source_format_for_norm_tensor_4 = VSI_NN_SOURCE_FORMAT_IMAGE_RGB888_PLANAR;
|
||||
vsi_nn_preprocess_image_size_t size_for_norm_tensor_4 = {640, 640, 3};
|
||||
|
||||
vsi_nn_preprocess_image_resize_t resize_for_norm_tensor_4 = {640, 640, 3};
|
||||
int8_t reverse_channel_for_norm_tensor_4 = 1;
|
||||
float mean_and_scale_4[] = {0.0, 0.0, 0.0};
|
||||
vsi_nn_preprocess_mean_and_scale_t mean_and_scale_for_norm_tensor_4 = {mean_and_scale_4, 3, 0.003921569};
|
||||
int32_t perm_4[] = {0, 1, 2, 3};
|
||||
vsi_nn_preprocess_permute_t permute_for_norm_tensor_4 = {perm_4, 4};
|
||||
vsi_nn_preprocess_dtype_convert_t dtype_converter_for_norm_tensor4={.dtype.fmt=VSI_NN_DIM_FMT_NCHW, .dtype.vx_type=VSI_NN_TYPE_UINT8, .dtype.qnt_type=VSI_NN_QNT_TYPE_AFFINE_ASYMMETRIC, .dtype.zero_point=0, .dtype.scale=0.003921568859368563};
|
||||
vsi_nn_preprocess_base_t pre_process_for_norm_tensor_4[] =
|
||||
{
|
||||
{VSI_NN_PREPROCESS_SOURCE_LAYOUT, &source_layout_for_norm_tensor_4},
|
||||
{VSI_NN_PREPROCESS_SET_SOURCE_FORMAT, &source_format_for_norm_tensor_4},
|
||||
|
||||
{VSI_NN_PREPROCESS_IMAGE_SIZE, &size_for_norm_tensor_4},
|
||||
{VSI_NN_PREPROCESS_IMAGE_RESIZE_BILINEAR, &resize_for_norm_tensor_4},
|
||||
{VSI_NN_PREPROCESS_REVERSE_CHANNEL, &reverse_channel_for_norm_tensor_4},
|
||||
{VSI_NN_PREPROCESS_MEAN_AND_SCALE, &mean_and_scale_for_norm_tensor_4},
|
||||
{VSI_NN_PREPROCESS_PERMUTE, &permute_for_norm_tensor_4},
|
||||
{VSI_NN_PREPROCESS_DTYPE_CONVERT, &dtype_converter_for_norm_tensor4},
|
||||
};
|
||||
|
||||
/*{graph_input_idx, preprocess}*/
|
||||
const static vsi_nn_preprocess_map_element_t* preprocess_map = NULL;
|
||||
const static vsi_nn_preprocess_map_element_t preprocess_map[] =
|
||||
{
|
||||
{0, pre_process_for_norm_tensor_4, sizeof(pre_process_for_norm_tensor_4) / sizeof(vsi_nn_preprocess_base_t)},
|
||||
};
|
||||
|
||||
/*-------------------------------------------
|
||||
Functions
|
||||
-------------------------------------------*/
|
||||
#define INPUT_META_NUM 1
|
||||
static vnn_input_meta_t input_meta_tab[INPUT_META_NUM];
|
||||
static void _load_input_meta(vsi_nn_graph_t *graph)
|
||||
static void _load_input_meta()
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < INPUT_META_NUM; i++)
|
||||
|
|
@ -44,7 +65,17 @@ static void _load_input_meta(vsi_nn_graph_t *graph)
|
|||
memset(&input_meta_tab[i].image.preprocess,
|
||||
VNN_PREPRO_NONE, sizeof(int32_t) * VNN_PREPRO_NUM);
|
||||
}
|
||||
/* lid: images_270 */
|
||||
if (vnn_UseImagePreprocessNode())
|
||||
{
|
||||
/* lid: images_270 */
|
||||
input_meta_tab[0].image.preprocess[0] = VNN_PREPRO_NONE;
|
||||
input_meta_tab[0].image.preprocess[1] = VNN_PREPRO_NONE;
|
||||
input_meta_tab[0].image.preprocess[2] = VNN_PREPRO_NONE;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* lid: images_270 */
|
||||
input_meta_tab[0].image.preprocess[0] = VNN_PREPRO_REORDER;
|
||||
input_meta_tab[0].image.preprocess[1] = VNN_PREPRO_MEAN;
|
||||
input_meta_tab[0].image.preprocess[2] = VNN_PREPRO_SCALE;
|
||||
|
|
@ -58,6 +89,7 @@ static void _load_input_meta(vsi_nn_graph_t *graph)
|
|||
input_meta_tab[0].image.scale[1] = 0.003921569;
|
||||
input_meta_tab[0].image.scale[2] = 0.003921569;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -538,14 +570,13 @@ static uint8_t *_get_jpeg_data
|
|||
(
|
||||
vsi_nn_tensor_t *tensor,
|
||||
vnn_input_meta_t *meta,
|
||||
const char *filename,
|
||||
vsi_nn_graph_t* graph
|
||||
const char *filename
|
||||
)
|
||||
{
|
||||
uint32_t i;
|
||||
uint8_t *bmpData,*data;
|
||||
float *fdata;
|
||||
vsi_bool use_image_process = vnn_UseImagePreprocessNode(graph);
|
||||
vsi_bool use_image_process = vnn_UseImagePreprocessNode();
|
||||
|
||||
bmpData = NULL;
|
||||
fdata = NULL;
|
||||
|
|
@ -665,7 +696,7 @@ static vsi_status _handle_multiple_inputs
|
|||
switch(fileType)
|
||||
{
|
||||
case NN_FILE_JPG:
|
||||
data = _get_jpeg_data(tensor, &meta, input_file, graph);
|
||||
data = _get_jpeg_data(tensor, &meta, input_file);
|
||||
TEST_CHECK_PTR(data, final);
|
||||
break;
|
||||
case NN_FILE_TENSOR:
|
||||
|
|
@ -690,11 +721,7 @@ static vsi_status _handle_multiple_inputs
|
|||
TEST_CHECK_STATUS(status, final);
|
||||
|
||||
/* Save the image data to file */
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
p1 = vsi_nn_GetRunTimeVariable(graph, "VSI_SAVE_FILE_TYPE");
|
||||
#else
|
||||
p1 = getenv("VSI_SAVE_FILE_TYPE");
|
||||
#endif
|
||||
p1 = getenv( "VSI_SAVE_FILE_TYPE");
|
||||
|
||||
snprintf(dumpInput, sizeof(dumpInput), "input_%d.dat", idx);
|
||||
vsi_nn_SaveTensorToBinary(graph, tensor, dumpInput);
|
||||
|
|
@ -703,9 +730,6 @@ static vsi_status _handle_multiple_inputs
|
|||
status = VSI_SUCCESS;
|
||||
final:
|
||||
if(data)free(data);
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
if(p1)vsi_nn_Free(p1);
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
@ -715,26 +739,16 @@ void vnn_ReleaseBufferImage()
|
|||
buffer_img = NULL;
|
||||
}
|
||||
|
||||
vsi_bool vnn_UseImagePreprocessNode(vsi_nn_graph_t* graph)
|
||||
vsi_bool vnn_UseImagePreprocessNode()
|
||||
{
|
||||
int32_t use_img_process;
|
||||
char *use_img_process_s;
|
||||
use_img_process = 0; /* default is 0 */
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
use_img_process_s = vsi_nn_GetRunTimeVariable(graph, "VSI_USE_IMAGE_PROCESS");
|
||||
if(use_img_process_s)
|
||||
{
|
||||
use_img_process = atoi(use_img_process_s);
|
||||
vsi_nn_Free(use_img_process_s);
|
||||
use_img_process_s = NULL;
|
||||
}
|
||||
#else
|
||||
use_img_process_s = getenv("VSI_USE_IMAGE_PROCESS");
|
||||
if(use_img_process_s)
|
||||
{
|
||||
use_img_process = atoi(use_img_process_s);
|
||||
}
|
||||
#endif
|
||||
use_img_process_s = getenv("VSI_USE_IMAGE_PROCESS");
|
||||
if(use_img_process_s)
|
||||
{
|
||||
use_img_process = atoi(use_img_process_s);
|
||||
}
|
||||
if (use_img_process)
|
||||
{
|
||||
return TRUE;
|
||||
|
|
@ -752,7 +766,7 @@ vsi_status vnn_PreProcessYolov5sAsymu8
|
|||
uint32_t i;
|
||||
vsi_status status;
|
||||
status = VSI_FAILURE;
|
||||
_load_input_meta(graph);
|
||||
_load_input_meta();
|
||||
if(input_num != graph->input.num)
|
||||
{
|
||||
printf("Graph need %u inputs, but enter %u inputs!!!\n",
|
||||
|
|
@ -917,5 +931,8 @@ const vsi_nn_preprocess_map_element_t * vnn_GetPreProcessMap()
|
|||
|
||||
uint32_t vnn_GetPreProcessMapCount()
|
||||
{
|
||||
return 0;
|
||||
if (preprocess_map == NULL)
|
||||
return 0;
|
||||
else
|
||||
return sizeof(preprocess_map) / sizeof(vsi_nn_preprocess_map_element_t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network appliction pre-process header file
|
||||
|
|
@ -47,7 +47,7 @@ vsi_status vnn_PreProcessYolov5sAsymu8
|
|||
uint32_t input_num
|
||||
);
|
||||
|
||||
vsi_bool vnn_UseImagePreprocessNode(vsi_nn_graph_t* graph);
|
||||
vsi_bool vnn_UseImagePreprocessNode();
|
||||
|
||||
void vnn_ReleaseBufferImage();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network appliction network definition header file
|
||||
|
|
@ -36,18 +36,4 @@ vsi_nn_graph_t * vnn_CreateYolov5sAsymu8
|
|||
uint32_t post_process_map_count
|
||||
);
|
||||
|
||||
void** vnn_CreateYolov5sAsymu8Tensor
|
||||
(
|
||||
const char * data_file_name,
|
||||
vsi_nn_graph_t * graph,
|
||||
vsi_nn_node_t * node[],
|
||||
vsi_nn_tensor_id_t norm_tensor[],
|
||||
vsi_nn_tensor_id_t const_tensor[]
|
||||
);
|
||||
|
||||
void vnn_ReleaseYolov5sAsymu8TensorQuantParams
|
||||
(
|
||||
void ** pp_scales_zps
|
||||
);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -214,7 +214,6 @@
|
|||
<ClInclude Include="vnn_pre_process.h" />
|
||||
<ClInclude Include="vnn_global.h" />
|
||||
<ClCompile Include="vnn_yolov5sasymu8.c" />
|
||||
<ClCompile Include="vnn_yolov5sasymu8_tensor.c" />
|
||||
<ClCompile Include="vnn_post_process.c" />
|
||||
<ClCompile Include="vnn_pre_process.c" />
|
||||
<ClCompile Include="main.c" />
|
||||
|
|
|
|||
|
|
@ -128,13 +128,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(AQROOT)\sdk\inc;$(OVXLIB_PATH)\include;$(OVXLIB_PATH)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIVANTE_SDK_DIR)\lib;$(VIVANTE_SDK_DIR)\bin;$(SolutionDir)$(Configuration);</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
|
@ -143,13 +141,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(AQROOT)\sdk\inc;$(OVXLIB_PATH)\include;$(OVXLIB_PATH)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIVANTE_SDK_DIR)\lib;$(VIVANTE_SDK_DIR)\bin;$(SolutionDir)$(Configuration);</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Jenkins-Debug|Win32'">
|
||||
|
|
@ -158,13 +154,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(VIV_SDK_PATH)\include;$(SolutionDir)\include;$(SolutionDir)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIV_SDK_PATH)\lib\win32;$(SolutionDir)$(Configuration)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Jenkins-Debug|x64'">
|
||||
|
|
@ -173,13 +167,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(VIV_SDK_PATH)\include;$(SolutionDir)\include;$(SolutionDir)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIV_SDK_PATH)\lib\win32;$(SolutionDir)$(Configuration)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
|
|
@ -190,7 +182,6 @@
|
|||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
|
@ -198,7 +189,6 @@
|
|||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
|
@ -209,7 +199,6 @@
|
|||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
|
@ -217,7 +206,6 @@
|
|||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
@ -226,7 +214,6 @@
|
|||
<ClInclude Include="vnn_pre_process.h" />
|
||||
<ClInclude Include="vnn_global.h" />
|
||||
<ClCompile Include="vnn_yolov5sasymu8.c" />
|
||||
<ClCompile Include="vnn_yolov5sasymu8_tensor.c" />
|
||||
<ClCompile Include="vnn_post_process.c" />
|
||||
<ClCompile Include="vnn_pre_process.c" />
|
||||
<ClCompile Include="main.c" />
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ filegroup(
|
|||
srcs =
|
||||
[
|
||||
"vnn_yolov5sasymu8.c",
|
||||
"vnn_yolov5sasymu8_tensor.c",
|
||||
"vnn_yolov5sasymu8.h",
|
||||
"vnn_post_process.c",
|
||||
"vnn_post_process.h",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network application project entry file
|
||||
|
|
@ -43,11 +43,11 @@ static void vnn_ReleaseNeuralNetwork
|
|||
vsi_nn_graph_t *graph
|
||||
)
|
||||
{
|
||||
if (vnn_UseImagePreprocessNode(graph))
|
||||
vnn_ReleaseYolov5sAsymu8( graph, TRUE );
|
||||
if (vnn_UseImagePreprocessNode())
|
||||
{
|
||||
vnn_ReleaseBufferImage();
|
||||
}
|
||||
vnn_ReleaseYolov5sAsymu8( graph, TRUE );
|
||||
}
|
||||
|
||||
static vsi_status vnn_PostProcessNeuralNetwork
|
||||
|
|
@ -108,7 +108,7 @@ static vsi_status vnn_ProcessGraph
|
|||
vsi_status status = VSI_FAILURE;
|
||||
int32_t i,loop;
|
||||
char *loop_s;
|
||||
uint64_t tmsTotal = 0, tmsSig, sigStart, sigEnd;
|
||||
uint64_t tmsStart, tmsEnd, sigStart, sigEnd;
|
||||
float msVal, usVal;
|
||||
|
||||
status = VSI_FAILURE;
|
||||
|
|
@ -120,6 +120,7 @@ static vsi_status vnn_ProcessGraph
|
|||
}
|
||||
|
||||
/* Run graph */
|
||||
tmsStart = get_perf_count();
|
||||
printf("Start run graph [%d] times...\n", loop);
|
||||
for(i = 0; i < loop; i++)
|
||||
{
|
||||
|
|
@ -149,14 +150,13 @@ static vsi_status vnn_ProcessGraph
|
|||
TEST_CHECK_STATUS( status, final );
|
||||
|
||||
sigEnd = get_perf_count();
|
||||
tmsSig = sigEnd - sigStart;
|
||||
msVal = tmsSig / (float)1000000;
|
||||
usVal = tmsSig / (float)1000;
|
||||
tmsTotal += tmsSig;
|
||||
msVal = (sigEnd - sigStart)/(float)1000000;
|
||||
usVal = (sigEnd - sigStart)/(float)1000;
|
||||
printf("Run the %u time: %.2fms or %.2fus\n", (i + 1), msVal, usVal);
|
||||
}
|
||||
msVal = tmsTotal / (float)1000000;
|
||||
usVal = tmsTotal / (float)1000;
|
||||
tmsEnd = get_perf_count();
|
||||
msVal = (tmsEnd - tmsStart)/(float)1000000;
|
||||
usVal = (tmsEnd - tmsStart)/(float)1000;
|
||||
printf("vxProcessGraph execution time:\n");
|
||||
printf("Total %.2fms or %.2fus\n", msVal, usVal);
|
||||
printf("Average %.2fms or %.2fus\n", ((float)usVal)/1000/loop, ((float)usVal)/loop);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"Inputs": {
|
||||
"images_270": {
|
||||
"name": "images",
|
||||
"images_270_0": {
|
||||
"name": "images_0",
|
||||
"shape": [
|
||||
1,
|
||||
3,
|
||||
|
|
@ -9,14 +9,7 @@
|
|||
640
|
||||
],
|
||||
"format": "nchw",
|
||||
"quantizer": "asymmetric_affine",
|
||||
"quantize": {
|
||||
"qtype": "u8",
|
||||
"max_value": 0.9650118350982666,
|
||||
"min_value": 0.0,
|
||||
"scale": 0.0037843601312488317,
|
||||
"zero_point": 0
|
||||
}
|
||||
"dtype": "uint8"
|
||||
}
|
||||
},
|
||||
"Outputs": {
|
||||
|
|
@ -28,14 +21,7 @@
|
|||
85
|
||||
],
|
||||
"format": "nchw",
|
||||
"quantizer": "asymmetric_affine",
|
||||
"quantize": {
|
||||
"qtype": "u8",
|
||||
"max_value": 659.4277954101562,
|
||||
"min_value": 0.0,
|
||||
"scale": 2.585991382598877,
|
||||
"zero_point": 0
|
||||
}
|
||||
"dtype": "float32"
|
||||
},
|
||||
"attach_339/out0_1": {
|
||||
"name": "attach_339/out0",
|
||||
|
|
@ -47,14 +33,7 @@
|
|||
85
|
||||
],
|
||||
"format": "nchw",
|
||||
"quantizer": "asymmetric_affine",
|
||||
"quantize": {
|
||||
"qtype": "u8",
|
||||
"max_value": 5.013521671295166,
|
||||
"min_value": -17.889921188354492,
|
||||
"scale": 0.08981741964817047,
|
||||
"zero_point": 199
|
||||
}
|
||||
"dtype": "float32"
|
||||
},
|
||||
"attach_391/out0_2": {
|
||||
"name": "attach_391/out0",
|
||||
|
|
@ -66,14 +45,7 @@
|
|||
85
|
||||
],
|
||||
"format": "nchw",
|
||||
"quantizer": "asymmetric_affine",
|
||||
"quantize": {
|
||||
"qtype": "u8",
|
||||
"max_value": 5.321844100952148,
|
||||
"min_value": -13.926451683044434,
|
||||
"scale": 0.07548350840806961,
|
||||
"zero_point": 184
|
||||
}
|
||||
"dtype": "float32"
|
||||
},
|
||||
"attach_443/out0_3": {
|
||||
"name": "attach_443/out0",
|
||||
|
|
@ -85,14 +57,7 @@
|
|||
85
|
||||
],
|
||||
"format": "nchw",
|
||||
"quantizer": "asymmetric_affine",
|
||||
"quantize": {
|
||||
"qtype": "u8",
|
||||
"max_value": 5.032563209533691,
|
||||
"min_value": -13.74686050415039,
|
||||
"scale": 0.07364479452371597,
|
||||
"zero_point": 187
|
||||
}
|
||||
"dtype": "float32"
|
||||
}
|
||||
},
|
||||
"Recurrent_connections": {}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network global header file
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network appliction post-process source file
|
||||
|
|
@ -166,5 +166,8 @@ const vsi_nn_postprocess_map_element_t * vnn_GetPostProcessMap()
|
|||
|
||||
uint32_t vnn_GetPostProcessMapCount()
|
||||
{
|
||||
return 0;
|
||||
if (postprocess_map == NULL)
|
||||
return 0;
|
||||
else
|
||||
return sizeof(postprocess_map) / sizeof(vsi_nn_postprocess_map_element_t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network appliction post-process header file
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network appliction pre-process source file
|
||||
|
|
@ -10,12 +10,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "jpeglib.h"
|
||||
#include "vsi_nn_pub.h"
|
||||
|
|
@ -36,7 +30,7 @@ const static vsi_nn_preprocess_map_element_t* preprocess_map = NULL;
|
|||
-------------------------------------------*/
|
||||
#define INPUT_META_NUM 1
|
||||
static vnn_input_meta_t input_meta_tab[INPUT_META_NUM];
|
||||
static void _load_input_meta(vsi_nn_graph_t *graph)
|
||||
static void _load_input_meta()
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < INPUT_META_NUM; i++)
|
||||
|
|
@ -44,10 +38,10 @@ static void _load_input_meta(vsi_nn_graph_t *graph)
|
|||
memset(&input_meta_tab[i].image.preprocess,
|
||||
VNN_PREPRO_NONE, sizeof(int32_t) * VNN_PREPRO_NUM);
|
||||
}
|
||||
/* lid: images_270 */
|
||||
input_meta_tab[0].image.preprocess[0] = VNN_PREPRO_REORDER;
|
||||
input_meta_tab[0].image.preprocess[1] = VNN_PREPRO_MEAN;
|
||||
input_meta_tab[0].image.preprocess[2] = VNN_PREPRO_SCALE;
|
||||
/* lid: images_270_0 */
|
||||
input_meta_tab[0].image.preprocess[0] = VNN_PREPRO_NONE;
|
||||
input_meta_tab[0].image.preprocess[1] = VNN_PREPRO_NONE;
|
||||
input_meta_tab[0].image.preprocess[2] = VNN_PREPRO_NONE;
|
||||
input_meta_tab[0].image.reorder[0] = 2;
|
||||
input_meta_tab[0].image.reorder[1] = 1;
|
||||
input_meta_tab[0].image.reorder[2] = 0;
|
||||
|
|
@ -538,14 +532,13 @@ static uint8_t *_get_jpeg_data
|
|||
(
|
||||
vsi_nn_tensor_t *tensor,
|
||||
vnn_input_meta_t *meta,
|
||||
const char *filename,
|
||||
vsi_nn_graph_t* graph
|
||||
const char *filename
|
||||
)
|
||||
{
|
||||
uint32_t i;
|
||||
uint8_t *bmpData,*data;
|
||||
float *fdata;
|
||||
vsi_bool use_image_process = vnn_UseImagePreprocessNode(graph);
|
||||
vsi_bool use_image_process = vnn_UseImagePreprocessNode();
|
||||
|
||||
bmpData = NULL;
|
||||
fdata = NULL;
|
||||
|
|
@ -665,7 +658,7 @@ static vsi_status _handle_multiple_inputs
|
|||
switch(fileType)
|
||||
{
|
||||
case NN_FILE_JPG:
|
||||
data = _get_jpeg_data(tensor, &meta, input_file, graph);
|
||||
data = _get_jpeg_data(tensor, &meta, input_file);
|
||||
TEST_CHECK_PTR(data, final);
|
||||
break;
|
||||
case NN_FILE_TENSOR:
|
||||
|
|
@ -690,11 +683,7 @@ static vsi_status _handle_multiple_inputs
|
|||
TEST_CHECK_STATUS(status, final);
|
||||
|
||||
/* Save the image data to file */
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
p1 = vsi_nn_GetRunTimeVariable(graph, "VSI_SAVE_FILE_TYPE");
|
||||
#else
|
||||
p1 = getenv("VSI_SAVE_FILE_TYPE");
|
||||
#endif
|
||||
p1 = getenv( "VSI_SAVE_FILE_TYPE");
|
||||
|
||||
snprintf(dumpInput, sizeof(dumpInput), "input_%d.dat", idx);
|
||||
vsi_nn_SaveTensorToBinary(graph, tensor, dumpInput);
|
||||
|
|
@ -703,9 +692,6 @@ static vsi_status _handle_multiple_inputs
|
|||
status = VSI_SUCCESS;
|
||||
final:
|
||||
if(data)free(data);
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
if(p1)vsi_nn_Free(p1);
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
@ -715,26 +701,16 @@ void vnn_ReleaseBufferImage()
|
|||
buffer_img = NULL;
|
||||
}
|
||||
|
||||
vsi_bool vnn_UseImagePreprocessNode(vsi_nn_graph_t* graph)
|
||||
vsi_bool vnn_UseImagePreprocessNode()
|
||||
{
|
||||
int32_t use_img_process;
|
||||
char *use_img_process_s;
|
||||
use_img_process = 0; /* default is 0 */
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
use_img_process_s = vsi_nn_GetRunTimeVariable(graph, "VSI_USE_IMAGE_PROCESS");
|
||||
if(use_img_process_s)
|
||||
{
|
||||
use_img_process = atoi(use_img_process_s);
|
||||
vsi_nn_Free(use_img_process_s);
|
||||
use_img_process_s = NULL;
|
||||
}
|
||||
#else
|
||||
use_img_process_s = getenv("VSI_USE_IMAGE_PROCESS");
|
||||
if(use_img_process_s)
|
||||
{
|
||||
use_img_process = atoi(use_img_process_s);
|
||||
}
|
||||
#endif
|
||||
use_img_process_s = getenv("VSI_USE_IMAGE_PROCESS");
|
||||
if(use_img_process_s)
|
||||
{
|
||||
use_img_process = atoi(use_img_process_s);
|
||||
}
|
||||
if (use_img_process)
|
||||
{
|
||||
return TRUE;
|
||||
|
|
@ -752,7 +728,7 @@ vsi_status vnn_PreProcessYolov5sAsymu8
|
|||
uint32_t i;
|
||||
vsi_status status;
|
||||
status = VSI_FAILURE;
|
||||
_load_input_meta(graph);
|
||||
_load_input_meta();
|
||||
if(input_num != graph->input.num)
|
||||
{
|
||||
printf("Graph need %u inputs, but enter %u inputs!!!\n",
|
||||
|
|
@ -917,5 +893,8 @@ const vsi_nn_preprocess_map_element_t * vnn_GetPreProcessMap()
|
|||
|
||||
uint32_t vnn_GetPreProcessMapCount()
|
||||
{
|
||||
return 0;
|
||||
if (preprocess_map == NULL)
|
||||
return 0;
|
||||
else
|
||||
return sizeof(preprocess_map) / sizeof(vsi_nn_preprocess_map_element_t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network appliction pre-process header file
|
||||
|
|
@ -47,7 +47,7 @@ vsi_status vnn_PreProcessYolov5sAsymu8
|
|||
uint32_t input_num
|
||||
);
|
||||
|
||||
vsi_bool vnn_UseImagePreprocessNode(vsi_nn_graph_t* graph);
|
||||
vsi_bool vnn_UseImagePreprocessNode();
|
||||
|
||||
void vnn_ReleaseBufferImage();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network appliction network definition source file
|
||||
|
|
@ -27,6 +27,68 @@
|
|||
_node->uid = (uint32_t)_uid;\
|
||||
} while(0)
|
||||
|
||||
#define NEW_VIRTUAL_TENSOR(_id, _attr, _dtype) do {\
|
||||
memset( _attr.size, 0, VSI_NN_MAX_DIM_NUM * sizeof(vsi_size_t));\
|
||||
_attr.dim_num = VSI_NN_DIM_AUTO;\
|
||||
_attr.vtl = !VNN_APP_DEBUG;\
|
||||
_attr.is_const = FALSE;\
|
||||
_attr.dtype.vx_type = _dtype;\
|
||||
_id = vsi_nn_AddTensor( graph, VSI_NN_TENSOR_ID_AUTO,\
|
||||
& _attr, NULL );\
|
||||
if( VSI_NN_TENSOR_ID_NA == _id ) {\
|
||||
goto error;\
|
||||
}\
|
||||
} while(0)
|
||||
|
||||
// Set const tensor dims out of this macro.
|
||||
#define NEW_CONST_TENSOR(_id, _attr, _dtype, _ofst, _size) do {\
|
||||
data = load_data( fp, _ofst, _size );\
|
||||
if( NULL == data ) {\
|
||||
goto error;\
|
||||
}\
|
||||
_attr.vtl = FALSE;\
|
||||
_attr.is_const = TRUE;\
|
||||
_attr.dtype.vx_type = _dtype;\
|
||||
_id = vsi_nn_AddTensor( graph, VSI_NN_TENSOR_ID_AUTO,\
|
||||
& _attr, data );\
|
||||
free( data );\
|
||||
if( VSI_NN_TENSOR_ID_NA == _id ) {\
|
||||
goto error;\
|
||||
}\
|
||||
} while(0)
|
||||
|
||||
// Set generic tensor dims out of this macro.
|
||||
#define NEW_NORM_TENSOR(_id, _attr, _dtype) do {\
|
||||
_attr.vtl = FALSE;\
|
||||
_attr.is_const = FALSE;\
|
||||
_attr.dtype.vx_type = _dtype;\
|
||||
if ( enable_from_handle )\
|
||||
{\
|
||||
_id = vsi_nn_AddTensorFromHandle( graph, VSI_NN_TENSOR_ID_AUTO,\
|
||||
& _attr, NULL );\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
_id = vsi_nn_AddTensor( graph, VSI_NN_TENSOR_ID_AUTO,\
|
||||
& _attr, NULL );\
|
||||
}\
|
||||
if( VSI_NN_TENSOR_ID_NA == _id ) {\
|
||||
goto error;\
|
||||
}\
|
||||
} while(0)
|
||||
|
||||
// Set generic tensor dims out of this macro.
|
||||
#define NEW_NORM_TENSOR_FROM_HANDLE(_id, _attr, _dtype) do {\
|
||||
_attr.vtl = FALSE;\
|
||||
_attr.is_const = FALSE;\
|
||||
_attr.dtype.vx_type = _dtype;\
|
||||
_id = vsi_nn_AddTensorFromHandle( graph, VSI_NN_TENSOR_ID_AUTO,\
|
||||
& _attr, NULL );\
|
||||
if( VSI_NN_TENSOR_ID_NA == _id ) {\
|
||||
goto error;\
|
||||
}\
|
||||
} while(0)
|
||||
|
||||
#define NET_NODE_NUM (1)
|
||||
#define NET_NORM_TENSOR_NUM (5)
|
||||
#define NET_CONST_TENSOR_NUM (0)
|
||||
|
|
@ -40,6 +102,45 @@
|
|||
/*-------------------------------------------
|
||||
Functions
|
||||
-------------------------------------------*/
|
||||
static uint8_t* load_data
|
||||
(
|
||||
FILE * fp,
|
||||
size_t ofst,
|
||||
size_t sz
|
||||
)
|
||||
{
|
||||
uint8_t* data;
|
||||
ssize_t ret;
|
||||
size_t size;
|
||||
data = NULL;
|
||||
if( NULL == fp )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = VSI_FSEEK(fp, ofst, SEEK_SET);
|
||||
if (ret != 0)
|
||||
{
|
||||
VSILOGE("blob seek failure.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = (uint8_t*)malloc(sz);
|
||||
if (data == NULL)
|
||||
{
|
||||
VSILOGE("buffer malloc failure.");
|
||||
return NULL;
|
||||
}
|
||||
size = fread(data, 1, sz, fp);
|
||||
if (size != sz || size == 0)
|
||||
{
|
||||
free(data);
|
||||
data = NULL;
|
||||
VSILOGE("Read file to buffer failed.");
|
||||
}
|
||||
return data;
|
||||
} /* load_data() */
|
||||
|
||||
vsi_nn_graph_t * vnn_CreateYolov5sAsymu8
|
||||
(
|
||||
const char * data_file_name,
|
||||
|
|
@ -57,15 +158,20 @@ vsi_nn_graph_t * vnn_CreateYolov5sAsymu8
|
|||
vsi_nn_graph_t * graph;
|
||||
vsi_nn_node_t * node[NET_NODE_NUM];
|
||||
vsi_nn_tensor_id_t norm_tensor[NET_NORM_TENSOR_NUM];
|
||||
vsi_nn_tensor_id_t* const_tensor = NULL;
|
||||
|
||||
vsi_nn_tensor_attr_t attr;
|
||||
FILE * fp;
|
||||
uint8_t * data;
|
||||
uint32_t i = 0;
|
||||
char * use_img_process_s;
|
||||
char * use_from_handle = NULL;
|
||||
int32_t enable_pre_post_process = 0;
|
||||
int32_t enable_from_handle = 0;
|
||||
vsi_bool sort = FALSE;
|
||||
vsi_bool inference_with_nbg = FALSE;
|
||||
char* pos = NULL;
|
||||
void** pp_scales_zps = NULL;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -76,6 +182,13 @@ vsi_nn_graph_t * vnn_CreateYolov5sAsymu8
|
|||
memset( &attr, 0, sizeof( attr ) );
|
||||
memset( &node, 0, sizeof( vsi_nn_node_t * ) * NET_NODE_NUM );
|
||||
|
||||
fp = fopen( data_file_name, "rb" );
|
||||
if( NULL == fp )
|
||||
{
|
||||
VSILOGE( "Open file %s failed.", data_file_name );
|
||||
goto error;
|
||||
}
|
||||
|
||||
pos = strstr(data_file_name, ".nb");
|
||||
if( pos && strcmp(pos, ".nb") == 0 )
|
||||
{
|
||||
|
|
@ -91,6 +204,16 @@ vsi_nn_graph_t * vnn_CreateYolov5sAsymu8
|
|||
ctx = in_ctx;
|
||||
}
|
||||
|
||||
use_img_process_s = getenv( "VSI_USE_IMAGE_PROCESS" );
|
||||
if( use_img_process_s )
|
||||
{
|
||||
enable_pre_post_process = atoi(use_img_process_s);
|
||||
}
|
||||
use_from_handle = getenv( "VSI_USE_FROM_HANDLE" );
|
||||
if ( use_from_handle )
|
||||
{
|
||||
enable_from_handle = atoi(use_from_handle);
|
||||
}
|
||||
|
||||
graph = vsi_nn_CreateGraph( ctx, NET_TOTAL_TENSOR_NUM, NET_NODE_NUM );
|
||||
if( NULL == graph )
|
||||
|
|
@ -98,23 +221,6 @@ vsi_nn_graph_t * vnn_CreateYolov5sAsymu8
|
|||
VSILOGE( "Create graph fail." );
|
||||
goto error;
|
||||
}
|
||||
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
use_img_process_s = vsi_nn_GetRunTimeVariable(graph, "VSI_USE_IMAGE_PROCESS");
|
||||
if( use_img_process_s )
|
||||
{
|
||||
enable_pre_post_process = atoi(use_img_process_s);
|
||||
vsi_nn_Free(use_img_process_s);
|
||||
use_img_process_s = NULL;
|
||||
}
|
||||
#else
|
||||
use_img_process_s = getenv("VSI_USE_IMAGE_PROCESS");
|
||||
if( use_img_process_s )
|
||||
{
|
||||
enable_pre_post_process = atoi(use_img_process_s);
|
||||
}
|
||||
#endif
|
||||
|
||||
vsi_nn_SetGraphVersion( graph, VNN_VERSION_MAJOR, VNN_VERSION_MINOR, VNN_VERSION_PATCH );
|
||||
vsi_nn_SetGraphInputs( graph, NULL, 1 );
|
||||
vsi_nn_SetGraphOutputs( graph, NULL, 4 );
|
||||
|
|
@ -158,36 +264,93 @@ vsi_nn_graph_t * vnn_CreateYolov5sAsymu8
|
|||
/*-----------------------------------------
|
||||
Tensor initialize
|
||||
-----------------------------------------*/
|
||||
attr.dtype.fmt = VSI_NN_DIM_FMT_NCHW;
|
||||
/* @images_270_0:out0 */
|
||||
memset( &attr, 0, sizeof( attr ) );
|
||||
attr.size[0] = 640;
|
||||
attr.size[1] = 640;
|
||||
attr.size[2] = 3;
|
||||
attr.size[3] = 1;
|
||||
attr.dim_num = 4;
|
||||
attr.dtype.qnt_type = VSI_NN_QNT_TYPE_NONE;
|
||||
NEW_NORM_TENSOR(norm_tensor[0], attr, VSI_NN_TYPE_UINT8);
|
||||
|
||||
/* @attach_output/out0_0:out0 */
|
||||
memset( &attr, 0, sizeof( attr ) );
|
||||
attr.size[0] = 85;
|
||||
attr.size[1] = 25200;
|
||||
attr.size[2] = 1;
|
||||
attr.dim_num = 3;
|
||||
attr.dtype.qnt_type = VSI_NN_QNT_TYPE_NONE;
|
||||
NEW_NORM_TENSOR(norm_tensor[1], attr, VSI_NN_TYPE_FLOAT32);
|
||||
|
||||
/* @attach_339/out0_1:out0 */
|
||||
memset( &attr, 0, sizeof( attr ) );
|
||||
attr.size[0] = 85;
|
||||
attr.size[1] = 80;
|
||||
attr.size[2] = 80;
|
||||
attr.size[3] = 3;
|
||||
attr.size[4] = 1;
|
||||
attr.dim_num = 5;
|
||||
attr.dtype.qnt_type = VSI_NN_QNT_TYPE_NONE;
|
||||
NEW_NORM_TENSOR(norm_tensor[2], attr, VSI_NN_TYPE_FLOAT32);
|
||||
|
||||
/* @attach_391/out0_2:out0 */
|
||||
memset( &attr, 0, sizeof( attr ) );
|
||||
attr.size[0] = 85;
|
||||
attr.size[1] = 40;
|
||||
attr.size[2] = 40;
|
||||
attr.size[3] = 3;
|
||||
attr.size[4] = 1;
|
||||
attr.dim_num = 5;
|
||||
attr.dtype.qnt_type = VSI_NN_QNT_TYPE_NONE;
|
||||
NEW_NORM_TENSOR(norm_tensor[3], attr, VSI_NN_TYPE_FLOAT32);
|
||||
|
||||
/* @attach_443/out0_3:out0 */
|
||||
memset( &attr, 0, sizeof( attr ) );
|
||||
attr.size[0] = 85;
|
||||
attr.size[1] = 20;
|
||||
attr.size[2] = 20;
|
||||
attr.size[3] = 3;
|
||||
attr.size[4] = 1;
|
||||
attr.dim_num = 5;
|
||||
attr.dtype.qnt_type = VSI_NN_QNT_TYPE_NONE;
|
||||
NEW_NORM_TENSOR(norm_tensor[4], attr, VSI_NN_TYPE_FLOAT32);
|
||||
|
||||
|
||||
|
||||
if( !inference_with_nbg )
|
||||
{
|
||||
pp_scales_zps = vnn_CreateYolov5sAsymu8Tensor(data_file_name, graph, node, norm_tensor, const_tensor);
|
||||
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------
|
||||
Connection initialize
|
||||
-----------------------------------------*/
|
||||
node[0]->input.tensors[0] = norm_tensor[4];
|
||||
node[0]->output.tensors[0] = norm_tensor[0];
|
||||
node[0]->output.tensors[1] = norm_tensor[1];
|
||||
node[0]->output.tensors[2] = norm_tensor[2];
|
||||
node[0]->output.tensors[3] = norm_tensor[3];
|
||||
node[0]->input.tensors[0] = norm_tensor[0];
|
||||
node[0]->output.tensors[0] = norm_tensor[1];
|
||||
node[0]->output.tensors[1] = norm_tensor[2];
|
||||
node[0]->output.tensors[2] = norm_tensor[3];
|
||||
node[0]->output.tensors[3] = norm_tensor[4];
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
node[0]->input.tensors[0] = norm_tensor[4];
|
||||
node[0]->output.tensors[0] = norm_tensor[0];
|
||||
node[0]->output.tensors[1] = norm_tensor[1];
|
||||
node[0]->output.tensors[2] = norm_tensor[2];
|
||||
node[0]->output.tensors[3] = norm_tensor[3];
|
||||
node[0]->input.tensors[0] = norm_tensor[0];
|
||||
node[0]->output.tensors[0] = norm_tensor[1];
|
||||
node[0]->output.tensors[1] = norm_tensor[2];
|
||||
node[0]->output.tensors[2] = norm_tensor[3];
|
||||
node[0]->output.tensors[3] = norm_tensor[4];
|
||||
|
||||
|
||||
}
|
||||
graph->input.tensors[0] = norm_tensor[4];
|
||||
graph->output.tensors[0] = norm_tensor[0];
|
||||
graph->output.tensors[1] = norm_tensor[1];
|
||||
graph->output.tensors[2] = norm_tensor[2];
|
||||
graph->output.tensors[3] = norm_tensor[3];
|
||||
graph->input.tensors[0] = norm_tensor[0];
|
||||
graph->output.tensors[0] = norm_tensor[1];
|
||||
graph->output.tensors[1] = norm_tensor[2];
|
||||
graph->output.tensors[2] = norm_tensor[3];
|
||||
graph->output.tensors[3] = norm_tensor[4];
|
||||
|
||||
|
||||
if( enable_pre_post_process )
|
||||
|
|
@ -217,22 +380,24 @@ vsi_nn_graph_t * vnn_CreateYolov5sAsymu8
|
|||
}
|
||||
|
||||
status = vsi_nn_SetupGraph( graph, sort );
|
||||
if( NULL != pp_scales_zps)
|
||||
{
|
||||
vnn_ReleaseYolov5sAsymu8TensorQuantParams(pp_scales_zps);
|
||||
}
|
||||
TEST_CHECK_STATUS( status, error );
|
||||
|
||||
|
||||
|
||||
if( VSI_FAILURE == status )
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
fclose( fp );
|
||||
|
||||
return graph;
|
||||
|
||||
error:
|
||||
if( NULL != fp )
|
||||
{
|
||||
fclose( fp );
|
||||
}
|
||||
|
||||
release_ctx = ( NULL == in_ctx );
|
||||
vsi_nn_DumpGraphToJson( graph );
|
||||
vnn_ReleaseYolov5sAsymu8( graph, release_ctx );
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network appliction network definition header file
|
||||
|
|
@ -36,18 +36,4 @@ vsi_nn_graph_t * vnn_CreateYolov5sAsymu8
|
|||
uint32_t post_process_map_count
|
||||
);
|
||||
|
||||
void** vnn_CreateYolov5sAsymu8Tensor
|
||||
(
|
||||
const char * data_file_name,
|
||||
vsi_nn_graph_t * graph,
|
||||
vsi_nn_node_t * node[],
|
||||
vsi_nn_tensor_id_t norm_tensor[],
|
||||
vsi_nn_tensor_id_t const_tensor[]
|
||||
);
|
||||
|
||||
void vnn_ReleaseYolov5sAsymu8TensorQuantParams
|
||||
(
|
||||
void ** pp_scales_zps
|
||||
);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -214,7 +214,6 @@
|
|||
<ClInclude Include="vnn_pre_process.h" />
|
||||
<ClInclude Include="vnn_global.h" />
|
||||
<ClCompile Include="vnn_yolov5sasymu8.c" />
|
||||
<ClCompile Include="vnn_yolov5sasymu8_tensor.c" />
|
||||
<ClCompile Include="vnn_post_process.c" />
|
||||
<ClCompile Include="vnn_pre_process.c" />
|
||||
<ClCompile Include="main.c" />
|
||||
|
|
|
|||
|
|
@ -128,13 +128,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(AQROOT)\sdk\inc;$(OVXLIB_PATH)\include;$(OVXLIB_PATH)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIVANTE_SDK_DIR)\lib;$(VIVANTE_SDK_DIR)\bin;$(SolutionDir)$(Configuration);</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
|
@ -143,13 +141,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(AQROOT)\sdk\inc;$(OVXLIB_PATH)\include;$(OVXLIB_PATH)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIVANTE_SDK_DIR)\lib;$(VIVANTE_SDK_DIR)\bin;$(SolutionDir)$(Configuration);</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Jenkins-Debug|Win32'">
|
||||
|
|
@ -158,13 +154,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(VIV_SDK_PATH)\include;$(SolutionDir)\include;$(SolutionDir)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIV_SDK_PATH)\lib\win32;$(SolutionDir)$(Configuration)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Jenkins-Debug|x64'">
|
||||
|
|
@ -173,13 +167,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(VIV_SDK_PATH)\include;$(SolutionDir)\include;$(SolutionDir)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIV_SDK_PATH)\lib\win32;$(SolutionDir)$(Configuration)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
|
|
@ -190,7 +182,6 @@
|
|||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
|
@ -198,7 +189,6 @@
|
|||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
|
@ -209,7 +199,6 @@
|
|||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
|
@ -217,7 +206,6 @@
|
|||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
@ -226,7 +214,6 @@
|
|||
<ClInclude Include="vnn_pre_process.h" />
|
||||
<ClInclude Include="vnn_global.h" />
|
||||
<ClCompile Include="vnn_yolov5sasymu8.c" />
|
||||
<ClCompile Include="vnn_yolov5sasymu8_tensor.c" />
|
||||
<ClCompile Include="vnn_post_process.c" />
|
||||
<ClCompile Include="vnn_pre_process.c" />
|
||||
<ClCompile Include="main.c" />
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"MetaData": {
|
||||
"Name": "torch-jit-export",
|
||||
"AcuityVersion": "6.39.1",
|
||||
"AcuityVersion": "6",
|
||||
"Platform": "tensorflow",
|
||||
"Org_Platform": "onnx"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@ input_meta:
|
|||
- 0.00392156862745098
|
||||
- 0.00392156862745098
|
||||
preproc_node_params:
|
||||
add_preproc_node: false
|
||||
preproc_type: IMAGE_RGB
|
||||
preproc_type: IMAGE_RGB888_PLANAR
|
||||
preproc_image_size:
|
||||
- 640
|
||||
- 640
|
||||
|
|
@ -49,4 +48,13 @@ input_meta:
|
|||
- 1
|
||||
- 2
|
||||
- 3
|
||||
add_preproc_node: true
|
||||
preproc_dtype_converter:
|
||||
qtype: uint8
|
||||
quantizer: asymmetric_affine
|
||||
rounding: rtne
|
||||
max_value: 1.0
|
||||
min_value: 0.0
|
||||
scale: 0.003921568859368563
|
||||
zero_point: 0
|
||||
redirect_to_output: false
|
||||
|
|
|
|||
|
|
@ -8,15 +8,14 @@ postprocess:
|
|||
app_postprocs:
|
||||
- lid: attach_output/out0_0
|
||||
postproc_params:
|
||||
add_postproc_node: false
|
||||
perm:
|
||||
- 0
|
||||
- 1
|
||||
- 2
|
||||
force_float32: true
|
||||
add_postproc_node: true
|
||||
- lid: attach_339/out0_1
|
||||
postproc_params:
|
||||
add_postproc_node: false
|
||||
perm:
|
||||
- 0
|
||||
- 1
|
||||
|
|
@ -24,9 +23,9 @@ postprocess:
|
|||
- 3
|
||||
- 4
|
||||
force_float32: true
|
||||
add_postproc_node: true
|
||||
- lid: attach_391/out0_2
|
||||
postproc_params:
|
||||
add_postproc_node: false
|
||||
perm:
|
||||
- 0
|
||||
- 1
|
||||
|
|
@ -34,9 +33,9 @@ postprocess:
|
|||
- 3
|
||||
- 4
|
||||
force_float32: true
|
||||
add_postproc_node: true
|
||||
- lid: attach_443/out0_3
|
||||
postproc_params:
|
||||
add_postproc_node: false
|
||||
perm:
|
||||
- 0
|
||||
- 1
|
||||
|
|
@ -44,3 +43,4 @@ postprocess:
|
|||
- 3
|
||||
- 4
|
||||
force_float32: true
|
||||
add_postproc_node: true
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 220 KiB |
|
|
@ -1 +1 @@
|
|||
0.0 0.0 0.0 255.0 255.0 255.0
|
||||
0.0 0.0 0.0 1.0 1.0 1.0
|
||||
|
|
@ -7,7 +7,6 @@ filegroup(
|
|||
srcs =
|
||||
[
|
||||
"vnn_yolov5scropasymu8.c",
|
||||
"vnn_yolov5scropasymu8_tensor.c",
|
||||
"vnn_yolov5scropasymu8.h",
|
||||
"vnn_post_process.c",
|
||||
"vnn_post_process.h",
|
||||
|
|
|
|||
|
|
@ -1318,7 +1318,7 @@
|
|||
"uid_10000":{
|
||||
"op": "PRE_PROCESS",
|
||||
"inputs": [ "@data_input_uid_330:out0" ],
|
||||
"inut_shape": [ [ 1920, 640, 1, 1 ] ],
|
||||
"inut_shape": [ [ 640, 640, 3, 1 ] ],
|
||||
"outputs": [ "out0" ],
|
||||
"output_shape": [ [ 640, 640, 3, 1 ] ]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network application project entry file
|
||||
|
|
@ -43,11 +43,11 @@ static void vnn_ReleaseNeuralNetwork
|
|||
vsi_nn_graph_t *graph
|
||||
)
|
||||
{
|
||||
if (vnn_UseImagePreprocessNode(graph))
|
||||
vnn_ReleaseYolov5sCropAsymu8( graph, TRUE );
|
||||
if (vnn_UseImagePreprocessNode())
|
||||
{
|
||||
vnn_ReleaseBufferImage();
|
||||
}
|
||||
vnn_ReleaseYolov5sCropAsymu8( graph, TRUE );
|
||||
}
|
||||
|
||||
static vsi_status vnn_PostProcessNeuralNetwork
|
||||
|
|
@ -108,7 +108,7 @@ static vsi_status vnn_ProcessGraph
|
|||
vsi_status status = VSI_FAILURE;
|
||||
int32_t i,loop;
|
||||
char *loop_s;
|
||||
uint64_t tmsTotal = 0, tmsSig, sigStart, sigEnd;
|
||||
uint64_t tmsStart, tmsEnd, sigStart, sigEnd;
|
||||
float msVal, usVal;
|
||||
|
||||
status = VSI_FAILURE;
|
||||
|
|
@ -120,6 +120,7 @@ static vsi_status vnn_ProcessGraph
|
|||
}
|
||||
|
||||
/* Run graph */
|
||||
tmsStart = get_perf_count();
|
||||
printf("Start run graph [%d] times...\n", loop);
|
||||
for(i = 0; i < loop; i++)
|
||||
{
|
||||
|
|
@ -149,14 +150,13 @@ static vsi_status vnn_ProcessGraph
|
|||
TEST_CHECK_STATUS( status, final );
|
||||
|
||||
sigEnd = get_perf_count();
|
||||
tmsSig = sigEnd - sigStart;
|
||||
msVal = tmsSig / (float)1000000;
|
||||
usVal = tmsSig / (float)1000;
|
||||
tmsTotal += tmsSig;
|
||||
msVal = (sigEnd - sigStart)/(float)1000000;
|
||||
usVal = (sigEnd - sigStart)/(float)1000;
|
||||
printf("Run the %u time: %.2fms or %.2fus\n", (i + 1), msVal, usVal);
|
||||
}
|
||||
msVal = tmsTotal / (float)1000000;
|
||||
usVal = tmsTotal / (float)1000;
|
||||
tmsEnd = get_perf_count();
|
||||
msVal = (tmsEnd - tmsStart)/(float)1000000;
|
||||
usVal = (tmsEnd - tmsStart)/(float)1000;
|
||||
printf("vxProcessGraph execution time:\n");
|
||||
printf("Total %.2fms or %.2fus\n", msVal, usVal);
|
||||
printf("Average %.2fms or %.2fus\n", ((float)usVal)/1000/loop, ((float)usVal)/loop);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network global header file
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network appliction post-process source file
|
||||
|
|
@ -198,5 +198,8 @@ const vsi_nn_postprocess_map_element_t * vnn_GetPostProcessMap()
|
|||
|
||||
uint32_t vnn_GetPostProcessMapCount()
|
||||
{
|
||||
return sizeof(postprocess_map) / sizeof(vsi_nn_postprocess_map_element_t);
|
||||
if (postprocess_map == NULL)
|
||||
return 0;
|
||||
else
|
||||
return sizeof(postprocess_map) / sizeof(vsi_nn_postprocess_map_element_t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network appliction post-process header file
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network appliction pre-process source file
|
||||
|
|
@ -10,12 +10,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "jpeglib.h"
|
||||
#include "vsi_nn_pub.h"
|
||||
|
|
@ -29,7 +23,7 @@
|
|||
-------------------------------------------*/
|
||||
/*pre process for lid: images_268*/
|
||||
vsi_nn_preprocess_source_layout_e source_layout_for_norm_tensor_3 = VSI_NN_SOURCE_LAYOUT_NCHW;
|
||||
vsi_nn_preprocess_source_format_e source_format_for_norm_tensor_3 = VSI_NN_SOURCE_FORMAT_IMAGE_RGB;
|
||||
vsi_nn_preprocess_source_format_e source_format_for_norm_tensor_3 = VSI_NN_SOURCE_FORMAT_IMAGE_RGB888_PLANAR;
|
||||
vsi_nn_preprocess_image_size_t size_for_norm_tensor_3 = {640, 640, 3};
|
||||
|
||||
vsi_nn_preprocess_image_resize_t resize_for_norm_tensor_3 = {640, 640, 3};
|
||||
|
|
@ -38,7 +32,7 @@ float mean_and_scale_3[] = {0.0, 0.0, 0.0};
|
|||
vsi_nn_preprocess_mean_and_scale_t mean_and_scale_for_norm_tensor_3 = {mean_and_scale_3, 3, 0.003921569};
|
||||
int32_t perm_3[] = {0, 1, 2, 3};
|
||||
vsi_nn_preprocess_permute_t permute_for_norm_tensor_3 = {perm_3, 4};
|
||||
vsi_nn_preprocess_dtype_convert_t dtype_converter_for_norm_tensor_3={.dtype.fmt=VSI_NN_DIM_FMT_NCHW, .dtype.vx_type=VSI_NN_TYPE_UINT8, .dtype.qnt_type=VSI_NN_QNT_TYPE_AFFINE_ASYMMETRIC, .dtype.zero_point=0, .dtype.scale=0.0037843601312488317};
|
||||
vsi_nn_preprocess_dtype_convert_t dtype_converter_for_norm_tensor3={.dtype.fmt=VSI_NN_DIM_FMT_NCHW, .dtype.vx_type=VSI_NN_TYPE_UINT8, .dtype.qnt_type=VSI_NN_QNT_TYPE_AFFINE_ASYMMETRIC, .dtype.zero_point=0, .dtype.scale=0.003921568859368563};
|
||||
vsi_nn_preprocess_base_t pre_process_for_norm_tensor_3[] =
|
||||
{
|
||||
{VSI_NN_PREPROCESS_SOURCE_LAYOUT, &source_layout_for_norm_tensor_3},
|
||||
|
|
@ -49,7 +43,7 @@ vsi_nn_preprocess_base_t pre_process_for_norm_tensor_3[] =
|
|||
{VSI_NN_PREPROCESS_REVERSE_CHANNEL, &reverse_channel_for_norm_tensor_3},
|
||||
{VSI_NN_PREPROCESS_MEAN_AND_SCALE, &mean_and_scale_for_norm_tensor_3},
|
||||
{VSI_NN_PREPROCESS_PERMUTE, &permute_for_norm_tensor_3},
|
||||
{VSI_NN_PREPROCESS_DTYPE_CONVERT, &dtype_converter_for_norm_tensor_3},
|
||||
{VSI_NN_PREPROCESS_DTYPE_CONVERT, &dtype_converter_for_norm_tensor3},
|
||||
};
|
||||
|
||||
/*{graph_input_idx, preprocess}*/
|
||||
|
|
@ -63,7 +57,7 @@ const static vsi_nn_preprocess_map_element_t preprocess_map[] =
|
|||
-------------------------------------------*/
|
||||
#define INPUT_META_NUM 1
|
||||
static vnn_input_meta_t input_meta_tab[INPUT_META_NUM];
|
||||
static void _load_input_meta(vsi_nn_graph_t *graph)
|
||||
static void _load_input_meta()
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < INPUT_META_NUM; i++)
|
||||
|
|
@ -71,7 +65,7 @@ static void _load_input_meta(vsi_nn_graph_t *graph)
|
|||
memset(&input_meta_tab[i].image.preprocess,
|
||||
VNN_PREPRO_NONE, sizeof(int32_t) * VNN_PREPRO_NUM);
|
||||
}
|
||||
if (vnn_UseImagePreprocessNode(graph))
|
||||
if (vnn_UseImagePreprocessNode())
|
||||
{
|
||||
/* lid: images_268 */
|
||||
input_meta_tab[0].image.preprocess[0] = VNN_PREPRO_NONE;
|
||||
|
|
@ -576,14 +570,13 @@ static uint8_t *_get_jpeg_data
|
|||
(
|
||||
vsi_nn_tensor_t *tensor,
|
||||
vnn_input_meta_t *meta,
|
||||
const char *filename,
|
||||
vsi_nn_graph_t* graph
|
||||
const char *filename
|
||||
)
|
||||
{
|
||||
uint32_t i;
|
||||
uint8_t *bmpData,*data;
|
||||
float *fdata;
|
||||
vsi_bool use_image_process = vnn_UseImagePreprocessNode(graph);
|
||||
vsi_bool use_image_process = vnn_UseImagePreprocessNode();
|
||||
|
||||
bmpData = NULL;
|
||||
fdata = NULL;
|
||||
|
|
@ -703,7 +696,7 @@ static vsi_status _handle_multiple_inputs
|
|||
switch(fileType)
|
||||
{
|
||||
case NN_FILE_JPG:
|
||||
data = _get_jpeg_data(tensor, &meta, input_file, graph);
|
||||
data = _get_jpeg_data(tensor, &meta, input_file);
|
||||
TEST_CHECK_PTR(data, final);
|
||||
break;
|
||||
case NN_FILE_TENSOR:
|
||||
|
|
@ -728,11 +721,7 @@ static vsi_status _handle_multiple_inputs
|
|||
TEST_CHECK_STATUS(status, final);
|
||||
|
||||
/* Save the image data to file */
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
p1 = vsi_nn_GetRunTimeVariable(graph, "VSI_SAVE_FILE_TYPE");
|
||||
#else
|
||||
p1 = getenv("VSI_SAVE_FILE_TYPE");
|
||||
#endif
|
||||
p1 = getenv( "VSI_SAVE_FILE_TYPE");
|
||||
|
||||
snprintf(dumpInput, sizeof(dumpInput), "input_%d.dat", idx);
|
||||
vsi_nn_SaveTensorToBinary(graph, tensor, dumpInput);
|
||||
|
|
@ -741,9 +730,6 @@ static vsi_status _handle_multiple_inputs
|
|||
status = VSI_SUCCESS;
|
||||
final:
|
||||
if(data)free(data);
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
if(p1)vsi_nn_Free(p1);
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
@ -753,26 +739,16 @@ void vnn_ReleaseBufferImage()
|
|||
buffer_img = NULL;
|
||||
}
|
||||
|
||||
vsi_bool vnn_UseImagePreprocessNode(vsi_nn_graph_t* graph)
|
||||
vsi_bool vnn_UseImagePreprocessNode()
|
||||
{
|
||||
int32_t use_img_process;
|
||||
char *use_img_process_s;
|
||||
use_img_process = 0; /* default is 0 */
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
use_img_process_s = vsi_nn_GetRunTimeVariable(graph, "VSI_USE_IMAGE_PROCESS");
|
||||
if(use_img_process_s)
|
||||
{
|
||||
use_img_process = atoi(use_img_process_s);
|
||||
vsi_nn_Free(use_img_process_s);
|
||||
use_img_process_s = NULL;
|
||||
}
|
||||
#else
|
||||
use_img_process_s = getenv("VSI_USE_IMAGE_PROCESS");
|
||||
if(use_img_process_s)
|
||||
{
|
||||
use_img_process = atoi(use_img_process_s);
|
||||
}
|
||||
#endif
|
||||
use_img_process_s = getenv("VSI_USE_IMAGE_PROCESS");
|
||||
if(use_img_process_s)
|
||||
{
|
||||
use_img_process = atoi(use_img_process_s);
|
||||
}
|
||||
if (use_img_process)
|
||||
{
|
||||
return TRUE;
|
||||
|
|
@ -790,7 +766,7 @@ vsi_status vnn_PreProcessYolov5sCropAsymu8
|
|||
uint32_t i;
|
||||
vsi_status status;
|
||||
status = VSI_FAILURE;
|
||||
_load_input_meta(graph);
|
||||
_load_input_meta();
|
||||
if(input_num != graph->input.num)
|
||||
{
|
||||
printf("Graph need %u inputs, but enter %u inputs!!!\n",
|
||||
|
|
@ -955,5 +931,8 @@ const vsi_nn_preprocess_map_element_t * vnn_GetPreProcessMap()
|
|||
|
||||
uint32_t vnn_GetPreProcessMapCount()
|
||||
{
|
||||
return sizeof(preprocess_map) / sizeof(vsi_nn_preprocess_map_element_t);
|
||||
if (preprocess_map == NULL)
|
||||
return 0;
|
||||
else
|
||||
return sizeof(preprocess_map) / sizeof(vsi_nn_preprocess_map_element_t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network appliction pre-process header file
|
||||
|
|
@ -47,7 +47,7 @@ vsi_status vnn_PreProcessYolov5sCropAsymu8
|
|||
uint32_t input_num
|
||||
);
|
||||
|
||||
vsi_bool vnn_UseImagePreprocessNode(vsi_nn_graph_t* graph);
|
||||
vsi_bool vnn_UseImagePreprocessNode();
|
||||
|
||||
void vnn_ReleaseBufferImage();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network appliction network definition header file
|
||||
|
|
@ -36,18 +36,4 @@ vsi_nn_graph_t * vnn_CreateYolov5sCropAsymu8
|
|||
uint32_t post_process_map_count
|
||||
);
|
||||
|
||||
void** vnn_CreateYolov5sCropAsymu8Tensor
|
||||
(
|
||||
const char * data_file_name,
|
||||
vsi_nn_graph_t * graph,
|
||||
vsi_nn_node_t * node[],
|
||||
vsi_nn_tensor_id_t norm_tensor[],
|
||||
vsi_nn_tensor_id_t const_tensor[]
|
||||
);
|
||||
|
||||
void vnn_ReleaseYolov5sCropAsymu8TensorQuantParams
|
||||
(
|
||||
void ** pp_scales_zps
|
||||
);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -214,7 +214,6 @@
|
|||
<ClInclude Include="vnn_pre_process.h" />
|
||||
<ClInclude Include="vnn_global.h" />
|
||||
<ClCompile Include="vnn_yolov5scropasymu8.c" />
|
||||
<ClCompile Include="vnn_yolov5scropasymu8_tensor.c" />
|
||||
<ClCompile Include="vnn_post_process.c" />
|
||||
<ClCompile Include="vnn_pre_process.c" />
|
||||
<ClCompile Include="main.c" />
|
||||
|
|
|
|||
|
|
@ -128,13 +128,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(AQROOT)\sdk\inc;$(OVXLIB_PATH)\include;$(OVXLIB_PATH)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIVANTE_SDK_DIR)\lib;$(VIVANTE_SDK_DIR)\bin;$(SolutionDir)$(Configuration);</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
|
@ -143,13 +141,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(AQROOT)\sdk\inc;$(OVXLIB_PATH)\include;$(OVXLIB_PATH)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIVANTE_SDK_DIR)\lib;$(VIVANTE_SDK_DIR)\bin;$(SolutionDir)$(Configuration);</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Jenkins-Debug|Win32'">
|
||||
|
|
@ -158,13 +154,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(VIV_SDK_PATH)\include;$(SolutionDir)\include;$(SolutionDir)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIV_SDK_PATH)\lib\win32;$(SolutionDir)$(Configuration)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Jenkins-Debug|x64'">
|
||||
|
|
@ -173,13 +167,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(VIV_SDK_PATH)\include;$(SolutionDir)\include;$(SolutionDir)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIV_SDK_PATH)\lib\win32;$(SolutionDir)$(Configuration)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
|
|
@ -190,7 +182,6 @@
|
|||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
|
@ -198,7 +189,6 @@
|
|||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
|
@ -209,7 +199,6 @@
|
|||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
|
@ -217,7 +206,6 @@
|
|||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
@ -226,7 +214,6 @@
|
|||
<ClInclude Include="vnn_pre_process.h" />
|
||||
<ClInclude Include="vnn_global.h" />
|
||||
<ClCompile Include="vnn_yolov5scropasymu8.c" />
|
||||
<ClCompile Include="vnn_yolov5scropasymu8_tensor.c" />
|
||||
<ClCompile Include="vnn_post_process.c" />
|
||||
<ClCompile Include="vnn_pre_process.c" />
|
||||
<ClCompile Include="main.c" />
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ filegroup(
|
|||
srcs =
|
||||
[
|
||||
"vnn_yolov5scropasymu8.c",
|
||||
"vnn_yolov5scropasymu8_tensor.c",
|
||||
"vnn_yolov5scropasymu8.h",
|
||||
"vnn_post_process.c",
|
||||
"vnn_post_process.h",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network application project entry file
|
||||
|
|
@ -43,11 +43,11 @@ static void vnn_ReleaseNeuralNetwork
|
|||
vsi_nn_graph_t *graph
|
||||
)
|
||||
{
|
||||
if (vnn_UseImagePreprocessNode(graph))
|
||||
vnn_ReleaseYolov5sCropAsymu8( graph, TRUE );
|
||||
if (vnn_UseImagePreprocessNode())
|
||||
{
|
||||
vnn_ReleaseBufferImage();
|
||||
}
|
||||
vnn_ReleaseYolov5sCropAsymu8( graph, TRUE );
|
||||
}
|
||||
|
||||
static vsi_status vnn_PostProcessNeuralNetwork
|
||||
|
|
@ -108,7 +108,7 @@ static vsi_status vnn_ProcessGraph
|
|||
vsi_status status = VSI_FAILURE;
|
||||
int32_t i,loop;
|
||||
char *loop_s;
|
||||
uint64_t tmsTotal = 0, tmsSig, sigStart, sigEnd;
|
||||
uint64_t tmsStart, tmsEnd, sigStart, sigEnd;
|
||||
float msVal, usVal;
|
||||
|
||||
status = VSI_FAILURE;
|
||||
|
|
@ -120,6 +120,7 @@ static vsi_status vnn_ProcessGraph
|
|||
}
|
||||
|
||||
/* Run graph */
|
||||
tmsStart = get_perf_count();
|
||||
printf("Start run graph [%d] times...\n", loop);
|
||||
for(i = 0; i < loop; i++)
|
||||
{
|
||||
|
|
@ -149,14 +150,13 @@ static vsi_status vnn_ProcessGraph
|
|||
TEST_CHECK_STATUS( status, final );
|
||||
|
||||
sigEnd = get_perf_count();
|
||||
tmsSig = sigEnd - sigStart;
|
||||
msVal = tmsSig / (float)1000000;
|
||||
usVal = tmsSig / (float)1000;
|
||||
tmsTotal += tmsSig;
|
||||
msVal = (sigEnd - sigStart)/(float)1000000;
|
||||
usVal = (sigEnd - sigStart)/(float)1000;
|
||||
printf("Run the %u time: %.2fms or %.2fus\n", (i + 1), msVal, usVal);
|
||||
}
|
||||
msVal = tmsTotal / (float)1000000;
|
||||
usVal = tmsTotal / (float)1000;
|
||||
tmsEnd = get_perf_count();
|
||||
msVal = (tmsEnd - tmsStart)/(float)1000000;
|
||||
usVal = (tmsEnd - tmsStart)/(float)1000;
|
||||
printf("vxProcessGraph execution time:\n");
|
||||
printf("Total %.2fms or %.2fus\n", msVal, usVal);
|
||||
printf("Average %.2fms or %.2fus\n", ((float)usVal)/1000/loop, ((float)usVal)/loop);
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
"name": "images_0",
|
||||
"shape": [
|
||||
1,
|
||||
1,
|
||||
3,
|
||||
640,
|
||||
1920
|
||||
640
|
||||
],
|
||||
"format": "nchw",
|
||||
"dtype": "uint8"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network global header file
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network appliction post-process source file
|
||||
|
|
@ -166,5 +166,8 @@ const vsi_nn_postprocess_map_element_t * vnn_GetPostProcessMap()
|
|||
|
||||
uint32_t vnn_GetPostProcessMapCount()
|
||||
{
|
||||
return 0;
|
||||
if (postprocess_map == NULL)
|
||||
return 0;
|
||||
else
|
||||
return sizeof(postprocess_map) / sizeof(vsi_nn_postprocess_map_element_t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network appliction post-process header file
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network appliction pre-process source file
|
||||
|
|
@ -10,12 +10,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "jpeglib.h"
|
||||
#include "vsi_nn_pub.h"
|
||||
|
|
@ -36,7 +30,7 @@ const static vsi_nn_preprocess_map_element_t* preprocess_map = NULL;
|
|||
-------------------------------------------*/
|
||||
#define INPUT_META_NUM 1
|
||||
static vnn_input_meta_t input_meta_tab[INPUT_META_NUM];
|
||||
static void _load_input_meta(vsi_nn_graph_t *graph)
|
||||
static void _load_input_meta()
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < INPUT_META_NUM; i++)
|
||||
|
|
@ -48,7 +42,9 @@ static void _load_input_meta(vsi_nn_graph_t *graph)
|
|||
input_meta_tab[0].image.preprocess[0] = VNN_PREPRO_NONE;
|
||||
input_meta_tab[0].image.preprocess[1] = VNN_PREPRO_NONE;
|
||||
input_meta_tab[0].image.preprocess[2] = VNN_PREPRO_NONE;
|
||||
input_meta_tab[0].image.reorder[0] = 0;
|
||||
input_meta_tab[0].image.reorder[0] = 2;
|
||||
input_meta_tab[0].image.reorder[1] = 1;
|
||||
input_meta_tab[0].image.reorder[2] = 0;
|
||||
input_meta_tab[0].image.mean[0] = 0.0;
|
||||
input_meta_tab[0].image.mean[1] = 0.0;
|
||||
input_meta_tab[0].image.mean[2] = 0.0;
|
||||
|
|
@ -536,14 +532,13 @@ static uint8_t *_get_jpeg_data
|
|||
(
|
||||
vsi_nn_tensor_t *tensor,
|
||||
vnn_input_meta_t *meta,
|
||||
const char *filename,
|
||||
vsi_nn_graph_t* graph
|
||||
const char *filename
|
||||
)
|
||||
{
|
||||
uint32_t i;
|
||||
uint8_t *bmpData,*data;
|
||||
float *fdata;
|
||||
vsi_bool use_image_process = vnn_UseImagePreprocessNode(graph);
|
||||
vsi_bool use_image_process = vnn_UseImagePreprocessNode();
|
||||
|
||||
bmpData = NULL;
|
||||
fdata = NULL;
|
||||
|
|
@ -663,7 +658,7 @@ static vsi_status _handle_multiple_inputs
|
|||
switch(fileType)
|
||||
{
|
||||
case NN_FILE_JPG:
|
||||
data = _get_jpeg_data(tensor, &meta, input_file, graph);
|
||||
data = _get_jpeg_data(tensor, &meta, input_file);
|
||||
TEST_CHECK_PTR(data, final);
|
||||
break;
|
||||
case NN_FILE_TENSOR:
|
||||
|
|
@ -688,11 +683,7 @@ static vsi_status _handle_multiple_inputs
|
|||
TEST_CHECK_STATUS(status, final);
|
||||
|
||||
/* Save the image data to file */
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
p1 = vsi_nn_GetRunTimeVariable(graph, "VSI_SAVE_FILE_TYPE");
|
||||
#else
|
||||
p1 = getenv("VSI_SAVE_FILE_TYPE");
|
||||
#endif
|
||||
p1 = getenv( "VSI_SAVE_FILE_TYPE");
|
||||
|
||||
snprintf(dumpInput, sizeof(dumpInput), "input_%d.dat", idx);
|
||||
vsi_nn_SaveTensorToBinary(graph, tensor, dumpInput);
|
||||
|
|
@ -701,9 +692,6 @@ static vsi_status _handle_multiple_inputs
|
|||
status = VSI_SUCCESS;
|
||||
final:
|
||||
if(data)free(data);
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
if(p1)vsi_nn_Free(p1);
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
@ -713,26 +701,16 @@ void vnn_ReleaseBufferImage()
|
|||
buffer_img = NULL;
|
||||
}
|
||||
|
||||
vsi_bool vnn_UseImagePreprocessNode(vsi_nn_graph_t* graph)
|
||||
vsi_bool vnn_UseImagePreprocessNode()
|
||||
{
|
||||
int32_t use_img_process;
|
||||
char *use_img_process_s;
|
||||
use_img_process = 0; /* default is 0 */
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
use_img_process_s = vsi_nn_GetRunTimeVariable(graph, "VSI_USE_IMAGE_PROCESS");
|
||||
if(use_img_process_s)
|
||||
{
|
||||
use_img_process = atoi(use_img_process_s);
|
||||
vsi_nn_Free(use_img_process_s);
|
||||
use_img_process_s = NULL;
|
||||
}
|
||||
#else
|
||||
use_img_process_s = getenv("VSI_USE_IMAGE_PROCESS");
|
||||
if(use_img_process_s)
|
||||
{
|
||||
use_img_process = atoi(use_img_process_s);
|
||||
}
|
||||
#endif
|
||||
use_img_process_s = getenv("VSI_USE_IMAGE_PROCESS");
|
||||
if(use_img_process_s)
|
||||
{
|
||||
use_img_process = atoi(use_img_process_s);
|
||||
}
|
||||
if (use_img_process)
|
||||
{
|
||||
return TRUE;
|
||||
|
|
@ -750,7 +728,7 @@ vsi_status vnn_PreProcessYolov5sCropAsymu8
|
|||
uint32_t i;
|
||||
vsi_status status;
|
||||
status = VSI_FAILURE;
|
||||
_load_input_meta(graph);
|
||||
_load_input_meta();
|
||||
if(input_num != graph->input.num)
|
||||
{
|
||||
printf("Graph need %u inputs, but enter %u inputs!!!\n",
|
||||
|
|
@ -915,5 +893,8 @@ const vsi_nn_preprocess_map_element_t * vnn_GetPreProcessMap()
|
|||
|
||||
uint32_t vnn_GetPreProcessMapCount()
|
||||
{
|
||||
return 0;
|
||||
if (preprocess_map == NULL)
|
||||
return 0;
|
||||
else
|
||||
return sizeof(preprocess_map) / sizeof(vsi_nn_preprocess_map_element_t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network appliction pre-process header file
|
||||
|
|
@ -47,7 +47,7 @@ vsi_status vnn_PreProcessYolov5sCropAsymu8
|
|||
uint32_t input_num
|
||||
);
|
||||
|
||||
vsi_bool vnn_UseImagePreprocessNode(vsi_nn_graph_t* graph);
|
||||
vsi_bool vnn_UseImagePreprocessNode();
|
||||
|
||||
void vnn_ReleaseBufferImage();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network appliction network definition source file
|
||||
|
|
@ -27,6 +27,68 @@
|
|||
_node->uid = (uint32_t)_uid;\
|
||||
} while(0)
|
||||
|
||||
#define NEW_VIRTUAL_TENSOR(_id, _attr, _dtype) do {\
|
||||
memset( _attr.size, 0, VSI_NN_MAX_DIM_NUM * sizeof(vsi_size_t));\
|
||||
_attr.dim_num = VSI_NN_DIM_AUTO;\
|
||||
_attr.vtl = !VNN_APP_DEBUG;\
|
||||
_attr.is_const = FALSE;\
|
||||
_attr.dtype.vx_type = _dtype;\
|
||||
_id = vsi_nn_AddTensor( graph, VSI_NN_TENSOR_ID_AUTO,\
|
||||
& _attr, NULL );\
|
||||
if( VSI_NN_TENSOR_ID_NA == _id ) {\
|
||||
goto error;\
|
||||
}\
|
||||
} while(0)
|
||||
|
||||
// Set const tensor dims out of this macro.
|
||||
#define NEW_CONST_TENSOR(_id, _attr, _dtype, _ofst, _size) do {\
|
||||
data = load_data( fp, _ofst, _size );\
|
||||
if( NULL == data ) {\
|
||||
goto error;\
|
||||
}\
|
||||
_attr.vtl = FALSE;\
|
||||
_attr.is_const = TRUE;\
|
||||
_attr.dtype.vx_type = _dtype;\
|
||||
_id = vsi_nn_AddTensor( graph, VSI_NN_TENSOR_ID_AUTO,\
|
||||
& _attr, data );\
|
||||
free( data );\
|
||||
if( VSI_NN_TENSOR_ID_NA == _id ) {\
|
||||
goto error;\
|
||||
}\
|
||||
} while(0)
|
||||
|
||||
// Set generic tensor dims out of this macro.
|
||||
#define NEW_NORM_TENSOR(_id, _attr, _dtype) do {\
|
||||
_attr.vtl = FALSE;\
|
||||
_attr.is_const = FALSE;\
|
||||
_attr.dtype.vx_type = _dtype;\
|
||||
if ( enable_from_handle )\
|
||||
{\
|
||||
_id = vsi_nn_AddTensorFromHandle( graph, VSI_NN_TENSOR_ID_AUTO,\
|
||||
& _attr, NULL );\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
_id = vsi_nn_AddTensor( graph, VSI_NN_TENSOR_ID_AUTO,\
|
||||
& _attr, NULL );\
|
||||
}\
|
||||
if( VSI_NN_TENSOR_ID_NA == _id ) {\
|
||||
goto error;\
|
||||
}\
|
||||
} while(0)
|
||||
|
||||
// Set generic tensor dims out of this macro.
|
||||
#define NEW_NORM_TENSOR_FROM_HANDLE(_id, _attr, _dtype) do {\
|
||||
_attr.vtl = FALSE;\
|
||||
_attr.is_const = FALSE;\
|
||||
_attr.dtype.vx_type = _dtype;\
|
||||
_id = vsi_nn_AddTensorFromHandle( graph, VSI_NN_TENSOR_ID_AUTO,\
|
||||
& _attr, NULL );\
|
||||
if( VSI_NN_TENSOR_ID_NA == _id ) {\
|
||||
goto error;\
|
||||
}\
|
||||
} while(0)
|
||||
|
||||
#define NET_NODE_NUM (1)
|
||||
#define NET_NORM_TENSOR_NUM (4)
|
||||
#define NET_CONST_TENSOR_NUM (0)
|
||||
|
|
@ -40,6 +102,45 @@
|
|||
/*-------------------------------------------
|
||||
Functions
|
||||
-------------------------------------------*/
|
||||
static uint8_t* load_data
|
||||
(
|
||||
FILE * fp,
|
||||
size_t ofst,
|
||||
size_t sz
|
||||
)
|
||||
{
|
||||
uint8_t* data;
|
||||
ssize_t ret;
|
||||
size_t size;
|
||||
data = NULL;
|
||||
if( NULL == fp )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = VSI_FSEEK(fp, ofst, SEEK_SET);
|
||||
if (ret != 0)
|
||||
{
|
||||
VSILOGE("blob seek failure.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = (uint8_t*)malloc(sz);
|
||||
if (data == NULL)
|
||||
{
|
||||
VSILOGE("buffer malloc failure.");
|
||||
return NULL;
|
||||
}
|
||||
size = fread(data, 1, sz, fp);
|
||||
if (size != sz || size == 0)
|
||||
{
|
||||
free(data);
|
||||
data = NULL;
|
||||
VSILOGE("Read file to buffer failed.");
|
||||
}
|
||||
return data;
|
||||
} /* load_data() */
|
||||
|
||||
vsi_nn_graph_t * vnn_CreateYolov5sCropAsymu8
|
||||
(
|
||||
const char * data_file_name,
|
||||
|
|
@ -57,15 +158,20 @@ vsi_nn_graph_t * vnn_CreateYolov5sCropAsymu8
|
|||
vsi_nn_graph_t * graph;
|
||||
vsi_nn_node_t * node[NET_NODE_NUM];
|
||||
vsi_nn_tensor_id_t norm_tensor[NET_NORM_TENSOR_NUM];
|
||||
vsi_nn_tensor_id_t* const_tensor = NULL;
|
||||
|
||||
vsi_nn_tensor_attr_t attr;
|
||||
FILE * fp;
|
||||
uint8_t * data;
|
||||
uint32_t i = 0;
|
||||
char * use_img_process_s;
|
||||
char * use_from_handle = NULL;
|
||||
int32_t enable_pre_post_process = 0;
|
||||
int32_t enable_from_handle = 0;
|
||||
vsi_bool sort = FALSE;
|
||||
vsi_bool inference_with_nbg = FALSE;
|
||||
char* pos = NULL;
|
||||
void** pp_scales_zps = NULL;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -76,6 +182,13 @@ vsi_nn_graph_t * vnn_CreateYolov5sCropAsymu8
|
|||
memset( &attr, 0, sizeof( attr ) );
|
||||
memset( &node, 0, sizeof( vsi_nn_node_t * ) * NET_NODE_NUM );
|
||||
|
||||
fp = fopen( data_file_name, "rb" );
|
||||
if( NULL == fp )
|
||||
{
|
||||
VSILOGE( "Open file %s failed.", data_file_name );
|
||||
goto error;
|
||||
}
|
||||
|
||||
pos = strstr(data_file_name, ".nb");
|
||||
if( pos && strcmp(pos, ".nb") == 0 )
|
||||
{
|
||||
|
|
@ -91,6 +204,16 @@ vsi_nn_graph_t * vnn_CreateYolov5sCropAsymu8
|
|||
ctx = in_ctx;
|
||||
}
|
||||
|
||||
use_img_process_s = getenv( "VSI_USE_IMAGE_PROCESS" );
|
||||
if( use_img_process_s )
|
||||
{
|
||||
enable_pre_post_process = atoi(use_img_process_s);
|
||||
}
|
||||
use_from_handle = getenv( "VSI_USE_FROM_HANDLE" );
|
||||
if ( use_from_handle )
|
||||
{
|
||||
enable_from_handle = atoi(use_from_handle);
|
||||
}
|
||||
|
||||
graph = vsi_nn_CreateGraph( ctx, NET_TOTAL_TENSOR_NUM, NET_NODE_NUM );
|
||||
if( NULL == graph )
|
||||
|
|
@ -98,23 +221,6 @@ vsi_nn_graph_t * vnn_CreateYolov5sCropAsymu8
|
|||
VSILOGE( "Create graph fail." );
|
||||
goto error;
|
||||
}
|
||||
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
use_img_process_s = vsi_nn_GetRunTimeVariable(graph, "VSI_USE_IMAGE_PROCESS");
|
||||
if( use_img_process_s )
|
||||
{
|
||||
enable_pre_post_process = atoi(use_img_process_s);
|
||||
vsi_nn_Free(use_img_process_s);
|
||||
use_img_process_s = NULL;
|
||||
}
|
||||
#else
|
||||
use_img_process_s = getenv("VSI_USE_IMAGE_PROCESS");
|
||||
if( use_img_process_s )
|
||||
{
|
||||
enable_pre_post_process = atoi(use_img_process_s);
|
||||
}
|
||||
#endif
|
||||
|
||||
vsi_nn_SetGraphVersion( graph, VNN_VERSION_MAJOR, VNN_VERSION_MINOR, VNN_VERSION_PATCH );
|
||||
vsi_nn_SetGraphInputs( graph, NULL, 1 );
|
||||
vsi_nn_SetGraphOutputs( graph, NULL, 3 );
|
||||
|
|
@ -136,7 +242,7 @@ vsi_nn_graph_t * vnn_CreateYolov5sCropAsymu8
|
|||
var - node[0]
|
||||
name - nbg
|
||||
operation - nbg
|
||||
input - [1920, 640, 1, 1]
|
||||
input - [640, 640, 3, 1]
|
||||
output - [85, 19200, 1]
|
||||
[85, 4800, 1]
|
||||
[85, 1200, 1]
|
||||
|
|
@ -157,9 +263,51 @@ vsi_nn_graph_t * vnn_CreateYolov5sCropAsymu8
|
|||
/*-----------------------------------------
|
||||
Tensor initialize
|
||||
-----------------------------------------*/
|
||||
attr.dtype.fmt = VSI_NN_DIM_FMT_NCHW;
|
||||
/* @images_268_0:out0 */
|
||||
memset( &attr, 0, sizeof( attr ) );
|
||||
attr.size[0] = 640;
|
||||
attr.size[1] = 640;
|
||||
attr.size[2] = 3;
|
||||
attr.size[3] = 1;
|
||||
attr.dim_num = 4;
|
||||
attr.dtype.qnt_type = VSI_NN_QNT_TYPE_NONE;
|
||||
NEW_NORM_TENSOR(norm_tensor[0], attr, VSI_NN_TYPE_UINT8);
|
||||
|
||||
/* @attach_377/out0_0:out0 */
|
||||
memset( &attr, 0, sizeof( attr ) );
|
||||
attr.size[0] = 85;
|
||||
attr.size[1] = 19200;
|
||||
attr.size[2] = 1;
|
||||
attr.dim_num = 3;
|
||||
attr.dtype.qnt_type = VSI_NN_QNT_TYPE_NONE;
|
||||
NEW_NORM_TENSOR(norm_tensor[1], attr, VSI_NN_TYPE_FLOAT32);
|
||||
|
||||
/* @attach_429/out0_1:out0 */
|
||||
memset( &attr, 0, sizeof( attr ) );
|
||||
attr.size[0] = 85;
|
||||
attr.size[1] = 4800;
|
||||
attr.size[2] = 1;
|
||||
attr.dim_num = 3;
|
||||
attr.dtype.qnt_type = VSI_NN_QNT_TYPE_NONE;
|
||||
NEW_NORM_TENSOR(norm_tensor[2], attr, VSI_NN_TYPE_FLOAT32);
|
||||
|
||||
/* @attach_481/out0_2:out0 */
|
||||
memset( &attr, 0, sizeof( attr ) );
|
||||
attr.size[0] = 85;
|
||||
attr.size[1] = 1200;
|
||||
attr.size[2] = 1;
|
||||
attr.dim_num = 3;
|
||||
attr.dtype.qnt_type = VSI_NN_QNT_TYPE_NONE;
|
||||
NEW_NORM_TENSOR(norm_tensor[3], attr, VSI_NN_TYPE_FLOAT32);
|
||||
|
||||
|
||||
|
||||
if( !inference_with_nbg )
|
||||
{
|
||||
pp_scales_zps = vnn_CreateYolov5sCropAsymu8Tensor(data_file_name, graph, node, norm_tensor, const_tensor);
|
||||
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------
|
||||
Connection initialize
|
||||
|
|
@ -213,22 +361,24 @@ vsi_nn_graph_t * vnn_CreateYolov5sCropAsymu8
|
|||
}
|
||||
|
||||
status = vsi_nn_SetupGraph( graph, sort );
|
||||
if( NULL != pp_scales_zps)
|
||||
{
|
||||
vnn_ReleaseYolov5sCropAsymu8TensorQuantParams(pp_scales_zps);
|
||||
}
|
||||
TEST_CHECK_STATUS( status, error );
|
||||
|
||||
|
||||
|
||||
if( VSI_FAILURE == status )
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
fclose( fp );
|
||||
|
||||
return graph;
|
||||
|
||||
error:
|
||||
if( NULL != fp )
|
||||
{
|
||||
fclose( fp );
|
||||
}
|
||||
|
||||
release_ctx = ( NULL == in_ctx );
|
||||
vsi_nn_DumpGraphToJson( graph );
|
||||
vnn_ReleaseYolov5sCropAsymu8( graph, release_ctx );
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network appliction network definition header file
|
||||
|
|
@ -36,18 +36,4 @@ vsi_nn_graph_t * vnn_CreateYolov5sCropAsymu8
|
|||
uint32_t post_process_map_count
|
||||
);
|
||||
|
||||
void** vnn_CreateYolov5sCropAsymu8Tensor
|
||||
(
|
||||
const char * data_file_name,
|
||||
vsi_nn_graph_t * graph,
|
||||
vsi_nn_node_t * node[],
|
||||
vsi_nn_tensor_id_t norm_tensor[],
|
||||
vsi_nn_tensor_id_t const_tensor[]
|
||||
);
|
||||
|
||||
void vnn_ReleaseYolov5sCropAsymu8TensorQuantParams
|
||||
(
|
||||
void ** pp_scales_zps
|
||||
);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -214,7 +214,6 @@
|
|||
<ClInclude Include="vnn_pre_process.h" />
|
||||
<ClInclude Include="vnn_global.h" />
|
||||
<ClCompile Include="vnn_yolov5scropasymu8.c" />
|
||||
<ClCompile Include="vnn_yolov5scropasymu8_tensor.c" />
|
||||
<ClCompile Include="vnn_post_process.c" />
|
||||
<ClCompile Include="vnn_pre_process.c" />
|
||||
<ClCompile Include="main.c" />
|
||||
|
|
|
|||
|
|
@ -128,13 +128,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(AQROOT)\sdk\inc;$(OVXLIB_PATH)\include;$(OVXLIB_PATH)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIVANTE_SDK_DIR)\lib;$(VIVANTE_SDK_DIR)\bin;$(SolutionDir)$(Configuration);</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
|
@ -143,13 +141,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(AQROOT)\sdk\inc;$(OVXLIB_PATH)\include;$(OVXLIB_PATH)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIVANTE_SDK_DIR)\lib;$(VIVANTE_SDK_DIR)\bin;$(SolutionDir)$(Configuration);</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Jenkins-Debug|Win32'">
|
||||
|
|
@ -158,13 +154,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(VIV_SDK_PATH)\include;$(SolutionDir)\include;$(SolutionDir)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIV_SDK_PATH)\lib\win32;$(SolutionDir)$(Configuration)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Jenkins-Debug|x64'">
|
||||
|
|
@ -173,13 +167,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(VIV_SDK_PATH)\include;$(SolutionDir)\include;$(SolutionDir)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIV_SDK_PATH)\lib\win32;$(SolutionDir)$(Configuration)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
|
|
@ -190,7 +182,6 @@
|
|||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
|
@ -198,7 +189,6 @@
|
|||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
|
@ -209,7 +199,6 @@
|
|||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
|
@ -217,7 +206,6 @@
|
|||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
@ -226,7 +214,6 @@
|
|||
<ClInclude Include="vnn_pre_process.h" />
|
||||
<ClInclude Include="vnn_global.h" />
|
||||
<ClCompile Include="vnn_yolov5scropasymu8.c" />
|
||||
<ClCompile Include="vnn_yolov5scropasymu8_tensor.c" />
|
||||
<ClCompile Include="vnn_post_process.c" />
|
||||
<ClCompile Include="vnn_pre_process.c" />
|
||||
<ClCompile Include="main.c" />
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"MetaData": {
|
||||
"Name": "torch-jit-export",
|
||||
"AcuityVersion": "6.39.1",
|
||||
"AcuityVersion": "6",
|
||||
"Platform": "tensorflow",
|
||||
"Org_Platform": "onnx"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@ input_meta:
|
|||
- 0.00392156862745098
|
||||
- 0.00392156862745098
|
||||
preproc_node_params:
|
||||
add_preproc_node: true
|
||||
preproc_type: IMAGE_RGB
|
||||
preproc_type: IMAGE_RGB888_PLANAR
|
||||
preproc_image_size:
|
||||
- 640
|
||||
- 640
|
||||
|
|
@ -49,13 +48,13 @@ input_meta:
|
|||
- 1
|
||||
- 2
|
||||
- 3
|
||||
add_preproc_node: true
|
||||
preproc_dtype_converter:
|
||||
qtype: uint8
|
||||
quantizer: asymmetric_affine
|
||||
rounding: rtne
|
||||
quant_range_mode: 0
|
||||
max_value: 0.9650118350982666
|
||||
max_value: 1.0
|
||||
min_value: 0.0
|
||||
scale: 0.0037843601312488317
|
||||
scale: 0.003921568859368563
|
||||
zero_point: 0
|
||||
redirect_to_output: false
|
||||
|
|
|
|||
|
|
@ -8,25 +8,25 @@ postprocess:
|
|||
app_postprocs:
|
||||
- lid: attach_377/out0_0
|
||||
postproc_params:
|
||||
add_postproc_node: true
|
||||
perm:
|
||||
- 0
|
||||
- 1
|
||||
- 2
|
||||
force_float32: true
|
||||
add_postproc_node: true
|
||||
- lid: attach_429/out0_1
|
||||
postproc_params:
|
||||
add_postproc_node: true
|
||||
perm:
|
||||
- 0
|
||||
- 1
|
||||
- 2
|
||||
force_float32: true
|
||||
add_postproc_node: true
|
||||
- lid: attach_481/out0_2
|
||||
postproc_params:
|
||||
add_postproc_node: true
|
||||
perm:
|
||||
- 0
|
||||
- 1
|
||||
- 2
|
||||
force_float32: true
|
||||
add_postproc_node: true
|
||||
|
|
|
|||
|
|
@ -0,0 +1,153 @@
|
|||
from typing import List, Tuple
|
||||
import cv2
|
||||
import numpy as np
|
||||
from utils.client import *
|
||||
|
||||
class_names = [
|
||||
"person", "bicycle", "car", "motorcycle", "airplane", "bus", "train", "truck",
|
||||
"boat", "traffic light", "fire hydrant", "stop sign", "parking meter", "bench",
|
||||
"bird", "cat", "dog", "horse", "sheep", "cow", "elephant", "bear", "zebra",
|
||||
"giraffe", "backpack", "umbrella", "handbag", "tie", "suitcase", "frisbee",
|
||||
"skis", "snowboard", "sports ball", "kite", "baseball bat", "baseball glove",
|
||||
"skateboard", "surfboard", "tennis racket", "bottle", "wine glass", "cup",
|
||||
"fork", "knife", "spoon", "bowl", "banana", "apple", "sandwich", "orange",
|
||||
"broccoli", "carrot", "hot dog", "pizza", "donut", "cake", "chair", "couch",
|
||||
"potted plant", "bed", "dining table", "toilet", "tv", "laptop", "mouse",
|
||||
"remote", "keyboard", "cell phone", "microwave", "oven", "toaster", "sink",
|
||||
"refrigerator", "book", "clock", "vase", "scissors", "teddy bear", "hair drier",
|
||||
"toothbrush"
|
||||
]
|
||||
|
||||
def draw_result(detections, src_img, class_names):
|
||||
"""结果显示与保存
|
||||
Parameters
|
||||
----------
|
||||
detections : 目标框的信息
|
||||
src_img : 原图
|
||||
class_names : 类别
|
||||
|
||||
Returns
|
||||
-------
|
||||
结果图
|
||||
"""
|
||||
if class_names is None:
|
||||
class_names = [str(i) for i in range(80)]
|
||||
|
||||
img_draw = src_img.copy()
|
||||
for det_box in detections:
|
||||
x, y, w, h, conf, *class_probs = det_box # ceter x y w h
|
||||
class_id = np.argmax(class_probs)
|
||||
x1, y1 = int(x - w / 2), int(y - h / 2)
|
||||
x2, y2 = int(x + w / 2), int(y + h / 2)
|
||||
class_name = class_names[class_id]
|
||||
cv2.rectangle(img_draw, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
||||
label = f"{class_name}: {conf:.2f}"
|
||||
(label_width, label_height), _ = cv2.getTextSize(label, cv2.FONT_HERSHEY_SIMPLEX, 0.6, 2)
|
||||
cv2.rectangle(img_draw, (x1, y1 - label_height - 5), (x1 + label_width, y1), (0, 255, 0), -1)
|
||||
cv2.putText( img_draw, label, (x1, y1 - 5),cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 0, 0), 2)
|
||||
# 保存结果
|
||||
cv2.imwrite('./yolov5s_crop_hb/result.jpg', img_draw)
|
||||
cv2.imshow('img_draw', img_draw)
|
||||
cv2.waitKey(0)
|
||||
return img_draw
|
||||
|
||||
|
||||
def non_maximum_suppression(merged_result, conf_threshold, iou_threshold):
|
||||
"""目标检测中用于去除冗余检测框的后处理算法
|
||||
----------
|
||||
merged_result : 所有的检测框
|
||||
conf_threshold : 置信度阈值
|
||||
iou_threshold : IoU阈值
|
||||
|
||||
Returns
|
||||
最终的结果框
|
||||
"""
|
||||
mask = merged_result[:, 4] > conf_threshold
|
||||
merged_result = merged_result[mask]
|
||||
|
||||
boxes = merged_result[:, :4]
|
||||
scores = merged_result[:, 4]
|
||||
indices = cv2.dnn.NMSBoxes(boxes.tolist(), scores.tolist(), conf_threshold, iou_threshold)
|
||||
detections = merged_result[indices] if len(indices) > 0 else np.array([])
|
||||
return detections
|
||||
|
||||
def post_process(
|
||||
src_img,
|
||||
merged_result,
|
||||
class_names: List[str] = None,
|
||||
conf_threshold: float = 0.55,
|
||||
iou_threshold: float = 0.3
|
||||
):
|
||||
"""
|
||||
|
||||
结果后处理以及结果显示
|
||||
----------
|
||||
src_img : 原图
|
||||
merged_result : 推理结果
|
||||
class_names : 类名称
|
||||
conf_threshold : 置信度阈值
|
||||
iou_threshold : iou阈值
|
||||
|
||||
Returns
|
||||
-------
|
||||
结果图
|
||||
"""
|
||||
|
||||
detections = non_maximum_suppression(merged_result, conf_threshold, iou_threshold)
|
||||
img_draw = draw_result(detections, src_img, class_names)
|
||||
return img_draw
|
||||
|
||||
|
||||
def preprocess(image, target_size=640):
|
||||
"""预处理:将输入图像resize到固定大小并转为CHW格式
|
||||
Parameters
|
||||
----------
|
||||
image : 输入图像
|
||||
target_size : 目标尺寸,默认640
|
||||
|
||||
Returns
|
||||
-------
|
||||
处理后的图像数据(CHW格式)
|
||||
"""
|
||||
img = cv2.resize(image, (target_size, target_size))
|
||||
img = img.transpose(2, 0, 1)
|
||||
return img
|
||||
|
||||
|
||||
def parse_infer_result(infer_data):
|
||||
"""将推理输出的多个bytes结果合并解析为(25200, 85)的numpy数组
|
||||
|
||||
Parameters
|
||||
----------
|
||||
infer_data : list[bytes]
|
||||
推理输出的多个二进制数据
|
||||
|
||||
Returns
|
||||
-------
|
||||
np.ndarray
|
||||
形状为(25200, 85)的检测结果
|
||||
"""
|
||||
return np.concatenate([
|
||||
np.frombuffer(d, dtype=np.float32).flatten() for d in infer_data
|
||||
]).reshape(25200, 85)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
method_model = 'yolov5s_crop_hb'
|
||||
src_img = cv2.imread('./yolov5s_crop_hb/0.jpg')
|
||||
|
||||
# 预处理:resize到640x640并转为CHW格式
|
||||
input_data = preprocess(src_img, 640)
|
||||
|
||||
pnna_device = Client("ws://202.197.27.110:8000/websocket")
|
||||
ret_add = pnna_device.add_model('./yolov5s_crop_hb/wksp/yolov5s_crop_hb_asymu8_hy_nbg_unify/network_binary.nb', method_model)
|
||||
|
||||
# 单次推理
|
||||
infer_data, infer_time = pnna_device.infer(method_model, input_data)
|
||||
print('infer_time', infer_time)
|
||||
|
||||
detections = parse_infer_result(infer_data)
|
||||
|
||||
post_process(src_img, detections, class_names)
|
||||
pnna_device.close()
|
||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 220 KiB |
|
|
@ -1 +1 @@
|
|||
0.0 0.0 0.0 255.0 255.0 255.0
|
||||
0.0 0.0 0.0 1.0 1.0 1.0
|
||||
|
After Width: | Height: | Size: 231 KiB |
|
|
@ -7,7 +7,6 @@ filegroup(
|
|||
srcs =
|
||||
[
|
||||
"vnn_yolov5scrophbasymu8hy.c",
|
||||
"vnn_yolov5scrophbasymu8hy_tensor.c",
|
||||
"vnn_yolov5scrophbasymu8hy.h",
|
||||
"vnn_post_process.c",
|
||||
"vnn_post_process.h",
|
||||
|
|
|
|||
|
|
@ -4,66 +4,81 @@
|
|||
"Version": "0.0.1"
|
||||
},
|
||||
"Layers": {
|
||||
"node_100210": {
|
||||
"node_100178": {
|
||||
"inputs": [],
|
||||
"outputs": ["out0"],
|
||||
"op": "TensorMul",
|
||||
"parameters": {
|
||||
"input0_dtype": "kFloat16",
|
||||
"input0_dtype": "kInt16",
|
||||
"input0_shape": ["[2", " 80", " 80", " 3", " 1]"],
|
||||
"input0_lifetime": "kInput",
|
||||
"input0_dma_mem_attr": "0",
|
||||
"input1_dtype": "kFloat16",
|
||||
"input1_dtype": "kInt16",
|
||||
"input1_shape": ["[2", " 80", " 80", " 3", " 1]"],
|
||||
"input1_lifetime": "kInput",
|
||||
"input1_lifetime": "kConstant",
|
||||
"input1_dma_mem_attr": "0",
|
||||
"output_dtype": "kFloat16",
|
||||
"output_dtype": "kInt16",
|
||||
"output_shape": ["[2", " 80", " 80", " 3", " 1]"],
|
||||
"output_lifetime": "kTransient",
|
||||
"output_dma_mem_attr": "0"
|
||||
}
|
||||
},
|
||||
"node_100211": {
|
||||
"inputs": ["@node_100210:out0"],
|
||||
"node_100179": {
|
||||
"inputs": ["@node_100178:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "Concat",
|
||||
"parameters": {
|
||||
"input_0_dtype": "kFloat16",
|
||||
"input_0_dtype": "kInt16",
|
||||
"input_0_shape": ["[2", " 80", " 80", " 3", " 1]"],
|
||||
"input_0_lifetime": "kInput",
|
||||
"input_0_dma_mem_attr": "0",
|
||||
"input_1_dtype": "kFloat16",
|
||||
"input_1_dtype": "kInt16",
|
||||
"input_1_shape": ["[2", " 80", " 80", " 3", " 1]"],
|
||||
"input_1_lifetime": "kTransient",
|
||||
"input_1_dma_mem_attr": "0",
|
||||
"input_2_dtype": "kFloat16",
|
||||
"input_2_dtype": "kInt16",
|
||||
"input_2_shape": ["[81", " 80", " 80", " 3", " 1]"],
|
||||
"input_2_lifetime": "kInput",
|
||||
"input_2_dma_mem_attr": "0",
|
||||
"output_dtype": "kFloat16",
|
||||
"output_dtype": "kInt16",
|
||||
"output_shape": ["[85", " 80", " 80", " 3", " 1]"],
|
||||
"output_lifetime": "kTransient",
|
||||
"output_dma_mem_attr": "0",
|
||||
"axis": 0
|
||||
}
|
||||
},
|
||||
"node_100212": {
|
||||
"inputs": ["@node_100211:out0"],
|
||||
"node_100180": {
|
||||
"inputs": ["@node_100179:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "Reshape",
|
||||
"parameters": {
|
||||
"input_dtype": "kFloat16",
|
||||
"input_dtype": "kInt16",
|
||||
"input_shape": ["[85", " 80", " 80", " 3", " 1]"],
|
||||
"input_lifetime": "kTransient",
|
||||
"input_dma_mem_attr": "0",
|
||||
"output_dtype": "kInt16",
|
||||
"output_shape": ["[85", " 19200", " 1]"],
|
||||
"output_lifetime": "kTransient",
|
||||
"output_dma_mem_attr": "0"
|
||||
}
|
||||
},
|
||||
"node_100181": {
|
||||
"inputs": ["@node_100180:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "TensorCopy",
|
||||
"parameters": {
|
||||
"input_dtype": "kInt16",
|
||||
"input_shape": ["[85", " 19200", " 1]"],
|
||||
"input_lifetime": "kTransient",
|
||||
"input_dma_mem_attr": "0",
|
||||
"output_dtype": "kFloat16",
|
||||
"output_shape": ["[85", " 19200", " 1]"],
|
||||
"output_lifetime": "kTransient",
|
||||
"output_dma_mem_attr": "0"
|
||||
}
|
||||
},
|
||||
"node_100213": {
|
||||
"inputs": ["@node_100212:out0"],
|
||||
"node_100182": {
|
||||
"inputs": ["@node_100181:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "TensorCopy",
|
||||
"parameters": {
|
||||
|
|
@ -77,124 +92,154 @@
|
|||
"output_dma_mem_attr": "0"
|
||||
}
|
||||
},
|
||||
"node_100214": {
|
||||
"node_100183": {
|
||||
"inputs": [],
|
||||
"outputs": ["out0"],
|
||||
"op": "TensorMul",
|
||||
"parameters": {
|
||||
"input0_dtype": "kFloat16",
|
||||
"input0_dtype": "kInt16",
|
||||
"input0_shape": ["[2", " 40", " 40", " 3", " 1]"],
|
||||
"input0_lifetime": "kInput",
|
||||
"input0_dma_mem_attr": "0",
|
||||
"input1_dtype": "kFloat16",
|
||||
"input1_dtype": "kInt16",
|
||||
"input1_shape": ["[2", " 40", " 40", " 3", " 1]"],
|
||||
"input1_lifetime": "kInput",
|
||||
"input1_lifetime": "kConstant",
|
||||
"input1_dma_mem_attr": "0",
|
||||
"output_dtype": "kFloat16",
|
||||
"output_dtype": "kInt16",
|
||||
"output_shape": ["[2", " 40", " 40", " 3", " 1]"],
|
||||
"output_lifetime": "kTransient",
|
||||
"output_dma_mem_attr": "0"
|
||||
}
|
||||
},
|
||||
"node_100215": {
|
||||
"inputs": ["@node_100214:out0"],
|
||||
"node_100184": {
|
||||
"inputs": ["@node_100183:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "Concat",
|
||||
"parameters": {
|
||||
"input_0_dtype": "kFloat16",
|
||||
"input_0_dtype": "kInt16",
|
||||
"input_0_shape": ["[2", " 40", " 40", " 3", " 1]"],
|
||||
"input_0_lifetime": "kInput",
|
||||
"input_0_dma_mem_attr": "0",
|
||||
"input_1_dtype": "kFloat16",
|
||||
"input_1_dtype": "kInt16",
|
||||
"input_1_shape": ["[2", " 40", " 40", " 3", " 1]"],
|
||||
"input_1_lifetime": "kTransient",
|
||||
"input_1_dma_mem_attr": "0",
|
||||
"input_2_dtype": "kFloat16",
|
||||
"input_2_dtype": "kInt16",
|
||||
"input_2_shape": ["[81", " 40", " 40", " 3", " 1]"],
|
||||
"input_2_lifetime": "kInput",
|
||||
"input_2_dma_mem_attr": "0",
|
||||
"output_dtype": "kFloat16",
|
||||
"output_dtype": "kInt16",
|
||||
"output_shape": ["[85", " 40", " 40", " 3", " 1]"],
|
||||
"output_lifetime": "kTransient",
|
||||
"output_dma_mem_attr": "0",
|
||||
"axis": 0
|
||||
}
|
||||
},
|
||||
"node_100216": {
|
||||
"inputs": ["@node_100215:out0"],
|
||||
"node_100185": {
|
||||
"inputs": ["@node_100184:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "Reshape",
|
||||
"parameters": {
|
||||
"input_dtype": "kFloat16",
|
||||
"input_dtype": "kInt16",
|
||||
"input_shape": ["[85", " 40", " 40", " 3", " 1]"],
|
||||
"input_lifetime": "kTransient",
|
||||
"input_dma_mem_attr": "0",
|
||||
"output_dtype": "kInt16",
|
||||
"output_shape": ["[85", " 4800", " 1]"],
|
||||
"output_lifetime": "kTransient",
|
||||
"output_dma_mem_attr": "0"
|
||||
}
|
||||
},
|
||||
"node_100186": {
|
||||
"inputs": ["@node_100185:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "TensorCopy",
|
||||
"parameters": {
|
||||
"input_dtype": "kInt16",
|
||||
"input_shape": ["[85", " 4800", " 1]"],
|
||||
"input_lifetime": "kTransient",
|
||||
"input_dma_mem_attr": "0",
|
||||
"output_dtype": "kFloat16",
|
||||
"output_shape": ["[85", " 4800", " 1]"],
|
||||
"output_lifetime": "kTransient",
|
||||
"output_dma_mem_attr": "0"
|
||||
}
|
||||
},
|
||||
"node_100217": {
|
||||
"node_100187": {
|
||||
"inputs": [],
|
||||
"outputs": ["out0"],
|
||||
"op": "TensorMul",
|
||||
"parameters": {
|
||||
"input0_dtype": "kFloat16",
|
||||
"input0_dtype": "kInt16",
|
||||
"input0_shape": ["[2", " 20", " 20", " 3", " 1]"],
|
||||
"input0_lifetime": "kInput",
|
||||
"input0_dma_mem_attr": "0",
|
||||
"input1_dtype": "kFloat16",
|
||||
"input1_dtype": "kInt16",
|
||||
"input1_shape": ["[2", " 20", " 20", " 3", " 1]"],
|
||||
"input1_lifetime": "kInput",
|
||||
"input1_lifetime": "kConstant",
|
||||
"input1_dma_mem_attr": "0",
|
||||
"output_dtype": "kFloat16",
|
||||
"output_dtype": "kInt16",
|
||||
"output_shape": ["[2", " 20", " 20", " 3", " 1]"],
|
||||
"output_lifetime": "kTransient",
|
||||
"output_dma_mem_attr": "0"
|
||||
}
|
||||
},
|
||||
"node_100218": {
|
||||
"inputs": ["@node_100217:out0"],
|
||||
"node_100188": {
|
||||
"inputs": ["@node_100187:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "Concat",
|
||||
"parameters": {
|
||||
"input_0_dtype": "kFloat16",
|
||||
"input_0_dtype": "kInt16",
|
||||
"input_0_shape": ["[2", " 20", " 20", " 3", " 1]"],
|
||||
"input_0_lifetime": "kInput",
|
||||
"input_0_dma_mem_attr": "0",
|
||||
"input_1_dtype": "kFloat16",
|
||||
"input_1_dtype": "kInt16",
|
||||
"input_1_shape": ["[2", " 20", " 20", " 3", " 1]"],
|
||||
"input_1_lifetime": "kTransient",
|
||||
"input_1_dma_mem_attr": "0",
|
||||
"input_2_dtype": "kFloat16",
|
||||
"input_2_dtype": "kInt16",
|
||||
"input_2_shape": ["[81", " 20", " 20", " 3", " 1]"],
|
||||
"input_2_lifetime": "kInput",
|
||||
"input_2_dma_mem_attr": "0",
|
||||
"output_dtype": "kFloat16",
|
||||
"output_dtype": "kInt16",
|
||||
"output_shape": ["[85", " 20", " 20", " 3", " 1]"],
|
||||
"output_lifetime": "kTransient",
|
||||
"output_dma_mem_attr": "0",
|
||||
"axis": 0
|
||||
}
|
||||
},
|
||||
"node_100219": {
|
||||
"inputs": ["@node_100218:out0"],
|
||||
"node_100189": {
|
||||
"inputs": ["@node_100188:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "Reshape",
|
||||
"parameters": {
|
||||
"input_dtype": "kFloat16",
|
||||
"input_dtype": "kInt16",
|
||||
"input_shape": ["[85", " 20", " 20", " 3", " 1]"],
|
||||
"input_lifetime": "kTransient",
|
||||
"input_dma_mem_attr": "0",
|
||||
"output_dtype": "kInt16",
|
||||
"output_shape": ["[85", " 1200", " 1]"],
|
||||
"output_lifetime": "kTransient",
|
||||
"output_dma_mem_attr": "0"
|
||||
}
|
||||
},
|
||||
"node_100190": {
|
||||
"inputs": ["@node_100189:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "TensorCopy",
|
||||
"parameters": {
|
||||
"input_dtype": "kInt16",
|
||||
"input_shape": ["[85", " 1200", " 1]"],
|
||||
"input_lifetime": "kTransient",
|
||||
"input_dma_mem_attr": "0",
|
||||
"output_dtype": "kFloat16",
|
||||
"output_shape": ["[85", " 1200", " 1]"],
|
||||
"output_lifetime": "kTransient",
|
||||
"output_dma_mem_attr": "0"
|
||||
}
|
||||
},
|
||||
"node_100220": {
|
||||
"inputs": ["@node_100219:out0"],
|
||||
"node_100191": {
|
||||
"inputs": ["@node_100190:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "TensorCopy",
|
||||
"parameters": {
|
||||
|
|
@ -208,8 +253,8 @@
|
|||
"output_dma_mem_attr": "0"
|
||||
}
|
||||
},
|
||||
"node_100221": {
|
||||
"inputs": ["@node_100216:out0"],
|
||||
"node_100192": {
|
||||
"inputs": ["@node_100186:out0"],
|
||||
"outputs": ["out0"],
|
||||
"op": "TensorCopy",
|
||||
"parameters": {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network application project entry file
|
||||
|
|
@ -43,11 +43,11 @@ static void vnn_ReleaseNeuralNetwork
|
|||
vsi_nn_graph_t *graph
|
||||
)
|
||||
{
|
||||
if (vnn_UseImagePreprocessNode(graph))
|
||||
vnn_ReleaseYolov5sCropHbAsymu8Hy( graph, TRUE );
|
||||
if (vnn_UseImagePreprocessNode())
|
||||
{
|
||||
vnn_ReleaseBufferImage();
|
||||
}
|
||||
vnn_ReleaseYolov5sCropHbAsymu8Hy( graph, TRUE );
|
||||
}
|
||||
|
||||
static vsi_status vnn_PostProcessNeuralNetwork
|
||||
|
|
@ -108,7 +108,7 @@ static vsi_status vnn_ProcessGraph
|
|||
vsi_status status = VSI_FAILURE;
|
||||
int32_t i,loop;
|
||||
char *loop_s;
|
||||
uint64_t tmsTotal = 0, tmsSig, sigStart, sigEnd;
|
||||
uint64_t tmsStart, tmsEnd, sigStart, sigEnd;
|
||||
float msVal, usVal;
|
||||
|
||||
status = VSI_FAILURE;
|
||||
|
|
@ -120,6 +120,7 @@ static vsi_status vnn_ProcessGraph
|
|||
}
|
||||
|
||||
/* Run graph */
|
||||
tmsStart = get_perf_count();
|
||||
printf("Start run graph [%d] times...\n", loop);
|
||||
for(i = 0; i < loop; i++)
|
||||
{
|
||||
|
|
@ -149,14 +150,13 @@ static vsi_status vnn_ProcessGraph
|
|||
TEST_CHECK_STATUS( status, final );
|
||||
|
||||
sigEnd = get_perf_count();
|
||||
tmsSig = sigEnd - sigStart;
|
||||
msVal = tmsSig / (float)1000000;
|
||||
usVal = tmsSig / (float)1000;
|
||||
tmsTotal += tmsSig;
|
||||
msVal = (sigEnd - sigStart)/(float)1000000;
|
||||
usVal = (sigEnd - sigStart)/(float)1000;
|
||||
printf("Run the %u time: %.2fms or %.2fus\n", (i + 1), msVal, usVal);
|
||||
}
|
||||
msVal = tmsTotal / (float)1000000;
|
||||
usVal = tmsTotal / (float)1000;
|
||||
tmsEnd = get_perf_count();
|
||||
msVal = (tmsEnd - tmsStart)/(float)1000000;
|
||||
usVal = (tmsEnd - tmsStart)/(float)1000;
|
||||
printf("vxProcessGraph execution time:\n");
|
||||
printf("Total %.2fms or %.2fus\n", msVal, usVal);
|
||||
printf("Average %.2fms or %.2fus\n", ((float)usVal)/1000/loop, ((float)usVal)/loop);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network global header file
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network appliction post-process source file
|
||||
|
|
@ -198,5 +198,8 @@ const vsi_nn_postprocess_map_element_t * vnn_GetPostProcessMap()
|
|||
|
||||
uint32_t vnn_GetPostProcessMapCount()
|
||||
{
|
||||
return sizeof(postprocess_map) / sizeof(vsi_nn_postprocess_map_element_t);
|
||||
if (postprocess_map == NULL)
|
||||
return 0;
|
||||
else
|
||||
return sizeof(postprocess_map) / sizeof(vsi_nn_postprocess_map_element_t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network appliction post-process header file
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network appliction pre-process source file
|
||||
|
|
@ -10,12 +10,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "jpeglib.h"
|
||||
#include "vsi_nn_pub.h"
|
||||
|
|
@ -29,7 +23,7 @@
|
|||
-------------------------------------------*/
|
||||
/*pre process for lid: images_268*/
|
||||
vsi_nn_preprocess_source_layout_e source_layout_for_norm_tensor_3 = VSI_NN_SOURCE_LAYOUT_NCHW;
|
||||
vsi_nn_preprocess_source_format_e source_format_for_norm_tensor_3 = VSI_NN_SOURCE_FORMAT_IMAGE_RGB;
|
||||
vsi_nn_preprocess_source_format_e source_format_for_norm_tensor_3 = VSI_NN_SOURCE_FORMAT_IMAGE_RGB888_PLANAR;
|
||||
vsi_nn_preprocess_image_size_t size_for_norm_tensor_3 = {640, 640, 3};
|
||||
|
||||
vsi_nn_preprocess_image_resize_t resize_for_norm_tensor_3 = {640, 640, 3};
|
||||
|
|
@ -38,7 +32,7 @@ float mean_and_scale_3[] = {0.0, 0.0, 0.0};
|
|||
vsi_nn_preprocess_mean_and_scale_t mean_and_scale_for_norm_tensor_3 = {mean_and_scale_3, 3, 0.003921569};
|
||||
int32_t perm_3[] = {0, 1, 2, 3};
|
||||
vsi_nn_preprocess_permute_t permute_for_norm_tensor_3 = {perm_3, 4};
|
||||
vsi_nn_preprocess_dtype_convert_t dtype_converter_for_norm_tensor_3={.dtype.fmt=VSI_NN_DIM_FMT_NCHW, .dtype.vx_type=VSI_NN_TYPE_UINT8, .dtype.qnt_type=VSI_NN_QNT_TYPE_AFFINE_ASYMMETRIC, .dtype.zero_point=0, .dtype.scale=0.00390619};
|
||||
vsi_nn_preprocess_dtype_convert_t dtype_converter_for_norm_tensor3={.dtype.fmt=VSI_NN_DIM_FMT_NCHW, .dtype.vx_type=VSI_NN_TYPE_UINT8, .dtype.qnt_type=VSI_NN_QNT_TYPE_AFFINE_ASYMMETRIC, .dtype.zero_point=0, .dtype.scale=0.003921568859368563};
|
||||
vsi_nn_preprocess_base_t pre_process_for_norm_tensor_3[] =
|
||||
{
|
||||
{VSI_NN_PREPROCESS_SOURCE_LAYOUT, &source_layout_for_norm_tensor_3},
|
||||
|
|
@ -49,7 +43,7 @@ vsi_nn_preprocess_base_t pre_process_for_norm_tensor_3[] =
|
|||
{VSI_NN_PREPROCESS_REVERSE_CHANNEL, &reverse_channel_for_norm_tensor_3},
|
||||
{VSI_NN_PREPROCESS_MEAN_AND_SCALE, &mean_and_scale_for_norm_tensor_3},
|
||||
{VSI_NN_PREPROCESS_PERMUTE, &permute_for_norm_tensor_3},
|
||||
{VSI_NN_PREPROCESS_DTYPE_CONVERT, &dtype_converter_for_norm_tensor_3},
|
||||
{VSI_NN_PREPROCESS_DTYPE_CONVERT, &dtype_converter_for_norm_tensor3},
|
||||
};
|
||||
|
||||
/*{graph_input_idx, preprocess}*/
|
||||
|
|
@ -63,7 +57,7 @@ const static vsi_nn_preprocess_map_element_t preprocess_map[] =
|
|||
-------------------------------------------*/
|
||||
#define INPUT_META_NUM 1
|
||||
static vnn_input_meta_t input_meta_tab[INPUT_META_NUM];
|
||||
static void _load_input_meta(vsi_nn_graph_t *graph)
|
||||
static void _load_input_meta()
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < INPUT_META_NUM; i++)
|
||||
|
|
@ -71,7 +65,7 @@ static void _load_input_meta(vsi_nn_graph_t *graph)
|
|||
memset(&input_meta_tab[i].image.preprocess,
|
||||
VNN_PREPRO_NONE, sizeof(int32_t) * VNN_PREPRO_NUM);
|
||||
}
|
||||
if (vnn_UseImagePreprocessNode(graph))
|
||||
if (vnn_UseImagePreprocessNode())
|
||||
{
|
||||
/* lid: images_268 */
|
||||
input_meta_tab[0].image.preprocess[0] = VNN_PREPRO_NONE;
|
||||
|
|
@ -576,14 +570,13 @@ static uint8_t *_get_jpeg_data
|
|||
(
|
||||
vsi_nn_tensor_t *tensor,
|
||||
vnn_input_meta_t *meta,
|
||||
const char *filename,
|
||||
vsi_nn_graph_t* graph
|
||||
const char *filename
|
||||
)
|
||||
{
|
||||
uint32_t i;
|
||||
uint8_t *bmpData,*data;
|
||||
float *fdata;
|
||||
vsi_bool use_image_process = vnn_UseImagePreprocessNode(graph);
|
||||
vsi_bool use_image_process = vnn_UseImagePreprocessNode();
|
||||
|
||||
bmpData = NULL;
|
||||
fdata = NULL;
|
||||
|
|
@ -703,7 +696,7 @@ static vsi_status _handle_multiple_inputs
|
|||
switch(fileType)
|
||||
{
|
||||
case NN_FILE_JPG:
|
||||
data = _get_jpeg_data(tensor, &meta, input_file, graph);
|
||||
data = _get_jpeg_data(tensor, &meta, input_file);
|
||||
TEST_CHECK_PTR(data, final);
|
||||
break;
|
||||
case NN_FILE_TENSOR:
|
||||
|
|
@ -728,11 +721,7 @@ static vsi_status _handle_multiple_inputs
|
|||
TEST_CHECK_STATUS(status, final);
|
||||
|
||||
/* Save the image data to file */
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
p1 = vsi_nn_GetRunTimeVariable(graph, "VSI_SAVE_FILE_TYPE");
|
||||
#else
|
||||
p1 = getenv("VSI_SAVE_FILE_TYPE");
|
||||
#endif
|
||||
p1 = getenv( "VSI_SAVE_FILE_TYPE");
|
||||
|
||||
snprintf(dumpInput, sizeof(dumpInput), "input_%d.dat", idx);
|
||||
vsi_nn_SaveTensorToBinary(graph, tensor, dumpInput);
|
||||
|
|
@ -741,9 +730,6 @@ static vsi_status _handle_multiple_inputs
|
|||
status = VSI_SUCCESS;
|
||||
final:
|
||||
if(data)free(data);
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
if(p1)vsi_nn_Free(p1);
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
@ -753,26 +739,16 @@ void vnn_ReleaseBufferImage()
|
|||
buffer_img = NULL;
|
||||
}
|
||||
|
||||
vsi_bool vnn_UseImagePreprocessNode(vsi_nn_graph_t* graph)
|
||||
vsi_bool vnn_UseImagePreprocessNode()
|
||||
{
|
||||
int32_t use_img_process;
|
||||
char *use_img_process_s;
|
||||
use_img_process = 0; /* default is 0 */
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
use_img_process_s = vsi_nn_GetRunTimeVariable(graph, "VSI_USE_IMAGE_PROCESS");
|
||||
if(use_img_process_s)
|
||||
{
|
||||
use_img_process = atoi(use_img_process_s);
|
||||
vsi_nn_Free(use_img_process_s);
|
||||
use_img_process_s = NULL;
|
||||
}
|
||||
#else
|
||||
use_img_process_s = getenv("VSI_USE_IMAGE_PROCESS");
|
||||
if(use_img_process_s)
|
||||
{
|
||||
use_img_process = atoi(use_img_process_s);
|
||||
}
|
||||
#endif
|
||||
use_img_process_s = getenv("VSI_USE_IMAGE_PROCESS");
|
||||
if(use_img_process_s)
|
||||
{
|
||||
use_img_process = atoi(use_img_process_s);
|
||||
}
|
||||
if (use_img_process)
|
||||
{
|
||||
return TRUE;
|
||||
|
|
@ -790,7 +766,7 @@ vsi_status vnn_PreProcessYolov5sCropHbAsymu8Hy
|
|||
uint32_t i;
|
||||
vsi_status status;
|
||||
status = VSI_FAILURE;
|
||||
_load_input_meta(graph);
|
||||
_load_input_meta();
|
||||
if(input_num != graph->input.num)
|
||||
{
|
||||
printf("Graph need %u inputs, but enter %u inputs!!!\n",
|
||||
|
|
@ -955,5 +931,8 @@ const vsi_nn_preprocess_map_element_t * vnn_GetPreProcessMap()
|
|||
|
||||
uint32_t vnn_GetPreProcessMapCount()
|
||||
{
|
||||
return sizeof(preprocess_map) / sizeof(vsi_nn_preprocess_map_element_t);
|
||||
if (preprocess_map == NULL)
|
||||
return 0;
|
||||
else
|
||||
return sizeof(preprocess_map) / sizeof(vsi_nn_preprocess_map_element_t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network appliction pre-process header file
|
||||
|
|
@ -47,7 +47,7 @@ vsi_status vnn_PreProcessYolov5sCropHbAsymu8Hy
|
|||
uint32_t input_num
|
||||
);
|
||||
|
||||
vsi_bool vnn_UseImagePreprocessNode(vsi_nn_graph_t* graph);
|
||||
vsi_bool vnn_UseImagePreprocessNode();
|
||||
|
||||
void vnn_ReleaseBufferImage();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.53
|
||||
*
|
||||
* Neural Network appliction network definition header file
|
||||
|
|
@ -36,18 +36,4 @@ vsi_nn_graph_t * vnn_CreateYolov5sCropHbAsymu8Hy
|
|||
uint32_t post_process_map_count
|
||||
);
|
||||
|
||||
void** vnn_CreateYolov5sCropHbAsymu8HyTensor
|
||||
(
|
||||
const char * data_file_name,
|
||||
vsi_nn_graph_t * graph,
|
||||
vsi_nn_node_t * node[],
|
||||
vsi_nn_tensor_id_t norm_tensor[],
|
||||
vsi_nn_tensor_id_t const_tensor[]
|
||||
);
|
||||
|
||||
void vnn_ReleaseYolov5sCropHbAsymu8HyTensorQuantParams
|
||||
(
|
||||
void ** pp_scales_zps
|
||||
);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -214,7 +214,6 @@
|
|||
<ClInclude Include="vnn_pre_process.h" />
|
||||
<ClInclude Include="vnn_global.h" />
|
||||
<ClCompile Include="vnn_yolov5scrophbasymu8hy.c" />
|
||||
<ClCompile Include="vnn_yolov5scrophbasymu8hy_tensor.c" />
|
||||
<ClCompile Include="vnn_post_process.c" />
|
||||
<ClCompile Include="vnn_pre_process.c" />
|
||||
<ClCompile Include="main.c" />
|
||||
|
|
|
|||
|
|
@ -128,13 +128,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(AQROOT)\sdk\inc;$(OVXLIB_PATH)\include;$(OVXLIB_PATH)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIVANTE_SDK_DIR)\lib;$(VIVANTE_SDK_DIR)\bin;$(SolutionDir)$(Configuration);</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
|
@ -143,13 +141,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(AQROOT)\sdk\inc;$(OVXLIB_PATH)\include;$(OVXLIB_PATH)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIVANTE_SDK_DIR)\lib;$(VIVANTE_SDK_DIR)\bin;$(SolutionDir)$(Configuration);</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Jenkins-Debug|Win32'">
|
||||
|
|
@ -158,13 +154,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(VIV_SDK_PATH)\include;$(SolutionDir)\include;$(SolutionDir)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIV_SDK_PATH)\lib\win32;$(SolutionDir)$(Configuration)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Jenkins-Debug|x64'">
|
||||
|
|
@ -173,13 +167,11 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(VIV_SDK_PATH)\include;$(SolutionDir)\include;$(SolutionDir)\third-party\jpeg-9b</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(VIV_SDK_PATH)\lib\win32;$(SolutionDir)$(Configuration)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
|
|
@ -190,7 +182,6 @@
|
|||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
|
@ -198,7 +189,6 @@
|
|||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
|
@ -209,7 +199,6 @@
|
|||
<PreprocessorDefinitions>WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
|
@ -217,7 +206,6 @@
|
|||
<AdditionalDependencies>%(AdditionalDependencies)libCLC.lib;libVSC.lib;libOpenVX.lib;libopenvxu.lib;libovxlib.lib;jpeg.lib;</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<StackReserveSize>100000000</StackReserveSize>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
@ -226,7 +214,6 @@
|
|||
<ClInclude Include="vnn_pre_process.h" />
|
||||
<ClInclude Include="vnn_global.h" />
|
||||
<ClCompile Include="vnn_yolov5scrophbasymu8hy.c" />
|
||||
<ClCompile Include="vnn_yolov5scrophbasymu8hy_tensor.c" />
|
||||
<ClCompile Include="vnn_post_process.c" />
|
||||
<ClCompile Include="vnn_pre_process.c" />
|
||||
<ClCompile Include="main.c" />
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ filegroup(
|
|||
srcs =
|
||||
[
|
||||
"vnn_yolov5scrophbasymu8hy.c",
|
||||
"vnn_yolov5scrophbasymu8hy_tensor.c",
|
||||
"vnn_yolov5scrophbasymu8hy.h",
|
||||
"vnn_post_process.c",
|
||||
"vnn_post_process.h",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network application project entry file
|
||||
|
|
@ -43,11 +43,11 @@ static void vnn_ReleaseNeuralNetwork
|
|||
vsi_nn_graph_t *graph
|
||||
)
|
||||
{
|
||||
if (vnn_UseImagePreprocessNode(graph))
|
||||
vnn_ReleaseYolov5sCropHbAsymu8Hy( graph, TRUE );
|
||||
if (vnn_UseImagePreprocessNode())
|
||||
{
|
||||
vnn_ReleaseBufferImage();
|
||||
}
|
||||
vnn_ReleaseYolov5sCropHbAsymu8Hy( graph, TRUE );
|
||||
}
|
||||
|
||||
static vsi_status vnn_PostProcessNeuralNetwork
|
||||
|
|
@ -108,7 +108,7 @@ static vsi_status vnn_ProcessGraph
|
|||
vsi_status status = VSI_FAILURE;
|
||||
int32_t i,loop;
|
||||
char *loop_s;
|
||||
uint64_t tmsTotal = 0, tmsSig, sigStart, sigEnd;
|
||||
uint64_t tmsStart, tmsEnd, sigStart, sigEnd;
|
||||
float msVal, usVal;
|
||||
|
||||
status = VSI_FAILURE;
|
||||
|
|
@ -120,6 +120,7 @@ static vsi_status vnn_ProcessGraph
|
|||
}
|
||||
|
||||
/* Run graph */
|
||||
tmsStart = get_perf_count();
|
||||
printf("Start run graph [%d] times...\n", loop);
|
||||
for(i = 0; i < loop; i++)
|
||||
{
|
||||
|
|
@ -149,14 +150,13 @@ static vsi_status vnn_ProcessGraph
|
|||
TEST_CHECK_STATUS( status, final );
|
||||
|
||||
sigEnd = get_perf_count();
|
||||
tmsSig = sigEnd - sigStart;
|
||||
msVal = tmsSig / (float)1000000;
|
||||
usVal = tmsSig / (float)1000;
|
||||
tmsTotal += tmsSig;
|
||||
msVal = (sigEnd - sigStart)/(float)1000000;
|
||||
usVal = (sigEnd - sigStart)/(float)1000;
|
||||
printf("Run the %u time: %.2fms or %.2fus\n", (i + 1), msVal, usVal);
|
||||
}
|
||||
msVal = tmsTotal / (float)1000000;
|
||||
usVal = tmsTotal / (float)1000;
|
||||
tmsEnd = get_perf_count();
|
||||
msVal = (tmsEnd - tmsStart)/(float)1000000;
|
||||
usVal = (tmsEnd - tmsStart)/(float)1000;
|
||||
printf("vxProcessGraph execution time:\n");
|
||||
printf("Total %.2fms or %.2fus\n", msVal, usVal);
|
||||
printf("Average %.2fms or %.2fus\n", ((float)usVal)/1000/loop, ((float)usVal)/loop);
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
"name": "images_0",
|
||||
"shape": [
|
||||
1,
|
||||
1,
|
||||
3,
|
||||
640,
|
||||
1920
|
||||
640
|
||||
],
|
||||
"format": "nchw",
|
||||
"dtype": "uint8"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network global header file
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network appliction post-process source file
|
||||
|
|
@ -166,5 +166,8 @@ const vsi_nn_postprocess_map_element_t * vnn_GetPostProcessMap()
|
|||
|
||||
uint32_t vnn_GetPostProcessMapCount()
|
||||
{
|
||||
return 0;
|
||||
if (postprocess_map == NULL)
|
||||
return 0;
|
||||
else
|
||||
return sizeof(postprocess_map) / sizeof(vsi_nn_postprocess_map_element_t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network appliction post-process header file
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network appliction pre-process source file
|
||||
|
|
@ -10,12 +10,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "jpeglib.h"
|
||||
#include "vsi_nn_pub.h"
|
||||
|
|
@ -36,7 +30,7 @@ const static vsi_nn_preprocess_map_element_t* preprocess_map = NULL;
|
|||
-------------------------------------------*/
|
||||
#define INPUT_META_NUM 1
|
||||
static vnn_input_meta_t input_meta_tab[INPUT_META_NUM];
|
||||
static void _load_input_meta(vsi_nn_graph_t *graph)
|
||||
static void _load_input_meta()
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < INPUT_META_NUM; i++)
|
||||
|
|
@ -48,7 +42,9 @@ static void _load_input_meta(vsi_nn_graph_t *graph)
|
|||
input_meta_tab[0].image.preprocess[0] = VNN_PREPRO_NONE;
|
||||
input_meta_tab[0].image.preprocess[1] = VNN_PREPRO_NONE;
|
||||
input_meta_tab[0].image.preprocess[2] = VNN_PREPRO_NONE;
|
||||
input_meta_tab[0].image.reorder[0] = 0;
|
||||
input_meta_tab[0].image.reorder[0] = 2;
|
||||
input_meta_tab[0].image.reorder[1] = 1;
|
||||
input_meta_tab[0].image.reorder[2] = 0;
|
||||
input_meta_tab[0].image.mean[0] = 0.0;
|
||||
input_meta_tab[0].image.mean[1] = 0.0;
|
||||
input_meta_tab[0].image.mean[2] = 0.0;
|
||||
|
|
@ -536,14 +532,13 @@ static uint8_t *_get_jpeg_data
|
|||
(
|
||||
vsi_nn_tensor_t *tensor,
|
||||
vnn_input_meta_t *meta,
|
||||
const char *filename,
|
||||
vsi_nn_graph_t* graph
|
||||
const char *filename
|
||||
)
|
||||
{
|
||||
uint32_t i;
|
||||
uint8_t *bmpData,*data;
|
||||
float *fdata;
|
||||
vsi_bool use_image_process = vnn_UseImagePreprocessNode(graph);
|
||||
vsi_bool use_image_process = vnn_UseImagePreprocessNode();
|
||||
|
||||
bmpData = NULL;
|
||||
fdata = NULL;
|
||||
|
|
@ -663,7 +658,7 @@ static vsi_status _handle_multiple_inputs
|
|||
switch(fileType)
|
||||
{
|
||||
case NN_FILE_JPG:
|
||||
data = _get_jpeg_data(tensor, &meta, input_file, graph);
|
||||
data = _get_jpeg_data(tensor, &meta, input_file);
|
||||
TEST_CHECK_PTR(data, final);
|
||||
break;
|
||||
case NN_FILE_TENSOR:
|
||||
|
|
@ -688,11 +683,7 @@ static vsi_status _handle_multiple_inputs
|
|||
TEST_CHECK_STATUS(status, final);
|
||||
|
||||
/* Save the image data to file */
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
p1 = vsi_nn_GetRunTimeVariable(graph, "VSI_SAVE_FILE_TYPE");
|
||||
#else
|
||||
p1 = getenv("VSI_SAVE_FILE_TYPE");
|
||||
#endif
|
||||
p1 = getenv( "VSI_SAVE_FILE_TYPE");
|
||||
|
||||
snprintf(dumpInput, sizeof(dumpInput), "input_%d.dat", idx);
|
||||
vsi_nn_SaveTensorToBinary(graph, tensor, dumpInput);
|
||||
|
|
@ -701,9 +692,6 @@ static vsi_status _handle_multiple_inputs
|
|||
status = VSI_SUCCESS;
|
||||
final:
|
||||
if(data)free(data);
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
if(p1)vsi_nn_Free(p1);
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
@ -713,26 +701,16 @@ void vnn_ReleaseBufferImage()
|
|||
buffer_img = NULL;
|
||||
}
|
||||
|
||||
vsi_bool vnn_UseImagePreprocessNode(vsi_nn_graph_t* graph)
|
||||
vsi_bool vnn_UseImagePreprocessNode()
|
||||
{
|
||||
int32_t use_img_process;
|
||||
char *use_img_process_s;
|
||||
use_img_process = 0; /* default is 0 */
|
||||
#ifdef VSI_GRAPH_RUNTIME_ENV_SUPPORT
|
||||
use_img_process_s = vsi_nn_GetRunTimeVariable(graph, "VSI_USE_IMAGE_PROCESS");
|
||||
if(use_img_process_s)
|
||||
{
|
||||
use_img_process = atoi(use_img_process_s);
|
||||
vsi_nn_Free(use_img_process_s);
|
||||
use_img_process_s = NULL;
|
||||
}
|
||||
#else
|
||||
use_img_process_s = getenv("VSI_USE_IMAGE_PROCESS");
|
||||
if(use_img_process_s)
|
||||
{
|
||||
use_img_process = atoi(use_img_process_s);
|
||||
}
|
||||
#endif
|
||||
use_img_process_s = getenv("VSI_USE_IMAGE_PROCESS");
|
||||
if(use_img_process_s)
|
||||
{
|
||||
use_img_process = atoi(use_img_process_s);
|
||||
}
|
||||
if (use_img_process)
|
||||
{
|
||||
return TRUE;
|
||||
|
|
@ -750,7 +728,7 @@ vsi_status vnn_PreProcessYolov5sCropHbAsymu8Hy
|
|||
uint32_t i;
|
||||
vsi_status status;
|
||||
status = VSI_FAILURE;
|
||||
_load_input_meta(graph);
|
||||
_load_input_meta();
|
||||
if(input_num != graph->input.num)
|
||||
{
|
||||
printf("Graph need %u inputs, but enter %u inputs!!!\n",
|
||||
|
|
@ -915,5 +893,8 @@ const vsi_nn_preprocess_map_element_t * vnn_GetPreProcessMap()
|
|||
|
||||
uint32_t vnn_GetPreProcessMapCount()
|
||||
{
|
||||
return 0;
|
||||
if (preprocess_map == NULL)
|
||||
return 0;
|
||||
else
|
||||
return sizeof(preprocess_map) / sizeof(vsi_nn_preprocess_map_element_t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Generated by ACUITY 6.42.10
|
||||
* Generated by ACUITY 6.33.19
|
||||
* Match ovxlib 1.1.30
|
||||
*
|
||||
* Neural Network appliction pre-process header file
|
||||
|
|
@ -47,7 +47,7 @@ vsi_status vnn_PreProcessYolov5sCropHbAsymu8Hy
|
|||
uint32_t input_num
|
||||
);
|
||||
|
||||
vsi_bool vnn_UseImagePreprocessNode(vsi_nn_graph_t* graph);
|
||||
vsi_bool vnn_UseImagePreprocessNode();
|
||||
|
||||
void vnn_ReleaseBufferImage();
|
||||
|
||||
|
|
|
|||