Giter Club home page Giter Club logo

rknn-toolkit2's People

Contributors

rkchrome avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rknn-toolkit2's Issues

ONNX opset 13?

Would it be possible to get opset 13 support? Thanks!

Custom Operations support

I am attempting to convert a tensorflow CoATnet model but the gelu activation function is not supported. I notice in the previous version of the toolkit (rknn-toolkit) there is documentation for custom operations. Has this support been removed in toolkit version 2? If so, is there a plan to bring it back? If it will be returned, is there an estimated timeline for this?

Thank you.

failed to malloc npu memory

2022-07-06 15:37:03.100 12848-12876 E/RKNN: failed to allocate handle, ret: -1
2022-07-06 15:37:03.100 12848-12876 E/RKNN: failed to malloc npu memory!, size: 59187712, flags: 0x2
2022-07-06 15:37:03.102 12848-12876 E/RKNN: rknn_init, load model failed!

rknn_init fail when using rk3568
rknn model size:56.6 MB
system:android

Can not find dynamic library on RK3566!

root@localhost:/rknn-toolkit2-master/rknn-toolkit-lite2-v1.2.0/examples/inference_with_lite# python3.7 test.py
--> Load RKNN model
done
--> Init runtime environment
E Catch exception when init runtime!
E Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/rknnlite/api/rknn_lite.py", line 141, in init_runtime
async_mode=async_mode, core_mask=core_mask)
File "rknnlite/api/rknn_runtime.py", line 302, in rknnlite.api.rknn_runtime.RKNNRuntime.init
File "rknnlite/api/rknn_runtime.py", line 501, in rknnlite.api.rknn_runtime.RKNNRuntime._load_library
File "rknnlite/api/rknn_runtime.py", line 477, in rknnlite.api.rknn_runtime.RKNNRuntime._get_rknn_api_lib_path
Exception: Can not find dynamic library on RK3566!

Init runtime environment failed

uname -ar

Linux fante 4.19.172 #28 SMP Thu Jul 29 19:20:15 CST 2021 aarch64 aarch64 aarch64 GNU/Linux

cat /proc/device-tree/compatible

rockchip,rk3566-firefly-roc-pcrockchip,rk3566

Did I miss some steps?

RK3568提示驱动有问题

下载RKNN Toolkit Lite2后,按照手册安装。然后我下载了rknpu2,更新最新的驱动到/usr/lib。但是运行RKNN Toolkit Lite2自带的demo后提示错误如下:
`
toybrick@debian10:~/Downloads/rknn_toolkit_lite2/examples/inference_with_lite$ python3 test.py
--> Load RKNN model
done
--> Init runtime environment
E RKNN: [04:05:28.147] failed to open rknpu module, need to insmod rknpu dirver!
E RKNN: [04:05:28.147] failed to open rknn device!
E Catch exception when init runtime!
E Traceback (most recent call last):
File "/home/toybrick/.local/lib/python3.7/site-packages/rknnlite/api/rknn_lite.py", line 148, in init_runtime
self.rknn_runtime.build_graph(self.rknn_data, self.load_model_in_npu)
File "rknnlite/api/rknn_runtime.py", line 838, in rknnlite.api.rknn_runtime.RKNNRuntime.build_graph
Exception: RKNN init failed. error code: RKNN_ERR_FAIL

Init runtime environment failed
`
想问一下错误的原因是什么。使用的固件为toybrick最新的debian10固件,板子为toybrick的3568X

Illegal instruction

m1 pro安装docker镜像后,在docker内跑测试test.py均出现如下报错:
--> Init runtime environment
qemu: uncaught target signal 4 (Illegal instruction) - core dumped

rknn在pc和rk3568上推理结果不同

模型有三个输出,用3568真机实测,只有一个输出和在pc上跑出来的结果差距很大,输出全为1,模型并没有进行量化后处理之类的操作
我看了这三个输出对应的不同算子,只有RKNN: [19:25:28.295] 150 exSoftmax13 input0.4是出错的输出才有的算子.

ValueError: Can not find tensor value info!

你好:

我在ONNX 在转RKNN的时候遇到报错,ValueError: Can not find tensor value info! 有几个疑问:

  1. 具体是哪个tensor 缺失value info 有没有办法查看到?我确认了onnx模型所有value info 都是完整的。
  2. load onnx model 有个fuse ops的过程,这个fuse是对onnx 模型进行的吗?fuse ops之后的模型,是不是会引入Can not find tensor value info的问题?如果是的话,有没有什么解决的方法呢?

谢谢!

Unsupport type bytes 64

It happende when i convert onnx model to rknn model,if anyone konw how can i resolve it?

E RKNN: [11:13:37.407] Unsupport tyep bits 64
Aborted (core dumped)

error: RKNN_ERR_DEVICE_UNAVAILABLE

root@ys:/home/ys/test# python3.7 test_rknn_lite.py
Linux-aarch64
rockchip,rk3568-evb1-ddr4-v10rockchip,rk3568
host: RK356x


None devices connected.


([], [])


Target platforms filled in RKNN model: ['RK3568']
Target platforms supported by this RKNN model: ['RK3566', 'RK3568']


OrderedDict([('filled_target_platform', ['RK3568']), ('support_target_platform', ['RK3566', 'RK3568'])])
--> Load RKNN model
done
load rknn model is done.
--> Init runtime environment
E RKNNAPI: rknn_init, driver open fail! ret = -12(ERROR_NOT_SUPPORTED)!
E Catch exception when init runtime!


None devices connected.


E []
E Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/rknnlite/api/rknn_lite.py", line 148, in init_runtime
self.rknn_runtime.build_graph(self.rknn_data, self.load_model_in_npu)
File "rknnlite/api/rknn_runtime.py", line 838, in rknnlite.api.rknn_runtime.RKNNRuntime.build_graph
Exception: RKNN init failed. error code: RKNN_ERR_DEVICE_UNAVAILABLE

Init runtime environment failed\

====================================
查了下API文档,是i这个原因:
RKNN_ERR_INCOMPATILE_OPTIMIZATION_LEVEL_VERSION(-12) RKNN 模型设置了优化等级的选项, 但是和当前驱动不兼容
请问如何升级NPU驱动,找了半天没找到

rknn-toolkit1上可以正常转换的pytorch-qat模型(普通的cbn结构),在rknn-toolkit2转换报错

您好,我有一个操作很简单的分类模型,它使用pytorch-qat(torch版本为1.7.1)进行训练,训练时没有fuse_bn,训练完之后的模型使用rknn-toolkit1可以正常转为rknn,但是使用rknn-toolkit2时发生了如下报错:
Screenshot from 2022-07-04 15-57-06

从报错中我无法定位问题在哪里,转换过程中使用的模型结构为
Screenshot from 2022-07-05 11-30-25

转换代码如下:
import numpy as np
import cv2
from rknn.api import RKNN
import torchvision.models as models
import torch
import os

if name == 'main':
# Create RKNN object
rknn = RKNN(verbose=True)

# pre-process config
print('--> config model')
rknn.config(mean_values=[0.485*255, 0.456*255, 0.406*255], std_values=[0.229*255, 0.224*255, 0.225*255], target_platform='rk3566')
print('done')

# Load tensorflow model
print('--> Loading model')
ret = rknn.load_pytorch(model='./100.jit.pt', input_size_list=[[1,3,256,256]])
if ret != 0:
    print('Load falldown_v4.onnx failed!')
    exit(ret)
print('done')

# Build model
print('--> Building model')
ret = rknn.build(do_quantization=False, dataset='./dataset.txt')
if ret != 0:
    print('Build falldown_v4 failed!')
    exit(ret)
print('done')

# Export rknn model
print('--> Export RKNN model')
ret = rknn.export_rknn('./falldown_v4.rknn')
if ret != 0:
    print('Export openpose.rknn failed!')
    exit(ret)
print('done')

rknn.release()

运行环境:
Ubuntu18.04,rknn-toolkit2,pytorch1.10.0,在该环境下可以正常转换example里面的resnet18-qat.pt。

error to convert onnx to rknn model (inception resnet)

Hi, could you please help me with the following error:
I'm trying to convert Inception Resnet V1 model (https://github.com/timesler/facenet-pytorch) to RKNN format following this example https://github.com/rockchip-linux/rknn-toolkit2/tree/master/examples/onnx/yolov5.
The model is already in ONNX format and when trying to load the model with the python rknn module (rknn.load_onnx) I get the following error:
E load_onnx: Catch exception when loading onnx model: /media/desarrollo10/CAROLINA/MonitoreoInteligente/rockchip/RK356x/examples/onnx/yolov5/model_us/InceptionResnetV1_v2.onnx!
E load_onnx: Traceback (most recent call last):
E load_onnx: File "rknn/api/rknn_base.py", line 1126, in rknn.api.rknn_base.RKNNBase.load_onnx
E load_onnx: File "rknn/api/rknn_base.py", line 584, in rknn.api.rknn_base.RKNNBase._create_ir_and_inputs_meta
E load_onnx: File "rknn/api/ir_graph.py", line 39, in rknn.api.ir_graph.IRGraph.init
E load_onnx: File "rknn/api/ir_graph.py", line 180, in rknn.api.ir_graph.IRGraph.rebuild
E load_onnx: File "rknn/api/ir_graph.py", line 140, in rknn.api.ir_graph.IRGraph._clean_model
E load_onnx: File "rknn/api/ir_graph.py", line 59, in rknn.api.ir_graph.IRGraph.infer_shapes
E load_onnx: File "/home/desarrollo10/Documentos/rockchip/venv/lib/python3.6/site-packages/onnx/checker.py", line 93, in check_model
E load_onnx: C.check_model(model.SerializeToString())
E load_onnx: onnx.onnx_cpp2py_export.checker.ValidationError: Field 'shape' of type is required but missing.

init_runtime with target='rk3568' failed

I got my rk3568 board connected in docker that you offered:

root@my-docker:/workspace/rknn-toolkit2/examples/tflite/mobilenet_v1# adb devices
List of devices attached
90f931708d91ca10 device
root@my-docker:/workspace/rknn-toolkit2/examples/tflite/mobilenet_v1# lsusb
Bus 002 Device 003: ID 2207:0006

But when I try to run a py script, the init_runtime with target='rk3568' returns a failed code(-9) ERROR_PIPE.
--> Init runtime environment
I NPUTransfer: Starting NPU Transfer Client, Transfer version 2.1.0 (b5861e7@2020-11-23T11:50:36)
E RKNNAPI: rknn_init, server connect fail! ret = -9(ERROR_PIPE)!
E init_runtime: Catch exception when init runtime!
E init_runtime: Traceback (most recent call last):
E init_runtime: File "rknn/api/rknn_base.py", line 2553, in rknn.api.rknn_base.RKNNBase.init_runtime
E init_runtime: File "rknn/api/rknn_runtime.py", line 367, in rknn.api.rknn_runtime.RKNNRuntime.build_graph
E init_runtime: Exception: RKNN init failed. error code: RKNN_ERR_DEVICE_UNAVAILABLE
Init runtime environment failed

The script code is rknn-toolkit2/examples/tflite/mobilenet_v1/test.py, I added only target='rk3568' in param of init_runtime.

I suppose there might be some problems with this function?

squeezenet ssd model running ok with version 1.1.2b8 but core dump with version 1.3.0

Hi

I was running rknn-toolkit 2-1.1.2b8 for a squeezenet ssd model and everything worked perfectly.

But when I upgrade to 2-1.3.0, I encounter a core dumped error when building the model as below:

ssd$ ./rk_rssd_3566.bat 
right after import torch....
W __init__: rknn-toolkit2 version: 1.3.0-11912b58
--> config model
W config: 'target_platform' is None, use rk3566 as default, Please set according to the actual platform!
done
loading:  ./models/sq-ssd-lite-Epoch-685-Loss-0.9794106185436249.pth
--> Loading model
PtParse: 100%|████████████████████████████████████████████████| 1005/1005 [00:00<00:00, 3142.74it/s]
done
--> Building model
Analysing : 100%|████████████████████████████████████████████████| 154/154 [00:00<00:00, 262.91it/s]
Quantizating 1/5: 100%|███████████████████████████████████████████| 154/154 [00:04<00:00, 37.83it/s]
Quantizating 2/5: 100%|███████████████████████████████████████████| 154/154 [00:04<00:00, 96.15it/s]
Quantizating 3/5: 100%|███████████████████████████████████████████| 154/154 [00:04<00:00, 37.12it/s]
Quantizating 4/5: 100%|███████████████████████████████████████████| 154/154 [00:04<00:00, 36.96it/s]
Quantizating 5/5: 100%|██████████████████████████████████████████| 154/154 [00:00<00:00, 275.53it/s]
W build: The default input dtype of 'input.7' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of '333' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of '343' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
./rk_rssd_3566.bat: line 1: 20947 Segmentation fault      (core dumped) python3 rk3566_rssdTest.py ./models/sq-ssd-lite-Epoch-685-Loss-0.9794106185436249.pth ./models/voc-model-labels.txt ./vdataset

RK3588 在Ubuntu下无法部署

官方开发套件Ubuntu系统只支持x86架构,我们的RK3588是arm架构的,而arm架构开发套件(lite版本)又只支持Debian。请问如何才能部署到该板子上,只能用docker么?还是必须要重新烧录为Debian?

building tensorflow model failed

Hi

I am able to load a tensorflow model (.pb file) but failed at building the model with the following error message:

rknn2$ python rk3566Test.py 
W __init__: rknn-toolkit2 version: 1.3.0-11912b58
--> config model
done
--> Loading tensorflow model
W load_tensorflow: inputs name should be a tensor name instead of node name
W:tensorflow:From /home/paul/rknn2/lib/python3.6/site-packages/rknn/api/rknn.py:108: convert_variables_to_constants (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.convert_variables_to_constants`
W:tensorflow:From /home/paul/rknn2/lib/python3.6/site-packages/tensorflow/python/framework/graph_util_impl.py:270: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.extract_sub_graph`
done
--> Building model
(op_type:ReduceSum, name:level0/shared/prop0/WarpImageWithHypotheses/warp_and_aggregate_sad/Sum): Inferred shape and existing shape differ in rank: (5) vs (0)
E build: Catch exception when building RKNN model!
E build: Traceback (most recent call last):
E build:   File "rknn/api/rknn_base.py", line 1638, in rknn.api.rknn_base.RKNNBase.build
E build:   File "rknn/api/graph_optimizer.py", line 5499, in rknn.api.graph_optimizer.GraphOptimizer.fold_constant
E build:   File "rknn/api/ir_graph.py", line 750, in rknn.api.ir_graph.IRGraph.make_model
E build:   File "rknn/api/ir_graph.py", line 62, in rknn.api.ir_graph.IRGraph.infer_shapes
E build:   File "/home/paul/rknn2/lib/python3.6/site-packages/onnx/shape_inference.py", line 35, in infer_shapes
E build:     inferred_model_str = C.infer_shapes(model_str, check_type)
E build: RuntimeError: Inferred shape and existing shape differ in rank: (5) vs (0)
Build pytorch failed!

The code I am running is as below:

import numpy as np
import cv2
from rknn.api import RKNN


tf_model = "../models/middlebury_d400.pb"

if __name__ == '__main__':
	
	# Create RKNN object
	rknn = RKNN()
	
	# pre-process config
	print('--> config model')
	rknn.config(mean_values=[[127.5,127.5,127.5,127.5,127.5,127.5]], std_values=[[127.5,127.5,127.5,127.5,127.5,127.5]],target_platform='rk3566') #rk3566: no reorder, make sure the input RGB
	
	print('done')
	
	# Load tensorflow model
	print('--> Loading tensorflow model')
	ret = rknn.load_tensorflow(tf_pb=tf_model,
						inputs=["input"],
						outputs=["reference_output_disparity"],
                                                input_size_list=[[1, 226, 500, 6]])
	if ret != 0:
		print('Load model failed!')
		exit(ret)
	print('done')

	# Build model
	print('--> Building model')
	ret = rknn.build(do_quantization=False)
	#ret = rknn.build(do_quantization=True, dataset='./dataset.txt')
	if ret != 0:
		print('Build pytorch failed!')
		exit(ret)
	print('done')

	# Export rknn model
	print('--> Export RKNN model')
	ret = rknn.export_rknn('./model_3566.rknn')
	if ret != 0:
		print('Export model_3566.rknn failed!')
		exit(ret)
	print('done')
	
	#ret = rknn.load_rknn('./model_3566.rknn')
	
	# init runtime environment
	print('--> Init runtime environment')
	#ret = rknn.init_runtime() #run simulator
	ret = rknn.init_runtime(target='rk3566') #run inference on evb board: make sure micro usb connected and run startNPU on evb board

	if ret != 0:
		print('Init runtime environment failed')
		exit(ret)
	print('done')

	print("so far so good....")
	
	# # perf
	print('--> Begin evaluate model performance')
	img=torch.Tensor(226,500,6).random_(0,255)
	perf_results = rknn.eval_perf(inputs=[img])
	print('done')
	
	rknn.release()

and you may download the middlebury_d400.pb model by

wget -P . -N https://storage.googleapis.com/tensorflow-graphics/models/hitnet/de
fault_models/middlebury_d400.pb

Could you help to suggest how to fix this error? Thanks a lot.

Rk3588s,rknn_run报错

在板子上跑demo改的自己的模型,跑几次之后,跑到rknn_run就报错,faild to submit!
这个时候跑官方的demo也一样报错

rknn.build failure at Global Average Pool input height/width > 128

I am running rknn toolkit for building a model.rknn for running on RK3566.
After rknn.load_onnx() successfully, when run rknn.build(), the following error message occur:

--> Loading model: ./rknn_models/model_3566.onnx done
--> Building model E build: Global Average Pool input height/width > 128, which is not suppoted! E build: Catch exception when building RKNN model! E build: Traceback (most recent call last): E build:   File "rknn/api/rknn_base.py", line 2621, in rknn.api.rknn_base.RKNNBase.build E build:   File "rknn/api/graph_optimizer.py", line 3765, in rknn.api.graph_optimizer.GraphOptimizer.run E build:   File "rknn/api/graph_optimizer.py", line 3518, in rknn.api.graph_optimizer.GraphOptimizer._fuse_ops E build:   File "rknn/api/graph_optimizer.py", line 2210, in rknn.api.graph_optimizer._p_convert_global_avgpool_to_conv E build:   File "rknn/api/rknn_log.py", line 104, in rknn.api.rknn_log.RKNNLog.e E build: ValueError: Global Average Pool input height/width > 128, which is not suppoted! Build pytorch failed!

I checked my source code, I did not use the Global Average Pool anywhere. And actually I did explicitly remove final two layers of basenet (efficientnet) which contains global_pool by assigning them as Identity as below:

   basemodel_name = 'tf_efficientnet_b5_ap'
    print('Loading base model ()...'.format(basemodel_name), end='')
    basemodel = torch.hub.load('rwightman/gen-efficientnet-pytorch', basemodel_name, pretrained=True)
    print('Done.')

    # Remove last layer
    print('Removing last two layers (global_pool & classifier).')
    basemodel.global_pool = nn.Identity()
    basemodel.classifier = nn.Identity()

So it puzzled me why the rknn.build() would complain about the Global Average Pool at all.

Could anyone help to point me to the potential causes and possible fixes?

Thanks a lot for your help in advance.

docker 在哪里下载

百度云下载链接点击失败了,repo 里也没有 docker 文件夹
从哪里能下载 docker

1.2.0版本 onnx转rknn问题

onnx opset版本必须要是1.2.0吗?我在1.1.0版本上,onnx转rknn模型并测试结果正常。在1.2.0版本上,onnx转rknn模型并测试结果不正常。

debian

debian系统可以跑吗

Could not find a version that satisfies the requirement onnxruntime==1.6.0

Error while installing rknn-toolkit2 on ubuntu 18.04 with python3.6

pip3 install rknn_toolkit2-1.1.1_5c458c6-cp36-cp36m-linux_x86_64.whl

This is the error we are getting

Collecting onnxruntime==1.6.0 (from rknn-toolkit2==1.1.1-5c458c6)
  Could not find a version that satisfies the requirement onnxruntime==1.6.0 (from rknn-toolkit2==1.1.1-5c458c6) (from versions: 0.1.2, 0.1.3, 0.1.4, 0.2.1, 0.3.0, 0.4.0, 1.0.0, 1.1.0, 1.1.1, 1.1.2, 1.2.0, 1.3.0)
No matching distribution found for onnxruntime==1.6.0 (from rknn-toolkit2==1.1.1-5c458c6)
  • not able to understand what exactly the problem is because all system specs are correct i.e.
    • ubuntu 18.04
    • python 3.6

Can you please help to understand the problem ?

推理时报错:failed to submit!

I RKNN: [00:45:04.438] RKNN Runtime Information: librknnrt version: 1.2.0 (9db21b35d@2022-01-14T15:16:23)
I RKNN: [00:45:04.450] RKNN Model Information: version: 1, toolkit version: 1.2.0(compiler version: 1.2.0 (b162fe95e@2022-01-14T14:12:38)), target: RKNPU lite, target platform: rk3568, framework name: ONNX, framework layout: NCHW
E RKNN: [00:47:08.943] failed to submit!, op id: 20, op name: Clip:Clip_383, flags: 0x5, task start: 66, task number: 4095, run task counter: 7, int status: 0

Rk3568 rknn-toolkit2-v1.3.0: capi results is error, but python results is the same as original results.

I have over 7 algorithm models deployed to the RK3568 platform, but only one's result is error.
I compare the original model inference output and find capi inference output is very different, but python result is basically the same as original model inference output.
why?
I have compare many layers outputs and find the results of the first convolution is different, I suspect there may be discrepancies in the input data, but sure that the mean variance is correct.
How to solve this problem?

运行examples/onnx/yolov5的demo时出现的错误

`
E build: Catch exception when building RKNN model!
E build: Traceback (most recent call last):
E build: File "rknn/api/rknn_base.py", line 1590, in rknn.api.rknn_base.RKNNBase.build
E build: File "rknn/api/rknn_base.py", line 344, in rknn.api.rknn_base.RKNNBase._generate_rknn
E build: File "rknn/api/rknn_base.py", line 276, in rknn.api.rknn_base.RKNNBase._export_rknn
E build: ImportError: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory
Build model failed!

`

我在尝试跟着教程使用这个demo进行模型转换时出现以上报错,libpython3.6m.so.1.0文件在/usr/local/lib文件中。好像是引用不到该文件,这个该如何解决?

docker

where is the folder named docker?

ONNX Build model failed! IndexError: vector::_M_range_check: __n (which is 4) >= this->size() (which is 4)

python test.py
W init: rknn-toolkit2 version: 1.3.4b4-ad9ac429
--> Config model
done
--> Loading model
done
--> Building model
I base_optimize ...
I base_optimize done.
I
I fold_constant ...
W build: output: The output shape [1, 0, 6] of model is wrong, fix it to [1, 2160, 6]!
I fold_constant done.
I fold_constant remove nodes = ['ConstantOfShape_17', 'Concat_18', 'Reshape_20', 'Slice_25', 'Transpose_26', 'Reshape_28', 'Cast_29', 'Shape_40', 'Gather_42', 'Shape_43', 'Gather_45', 'Unsqueeze_46', 'Unsqueeze_47', 'Unsqueeze_48', 'Concat_49', 'Cast_61', 'Div_62', 'Cast_63', 'Range_66', 'Unsqueeze_67', 'Concat_68', 'Unsqueeze_69', 'Concat_70', 'Shape_71', 'ConstantOfShape_72', 'Expand_73', 'Tile_74', 'Unsqueeze_75', 'Unsqueeze_76', 'Concat_77', 'Reshape_78', 'Cast_79', 'Cast_80', 'Range_83', 'Unsqueeze_84', 'Concat_85', 'Unsqueeze_86', 'Concat_87', 'Shape_88', 'ConstantOfShape_89', 'Expand_90', 'Tile_91', 'Transpose_92', 'Unsqueeze_93', 'Unsqueeze_94', 'Concat_95', 'Reshape_96', 'Cast_97', 'Add_100', 'Expand_101', 'ConstantOfShape_107', 'Mul_109', 'Equal_110', 'Where_111', 'Expand_112', 'Unsqueeze_113', 'ConstantOfShape_114', 'Mul_116', 'Equal_117', 'Where_118', 'Expand_119', 'Unsqueeze_120', 'ConstantOfShape_121', 'Mul_123', 'Equal_124', 'Where_125', 'Expand_126', 'Unsqueeze_127', 'ConstantOfShape_128', 'Mul_130', 'Equal_131', 'Where_132', 'Expand_133', 'Unsqueeze_134', 'ConstantOfShape_135', 'Mul_137', 'Equal_138', 'Where_139', 'Expand_140', 'Unsqueeze_141', 'Concat_142', 'Reshape_143', 'ScatterND_144', 'Add_146', 'Gather_148', 'Shape_149', 'Expand_150', 'ConstantOfShape_156', 'Mul_158', 'Equal_159', 'Where_160', 'Expand_161', 'Unsqueeze_162', 'ConstantOfShape_163', 'Mul_165', 'Equal_166', 'Where_167', 'Expand_168', 'Unsqueeze_169', 'ConstantOfShape_170', 'Mul_172', 'Equal_173', 'Where_174', 'Expand_175', 'Unsqueeze_176', 'ConstantOfShape_177', 'Mul_179', 'Equal_180', 'Where_181', 'Expand_182', 'Unsqueeze_183', 'ConstantOfShape_184', 'Mul_186', 'Equal_187', 'Where_188', 'Expand_189', 'Unsqueeze_190', 'Concat_191', 'Shape_192', 'Slice_196', 'Concat_197', 'Reshape_198', 'ScatterND_199', 'Gather_201', 'Shape_203', 'Expand_204', 'ConstantOfShape_210', 'Mul_212', 'Equal_213', 'Where_214', 'Expand_215', 'Unsqueeze_216', 'ConstantOfShape_217', 'Mul_219', 'Equal_220', 'Where_221', 'Expand_222', 'Unsqueeze_223', 'ConstantOfShape_224', 'Mul_226', 'Equal_227', 'Where_228', 'Expand_229', 'Unsqueeze_230', 'ConstantOfShape_231', 'Mul_233', 'Equal_234', 'Where_235', 'Expand_236', 'Unsqueeze_237', 'ConstantOfShape_238', 'Mul_240', 'Equal_241', 'Where_242', 'Expand_243', 'Unsqueeze_244', 'Concat_245', 'Shape_246', 'Slice_250', 'Concat_251', 'Reshape_252', 'ScatterND_253', 'Gather_255', 'Shape_257', 'Expand_258', 'ConstantOfShape_264', 'Mul_266', 'Equal_267', 'Where_268', 'Expand_269', 'Unsqueeze_270', 'ConstantOfShape_271', 'Mul_273', 'Equal_274', 'Where_275', 'Expand_276', 'Unsqueeze_277', 'ConstantOfShape_278', 'Mul_280', 'Equal_281', 'Where_282', 'Expand_283', 'Unsqueeze_284', 'ConstantOfShape_285', 'Mul_287', 'Equal_288', 'Where_289', 'Expand_290', 'Unsqueeze_291', 'ConstantOfShape_292', 'Mul_294', 'Equal_295', 'Where_296', 'Expand_297', 'Unsqueeze_298', 'Concat_299', 'Shape_300', 'Slice_304', 'Concat_305', 'Reshape_306', 'ScatterND_307', 'Unsqueeze_308', 'Concat_309', 'Reshape_310', 'Mul_311', 'Unsqueeze_312', 'Concat_313', 'Unsqueeze_315', 'Concat_316', 'ConstantOfShape_340', 'Expand_341', 'Tile_342', 'Reshape_343', 'Cast_344', 'ConstantOfShape_346', 'Expand_347', 'Tile_348', 'Transpose_349', 'Reshape_350', 'Cast_351', 'Add_354', 'Expand_355', 'ConstantOfShape_361', 'Mul_363', 'Equal_364', 'Where_365', 'Expand_366', 'Unsqueeze_367', 'ConstantOfShape_368', 'Mul_370', 'Equal_371', 'Where_372', 'Expand_373', 'Unsqueeze_374', 'ConstantOfShape_375', 'Mul_377', 'Equal_378', 'Where_379', 'Expand_380', 'Unsqueeze_381', 'ConstantOfShape_382', 'Mul_384', 'Equal_385', 'Where_386', 'Expand_387', 'Unsqueeze_388', 'ConstantOfShape_389', 'Mul_391', 'Equal_392', 'Where_393', 'Expand_394', 'Unsqueeze_395', 'Concat_396', 'Reshape_397', 'ScatterND_398', 'Add_400', 'Gather_402', 'Shape_403', 'Expand_404', 'ConstantOfShape_410', 'Mul_412', 'Equal_413', 'Where_414', 'Expand_415', 'Unsqueeze_416', 'ConstantOfShape_417', 'Mul_419', 'Equal_420', 'Where_421', 'Expand_422', 'Unsqueeze_423', 'ConstantOfShape_424', 'Mul_426', 'Equal_427', 'Where_428', 'Expand_429', 'Unsqueeze_430', 'ConstantOfShape_431', 'Mul_433', 'Equal_434', 'Where_435', 'Expand_436', 'Unsqueeze_437', 'ConstantOfShape_438', 'Mul_440', 'Equal_441', 'Where_442', 'Expand_443', 'Unsqueeze_444', 'Concat_445', 'Shape_446', 'Slice_450', 'Concat_451', 'Reshape_452', 'ScatterND_453', 'Gather_455', 'Shape_457', 'Expand_458', 'ConstantOfShape_464', 'Mul_466', 'Equal_467', 'Where_468', 'Expand_469', 'Unsqueeze_470', 'ConstantOfShape_471', 'Mul_473', 'Equal_474', 'Where_475', 'Expand_476', 'Unsqueeze_477', 'ConstantOfShape_478', 'Mul_480', 'Equal_481', 'Where_482', 'Expand_483', 'Unsqueeze_484', 'ConstantOfShape_485', 'Mul_487', 'Equal_488', 'Where_489', 'Expand_490', 'Unsqueeze_491', 'ConstantOfShape_492', 'Mul_494', 'Equal_495', 'Where_496', 'Expand_497', 'Unsqueeze_498', 'Concat_499', 'Shape_500', 'Slice_504', 'Concat_505', 'Reshape_506', 'ScatterND_507', 'Gather_509', 'Shape_511', 'Expand_512', 'ConstantOfShape_518', 'Mul_520', 'Equal_521', 'Where_522', 'Expand_523', 'Unsqueeze_524', 'ConstantOfShape_525', 'Mul_527', 'Equal_528', 'Where_529', 'Expand_530', 'Unsqueeze_531', 'ConstantOfShape_532', 'Mul_534', 'Equal_535', 'Where_536', 'Expand_537', 'Unsqueeze_538', 'ConstantOfShape_539', 'Mul_541', 'Equal_542', 'Where_543', 'Expand_544', 'Unsqueeze_545', 'ConstantOfShape_546', 'Mul_548', 'Equal_549', 'Where_550', 'Expand_551', 'Unsqueeze_552', 'Concat_553', 'Shape_554', 'Slice_558', 'Concat_559', 'Reshape_560', 'ScatterND_561', 'Reshape_562', 'Mul_564']
I
I correct_ops ...
I correct_ops done.
I
I fuse_ops ...
I fuse_ops results:
I fuse_pad_into_maxpool: remove node = ['Pad_31']
I expand_to_4d_concat: remove node = [], add node = ['Concat_318_1_expand0', 'Concat_318_2_expand0', 'Concat_318_0_expand1']
I expand_to_4d_concat: remove node = [], add node = ['Concat_568_0_expand0', 'Concat_568_1_expand0', 'Concat_568_0_expand1']
I remove_invalid_cast: remove node = ['Cast_569']
I fuse_two_reshape: remove node = ['Reshape_314', 'Reshape_317', 'Concat_318_0_expand1']
I remove_invalid_reshape: remove node = ['Concat_568_0_expand0']
I convert_resize_to_deconv: remove node = ['Resize_323'], add node = ['Resize_323_2deconv']
I expand_to_4d_concat: remove node = [], add node = ['Concat_567_1_expand0', 'Concat_567_2_expand0', 'Concat_567_0_expand1']
I fuse_two_reshape: remove node = ['Reshape_565', 'Reshape_566', 'Concat_567_0_expand1']
I remove_invalid_reshape: remove node = ['Concat_568_1_expand0']
I fold_constant ...
I fold_constant done.
I
I fuse_ops done.
I
I sparse_weight ...
I sparse_weight done.
I
Analysing : 100%|██████████████████████████████████████████████████| 53/53 [00:00<00:00, 676.21it/s]
Quantizating : 100%|███████████████████████████████████████████████| 53/53 [00:00<00:00, 111.74it/s]
I
I quant_optimizer ...
I quant_optimizer results:
I adjust_no_change_node: ['Slice_337', 'Gather_331', 'Slice_59', 'Gather_53', 'MaxPool_32', 'MaxPool_14', 'MaxPool_11', 'MaxPool_8', 'MaxPool_5', 'MaxPool_2']
I adjust_tanh_sigmoid: ['Sigmoid_332', 'Sigmoid_54']
I quant_optimizer done.
I
W build: The default input dtype of 'input' is changed from 'float32' to 'int8' in rknn model for performance!
Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of 'output' is changed from 'float32' to 'int8' in rknn model for performance!
Please take care of this change when deploy rknn model with Runtime API!
I rknn building ...
I RKNN: [17:13:00.089] compress = 0
I RKNN: librknnc version: 1.3.4b4 (96dd06845@2022-06-30T13:10:54)
D RKNN: [17:13:00.128] RKNN is invoked
D RKNN: [17:13:00.248] >>>>>> start: N4rknn16RKNNAddFirstConvE
D RKNN: [17:13:00.248] <<<<<<<< end: N4rknn16RKNNAddFirstConvE
D RKNN: [17:13:00.248] >>>>>> start: N4rknn22RKNNAddReshapeAfterRNNE
D RKNN: [17:13:00.248] <<<<<<<< end: N4rknn22RKNNAddReshapeAfterRNNE
D RKNN: [17:13:00.249] >>>>>> start: N4rknn17RKNNTileGroupConvE
D RKNN: [17:13:00.249] <<<<<<<< end: N4rknn17RKNNTileGroupConvE
D RKNN: [17:13:00.249] >>>>>> start: N4rknn19RKNNTileFcBatchFuseE
D RKNN: [17:13:00.249] <<<<<<<< end: N4rknn19RKNNTileFcBatchFuseE
D RKNN: [17:13:00.249] >>>>>> start: N4rknn15RKNNAddConvBiasE
D RKNN: [17:13:00.249] <<<<<<<< end: N4rknn15RKNNAddConvBiasE
D RKNN: [17:13:00.249] >>>>>> start: N4rknn15RKNNTileChannelE
D RKNN: [17:13:00.249] <<<<<<<< end: N4rknn15RKNNTileChannelE
D RKNN: [17:13:00.249] >>>>>> start: N4rknn18RKNNPerChannelPrepE
D RKNN: [17:13:00.249] <<<<<<<< end: N4rknn18RKNNPerChannelPrepE
D RKNN: [17:13:00.249] >>>>>> start: N4rknn21RKNNFuseOptimizerPassE
D RKNN: [17:13:00.249] <<<<<<<< end: N4rknn21RKNNFuseOptimizerPassE
D RKNN: [17:13:00.249] >>>>>> start: N4rknn11RKNNBnQuantE
D RKNN: [17:13:00.249] <<<<<<<< end: N4rknn11RKNNBnQuantE
D RKNN: [17:13:00.249] >>>>>> start: N4rknn15RKNNTurnAutoPadE
D RKNN: [17:13:00.249] <<<<<<<< end: N4rknn15RKNNTurnAutoPadE
D RKNN: [17:13:00.249] >>>>>> start: N4rknn16RKNNInitRNNConstE
D RKNN: [17:13:00.249] <<<<<<<< end: N4rknn16RKNNInitRNNConstE
D RKNN: [17:13:00.249] >>>>>> start: N4rknn17RKNNInitCastConstE
D RKNN: [17:13:00.249] <<<<<<<< end: N4rknn17RKNNInitCastConstE
D RKNN: [17:13:00.249] >>>>>> start: N4rknn20RKNNMultiSurfacePassE
D RKNN: [17:13:00.249] <<<<<<<< end: N4rknn20RKNNMultiSurfacePassE
D RKNN: [17:13:00.249] >>>>>> start: N4rknn14RKNNTilingPassE
D RKNN: [17:13:00.250] <<<<<<<< end: N4rknn14RKNNTilingPassE
D RKNN: [17:13:00.250] >>>>>> start: N4rknn23RKNNProfileAnalysisPassE
D RKNN: [17:13:00.250] <<<<<<<< end: N4rknn23RKNNProfileAnalysisPassE
D RKNN: [17:13:00.250] >>>>>> start: OpEmit
D RKNN: [17:13:00.253] 0 - 11 0 - 11 0 - 255 0
D RKNN: [17:13:00.253] 0 - 5 0 - 11 0 - 255 0
D RKNN: [17:13:00.253] 6 - 11 0 - 11 0 - 255 1
D RKNN: [17:13:00.253] 0 - 3 0 - 11 0 - 255 0
D RKNN: [17:13:00.254] 4 - 7 0 - 11 0 - 255 1
D RKNN: [17:13:00.254] 8 - 11 0 - 11 0 - 255 2
E build: Catch exception when building RKNN model!
E build: Traceback (most recent call last):
E build: File "rknn/api/rknn_base.py", line 1533, in rknn.api.rknn_base.RKNNBase.build
E build: File "rknn/api/rknn_base.py", line 299, in rknn.api.rknn_base.RKNNBase._generate_rknn
E build: File "rknn/api/rknn_base.py", line 268, in rknn.api.rknn_base.RKNNBase._build_rknn
E build: IndexError: vector::_M_range_check: __n (which is 4) >= this->size() (which is 4)
Build model failed!

建议开源或者开放底层接口

不可否认,现在rknn-toolkit2以及rknpu2组合,有很多问题,大多是在目标板子上运行时,出来结果和PC上不一致(有时甚至在同一个板子多次运行间不一致)。

希望可以提供必要的开源或者底层接口,这样可以调试bug,或者自己实现Op。

谢谢

E load_onnx: Invalid input_shape = [0, 300, 300, 3] for input 0! How to fix it?

W init: rknn-toolkit2 version: 1.3.0-11912b58
W config: 'target_platform' is None, use rk3566 as default, Please set according to the actual platform!
--> Loading model
W load_onnx: Model converted from tf2onnx, it is recommended to use load_tensorflow / load_tflite to convert tensorflow / tflite model to rknn for successful convert!
E load_onnx: Invalid input_shape = [0, 300, 300, 3] for input 0!
W load_onnx: ===================== WARN(3) =====================
E rknn-toolkit2 version: 1.3.0-11912b58
E load_onnx: Catch exception when loading onnx model: /rknn/243.onnx!
E load_onnx: Traceback (most recent call last):
E load_onnx: File "rknn/api/rknn_base.py", line 1182, in rknn.api.rknn_base.RKNNBase.load_onnx
E load_onnx: File "rknn/api/rknn_base.py", line 646, in rknn.api.rknn_base.RKNNBase._create_ir_and_inputs_meta
E load_onnx: File "rknn/api/rknn_log.py", line 113, in rknn.api.rknn_log.RKNNLog.e
E load_onnx: ValueError: Invalid input_shape = [0, 300, 300, 3] for input 0!
done
--> Building model
E build: Catch exception when building RKNN model!
E build: Traceback (most recent call last):
E build: File "rknn/api/rknn_base.py", line 1638, in rknn.api.rknn_base.RKNNBase.build
E build: File "rknn/api/graph_optimizer.py", line 5523, in rknn.api.graph_optimizer.GraphOptimizer.fold_constant
E build: KeyError: 'input_1'
done
E export_rknn: RKNN model is None, please load & build model first!

Invalid RKNN format. rknn_query, load_model failed #7

We tried to inference ssd_mobilenet _v1 model with C++ inference on Rk3566 board. But got this error

Loading model ...
rknn_init ...
I RKNN: set log level to 0
E RKNN: Invalid RKNN format
E RKNN: rknn_query, load_model failed
rknn_init fail! ret=-1

Tried to search the error code it said its Model Execution error, but not able to understand why its not working, because same model worked with python inference on ubuntu 16.04.

Tensorflow Object Detection

Hi team, I’ve recently bought an Asus Tinker Edge R to reply machine learning model. After few research and reading and I didn’t find much documentation on how to run object detection model on Tinker Edge R with an external camera. I’ve tried to rknn-toolkit too. I also want to use the NPU & GPU capabilities of the Tinker Edge R to experiment and see if it’s possible to use this device for my ML deployment or not.
I’ve tested tflite on thinker Edge R I achieved like 3FPS which is not possible to use or deploy any model with this FPS. Could please share some documentations on how to run object detection model where the input would come live feed frame with Tinker Edge R.
I am also lost while trying to convert the model into rknn.

Is it possible to use external camera to make inference on Tinker Edge R? Thank You

rk3568用mmse量化模型时出现“UnboundLocalError”

Error信息如下:
--> Loading model
--> Building model
Analysing : 100%|███████████████████████████████████████████████| 139/139 [00:00<00:00, 2145.13it/s]
Quantizating : 100%|██████████████████████████████████████████████| 139/139 [04:29<00:00, 1.94s/it]
Exception in thread Thread-3:
Traceback (most recent call last):
File "/home/jinjicheng/anaconda3/envs/rknn/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/home/jinjicheng/anaconda3/envs/rknn/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "rknn/api/mmse_quant.py", line 368, in rknn.api.mmse_quant.MmseQaunt._run
File "rknn/api/rknn_base.py", line 554, in rknn.api.rknn_base.IRGraph.expand_batch
UnboundLocalError: local variable 'shape' referenced before assignment

我的模型输入为单通道图片,采用normal方式可正常量化,精度有下降;采用mmse方式量化时,出现上述Error,虽然最后有量化模型生成,但没有mmse的6个量化step出现,这个量化模型的精度比normal方式的要低,应该是没有量化成功。不清楚是不是单通道输入的原因?

Unsupported ops: Counter({'Conv3DBackpropInputV2': 6})

Hi,

I am loading and building a tensorflow model middlebury_d400.pb and encounter the following error message:

--> config model
done
--> Loading tensorflow model
W:tensorflow:From /home/paul/rknn2/lib/python3.6/site-packages/tensorflow/python/tools/strip_unused_lib.py:86: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.extract_sub_graph`
W:tensorflow:From /home/paul/rknn2/lib/python3.6/site-packages/tensorflow/python/tools/optimize_for_inference_lib.py:113: remove_training_nodes (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.remove_training_nodes`
2022-06-21 17:19:14,267 - E - Tensorflow op [level0/shared/prop0/WarpImageWithHypotheses/get_warp1d_coordinates_from_tile_hypotheses/get_warp_disparity: Conv3DBackpropInputV2] is not supported
2022-06-21 17:19:15,132 - E - Tensorflow op [level1/shared/prop0/WarpImageWithHypotheses/get_warp1d_coordinates_from_tile_hypotheses/get_warp_disparity: Conv3DBackpropInputV2] is not supported
2022-06-21 17:19:16,050 - E - Tensorflow op [level2/shared/prop0/WarpImageWithHypotheses/get_warp1d_coordinates_from_tile_hypotheses/get_warp_disparity: Conv3DBackpropInputV2] is not supported
2022-06-21 17:19:17,376 - E - Tensorflow op [level3/shared/prop0/WarpImageWithHypotheses/get_warp1d_coordinates_from_tile_hypotheses/get_warp_disparity: Conv3DBackpropInputV2] is not supported
2022-06-21 17:19:18,631 - E - Tensorflow op [level4/shared/prop0/WarpImageWithHypotheses/get_warp1d_coordinates_from_tile_hypotheses/get_warp_disparity: Conv3DBackpropInputV2] is not supported
2022-06-21 17:19:19,802 - E - Tensorflow op [level5/shared/prop0/WarpImageWithHypotheses/get_warp1d_coordinates_from_tile_hypotheses/get_warp_disparity: Conv3DBackpropInputV2] is not supported
2022-06-21 17:19:25,047 - E - Unsupported ops: Counter({'Conv3DBackpropInputV2': 6})
done
--> Building model
E build: Catch exception when building RKNN model!
E build: Traceback (most recent call last):
E build:   File "rknn/api/rknn_base.py", line 2621, in rknn.api.rknn_base.RKNNBase.build
E build:   File "rknn/api/graph_optimizer.py", line 3756, in rknn.api.graph_optimizer.GraphOptimizer.run
E build:   File "rknn/api/graph_optimizer.py", line 2877, in rknn.api.graph_optimizer.GraphOptimizer._base_optimize
E build:   File "/home/paul/rknn2/lib/python3.6/site-packages/onnx/checker.py", line 93, in check_model
E build:     C.check_model(model.SerializeToString())
E build: onnx.onnx_cpp2py_export.checker.ValidationError: No Op registered for Conv3DBackpropInputV2 with domain_version of 12
E build: ==> Context: Bad node spec: input: "level0/shared/prop0/WarpImageWithHypotheses/get_warp1d_coordinates_from_tile_hypotheses/get_warp_disparity/input_sizes_Concat__441:0" input: "level4/shared/prop0/WarpImageWithHypotheses/get_warp1d_coordinates_from_tile_hypotheses/stack/_9__cf__9:0" input: "level0/shared/prop0/WarpImageWithHypotheses/strided_slice_3:0" output: "level0/shared/prop0/WarpImageWithHypotheses/get_warp1d_coordinates_from_tile_hypotheses/get_warp_disparity:0" name: "level0/shared/prop0/WarpImageWithHypotheses/get_warp1d_coordinates_from_tile_hypotheses/get_warp_disparity" op_type: "Conv3DBackpropInputV2" attribute { name: "data_format" s: "NDHWC" type: STRING } attribute { name: "dilations" ints: 1 ints: 1 ints: 1 ints: 1 ints: 1 type: INTS } attribute { name: "padding" s: "SAME" type: STRING } attribute { name: "strides" ints: 1 ints: 4 ints: 4 ints: 1 ints: 1 type: INTS }
Build model failed!

My python script of building this model as below:

import numpy as np
import cv2
from rknn.api import RKNN


tf_model = "../models/middlebury_d400.pb"

if __name__ == '__main__':
	
	# Create RKNN object
	rknn = RKNN()
	
	# pre-process config
	print('--> config model')
	rknn.config(mean_values=[[127.5,127.5,127.5,127.5,127.5,127.5]], std_values=[[127.5,127.5,127.5,127.5,127.5,127.5]],target_platform='rk3566') #rk3566: no reorder, make sure the input RGB
	
	print('done')
	
	# Load tensorflow model
	print('--> Loading tensorflow model')
	ret = rknn.load_tensorflow(tf_pb=tf_model,
							inputs=["input"],
							outputs=["reference_output_disparity"],
                            input_size_list=[[1, 226, 500, 6]])
	if ret != 0:
		print('Load model failed!')
		exit(ret)
	print('done')

	# Build model
	print('--> Building model')
	ret = rknn.build(do_quantization=False)
	#ret = rknn.build(do_quantization=True, dataset='./dataset.txt')
	if ret != 0:
		print('Build model failed!')
		exit(ret)
	print('done')

	# Export rknn model
	print('--> Export RKNN model')
	ret = rknn.export_rknn('./model_3566.rknn')
	if ret != 0:
		print('Export model_3566.rknn failed!')
		exit(ret)
	print('done')
	
	#ret = rknn.load_rknn('./model_3566.rknn')
	
	# init runtime environment
	print('--> Init runtime environment')
	#ret = rknn.init_runtime() #run simulator
	ret = rknn.init_runtime(target='rk3566') #run inference on evb board: make sure micro usb connected and run startNPU on evb board

	if ret != 0:
		print('Init runtime environment failed')
		exit(ret)
	print('done')
	
	print("so far so good....")
	
	
	# # perf
	print('--> Begin evaluate model performance')
	img=torch.Tensor(226,500,6).random_(0,255)
	perf_results = rknn.eval_perf(inputs=[img])
	print('done')
	
	rknn.release()

You may download the tensorflow model middlebury_d400.pb by wget command as below:

wget -P . -N https://storage.googleapis.com/tensorflow-graphics/models/hitnet/de
fault_models/middlebury_d400.pb

Could you help to provide information on how to fix this error? Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.