update rknn

This commit is contained in:
MarcA711 2024-05-17 15:32:19 +00:00
parent f4b41c592a
commit f41b23d9a6
3 changed files with 6 additions and 8 deletions

View File

@ -18,8 +18,7 @@ RUN --mount=type=bind,from=rk-wheels,source=/rk-wheels,target=/deps/rk-wheels \
WORKDIR /opt/frigate/
COPY --from=rootfs / /
ADD https://github.com/MarcA711/rknpu2/releases/download/v1.5.2/librknnrt_rk356x.so /usr/lib/
ADD https://github.com/MarcA711/rknpu2/releases/download/v1.5.2/librknnrt_rk3588.so /usr/lib/
ADD https://github.com/MarcA711/rknn-toolkit2/releases/download/v2.0.0/librknnrt.so /usr/lib/
# TODO removed models, other models support may need to be added back in

View File

@ -1,2 +1 @@
hide-warnings == 0.17
rknn-toolkit-lite2 @ https://github.com/MarcA711/rknn-toolkit2/releases/download/v1.5.2/rknn_toolkit_lite2-1.5.2-cp39-cp39-linux_aarch64.whl
rknn-toolkit-lite2 @ https://github.com/MarcA711/rknn-toolkit2/releases/download/v2.0.0/rknn_toolkit_lite2-2.0.0b0-cp39-cp39-linux_aarch64.whl

View File

@ -32,6 +32,7 @@ class Rknn(DetectionApi):
type_key = DETECTOR_KEY
def __init__(self, config: RknnDetectorConfig):
super().__init__(config)
self.height = config.model.height
self.width = config.model.width
core_mask = 2**config.num_cores - 1
@ -108,6 +109,8 @@ class Rknn(DetectionApi):
f"Model {model_path} is unsupported. Provide your own model or choose one of the following: {supported_models_str}"
)
return model_props
def download_model(self, filename):
if not os.path.isdir(model_chache_dir):
os.mkdir(model_chache_dir)
@ -133,13 +136,10 @@ class Rknn(DetectionApi):
'Make sure to set the model input_tensor to "nhwc" in your config.yml.'
)
def post_process(self, output):
pass
def detect_raw(self, tensor_input):
output = self.rknn.inference(
[
tensor_input,
]
)
return self.postprocess(output[0])
return self.post_process(output)