Skip to content

deploy RK3588 rknn model in runtime but get infer result as all zero #1646

@ken4647

Description

@ken4647

.rknn model is transform from rknn2 and it can run correctly in rktoolkit2 in PC.
However, it got wrong when using 'runtime' to infer and got all zero result, while the shape of result is correct. The input has already checked.(there is no example in runtime usage, while my model is not used as any way in 'vision' example).
image
The code is below:

import fastdeploy as fd
from fastdeploy import ModelFormat
import numpy as np
import cv2

camera = cv2.VideoCapture(2)
option = fd.RuntimeOption()

option.set_model_path("mymodel.rknn", model_format=ModelFormat.RKNN)

option.use_cpu()
option.use_rknpu2(rknpu2_name=fd.c_lib_wrap.CpuName.RK3588,rknpu2_core=fd.c_lib_wrap.CoreMask.RKNN_NPU_CORE_AUTO)

runtime = fd.Runtime(option)

input_name = runtime.get_input_info(0).name

while True:
    ret,frame = camera.read()
    cv2.imshow("test",frame)
    cv2.waitKey(1)
    rgb_array = cv2.resize(frame,(320,176))
    hsv_array = cv2.cvtColor(rgb_array,cv2.COLOR_BGR2HSV).reshape((1,176,320,3))
    # print(hsv_array)
    results = runtime.infer({
        input_name: hsv_array
    })
    input_check = hsv_array
    output_check = runtime.num_outputs()
    print(input_check)
    print(output_check)
    print(results)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions