Formatting

This commit is contained in:
Nicolas Mowen 2025-08-20 17:09:59 -06:00
parent e294246afe
commit ba77f066a0
3 changed files with 15 additions and 10 deletions

View File

@ -9,7 +9,7 @@ build-rk: version
docker buildx bake --file=docker/rockchip/rk.hcl rk \
--set rk.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rk
push-rk: build-rk
push-rk: version
docker buildx bake --file=docker/rockchip/rk.hcl rk \
--set rk.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rk \
--set rk.tags=crzynik/frigate:rk \
--push

View File

@ -229,16 +229,18 @@ class RKNNModelRunner:
batch_size = 1
if inputs:
for val in inputs.values():
if hasattr(val, 'shape') and len(val.shape) > 0:
if hasattr(val, "shape") and len(val.shape) > 0:
batch_size = val.shape[0]
break
# Create default in NHWC format as expected by RKNN
rknn_inputs.append(np.zeros((batch_size, 224, 224, 3), dtype=np.float32))
rknn_inputs.append(
np.zeros((batch_size, 224, 224, 3), dtype=np.float32)
)
else:
batch_size = 1
if inputs:
for val in inputs.values():
if hasattr(val, 'shape') and len(val.shape) > 0:
if hasattr(val, "shape") and len(val.shape) > 0:
batch_size = val.shape[0]
break
rknn_inputs.append(np.zeros((batch_size, 1), dtype=np.float32))

View File

@ -38,6 +38,7 @@ MODEL_TYPE_CONFIGS = {
},
}
def get_rknn_model_type(model_path: str) -> str | None:
if all(keyword in model_path for keyword in ["jina-clip-v1", "vision"]):
return "jina-clip-v1-vision"
@ -49,6 +50,7 @@ def get_rknn_model_type(model_path: str) -> str | None:
return None
def is_rknn_compatible(model_path: str, model_type: str | None = None) -> bool:
"""
Check if a model is compatible with RKNN conversion.
@ -111,6 +113,7 @@ def ensure_rknn_toolkit() -> bool:
"""Ensure RKNN toolkit is available."""
try:
from rknn.api import RKNN # type: ignore # noqa: F401
logger.debug("RKNN toolkit is already available")
return True
except ImportError as e: