报错ValueError: Unknown level: 'WARNING'

板端尝试yolo11n推理出现报错ValueError: Unknown level: ‘WARNING’,然后再试看yolov8n推理还是一样的报错。 请问该如何解决?

W rknn-toolkit-lite2 version: 2.3.0
–> Init runtime environment
I RKNN: [06:01:27.598] RKNN Runtime Information, librknnrt version: 2.3.0 (c949ad889d@2024-11-07T11:35:33)
I RKNN: [06:01:27.599] RKNN Driver Information, version: 0.9.6
I RKNN: [06:01:27.599] RKNN Model Information, version: 6, toolkit version: 2.3.0(compiler version: 2.3.0 (c949ad889d@2024-11-07T11:39:30)), target: RKNPU v2, target platform: rk3588, framework name: ONNX, framework layout: NCHW, model inference type: static_shape
W RKNN: [06:01:27.615] query RKNN_QUERY_INPUT_DYNAMIC_RANGE error, rknn model is static shape type, please export rknn with dynamic_shapes
W Query dynamic range failed. Ret code: RKNN_ERR_MODEL_INVALID. (If it is a static shape RKNN model, please ignore the above warning message.)
done
Model-/home/radxa/rknn/model/yolov8n.rknn is rknn model, starting val
Traceback (most recent call last):
File “/home/radxa/rknn/yolov8.py”, line 264, in
boxes, classes, scores = post_process(outputs)
^^^^^^^^^^^^^^^^^^^^^
File “/home/radxa/rknn/yolov8.py”, line 123, in post_process
boxes.append(box_process(input_data[pair_per_branch*i]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/radxa/rknn/yolov8.py”, line 110, in box_process
position = dfl(position)
^^^^^^^^^^^^^
File “/home/radxa/rknn/yolov8.py”, line 90, in dfl
import torch
File “/home/radxa/miniconda3/envs/py311/lib/python3.11/site-packages/torch/init.py”, line 2475, in
from torch import (
File “/home/radxa/miniconda3/envs/py311/lib/python3.11/site-packages/torch/export/init.py”, line 28, in
from torch.fx.passes.infra.pass_base import PassResult
File “/home/radxa/miniconda3/envs/py311/lib/python3.11/site-packages/torch/fx/passes/init.py”, line 3, in
from . import net_min_base
File “/home/radxa/miniconda3/envs/py311/lib/python3.11/site-packages/torch/fx/passes/net_min_base.py”, line 13, in
from .split_utils import split_by_tags
File “/home/radxa/miniconda3/envs/py311/lib/python3.11/site-packages/torch/fx/passes/split_utils.py”, line 9, in
from torch.fx.passes.utils import HolderModule, lift_subgraph_as_module
File “/home/radxa/miniconda3/envs/py311/lib/python3.11/site-packages/torch/fx/passes/utils/init.py”, line 1, in
from .common import lift_subgraph_as_module, HolderModule, compare_graphs
File “/home/radxa/miniconda3/envs/py311/lib/python3.11/site-packages/torch/fx/passes/utils/common.py”, line 8, in
from torch.fx.passes.utils.matcher_utils import SubgraphMatcher
File “/home/radxa/miniconda3/envs/py311/lib/python3.11/site-packages/torch/fx/passes/utils/matcher_utils.py”, line 32, in
logger = _init_logger()
^^^^^^^^^^^^^^
File “/home/radxa/miniconda3/envs/py311/lib/python3.11/site-packages/torch/fx/passes/utils/matcher_utils.py”, line 22, in _init_logger
logger.setLevel(level)
File “/home/radxa/miniconda3/envs/py311/lib/python3.11/logging/init.py”, line 1464, in setLevel
self.level = _checkLevel(level)
^^^^^^^^^^^^^^^^^^
File “/home/radxa/miniconda3/envs/py311/lib/python3.11/logging/init.py”, line 207, in _checkLevel
raise ValueError(“Unknown level: %r” % level)
ValueError: Unknown level: ‘WARNING’

I have the same problem trying the demo yolov8 model on the bus.jpg file. did you manage to get it to work eventually?

did you run the code in conda environment too?

Due to my lack of programming skills, I am unable to solve the problem.

But through trial and error I found that the code can be run without the conda environment.

Hey! I was actually just running a python3 virtual environment. but the following solution worked for me and should also work for you since conda is just virtual environment client:

within your environment, the following pip packages need to be installed with the following versions:
pip3 install torch==1.13.0
pip3 install numpy=1.22.0

make sure you use “pip3 uninstall” on these packages before you reinstall a specific version.
also, some warnings come up but the RKNN model works.