remove purge_model_cache option

This commit is contained in:
MarcA711 2024-05-14 17:18:49 +00:00
parent 804afe3980
commit 4a28a3179a
2 changed files with 2 additions and 22 deletions

View File

@ -357,9 +357,6 @@ detectors: # required
# 0 means choose automatically # 0 means choose automatically
# increase for better performance if you have a multicore NPU e.g. set to 3 on rk3588 # increase for better performance if you have a multicore NPU e.g. set to 3 on rk3588
num_cores: 0 num_cores: 0
# delete old models from config/model_cache/rknn_cache/ folder
# set to false to skip, but keep in mind to manually remove unused models
purge_model_cache: true
model: # required model: # required
# name of model (will be automatically downloaded) or path to your own .rknn model file # name of model (will be automatically downloaded) or path to your own .rknn model file
@ -397,5 +394,5 @@ $ cat /sys/kernel/debug/rknpu/load
::: :::
- By default the rknn detector uses the yolonas_s model (`model: path: default-fp16-yolonas_s`). This model comes with the image, so no further steps than those mentioned above are necessary and no download happens. - By default the rknn detector uses the yolonas_s model (`model: path: default-fp16-yolonas_s`). This model comes with the image, so no further steps than those mentioned above are necessary and no download happens.
- The other choices are automatically downloaded and stored in the folder `config/model_cache/rknn_cache`. - The other choices are automatically downloaded and stored in the folder `config/model_cache/rknn_cache`. After upgrading Frigate, you should remove older models to free up space.
- Finally, you can also provide your own `.rknn` model. To convert a model to `.rknn` format see the `rknn-toolkit2` (requires a x86 machine). Note, that there is only post-processing for the supported models. - Finally, you can also provide your own `.rknn` model. You should not save your own models in the `rknn_cache` folder, store them directly in the `model_cache` folder or another subfolder. To convert a model to `.rknn` format see the `rknn-toolkit2` (requires a x86 machine). Note, that there is only post-processing for the supported models.

View File

@ -37,14 +37,6 @@ class Rknn(DetectionApi):
core_mask = 2**config.num_cores - 1 core_mask = 2**config.num_cores - 1
soc = self.get_soc() soc = self.get_soc()
if config.purge_model_cache:
self.purge_model_cache()
else:
logger.warning(
"Purging model chache is disabled. Remember to manually delete unused models from "
+ str(model_chache_dir[1:])
)
model_props = self.parse_model_input(config.model.path, soc) model_props = self.parse_model_input(config.model.path, soc)
from rknnlite.api import RKNNLite from rknnlite.api import RKNNLite
@ -60,15 +52,6 @@ class Rknn(DetectionApi):
def __del__(self): def __del__(self):
self.rknn.release() self.rknn.release()
def purge_model_cache(self):
if os.path.isdir(model_chache_dir):
for file in os.listdir(model_chache_dir):
if os.path.isfile(file):
if file.endswith("-v2.0.0-1.rknn"):
continue
else:
os.remove(file)
def get_soc(self): def get_soc(self):
try: try:
with open("/proc/device-tree/compatible") as file: with open("/proc/device-tree/compatible") as file: