khadas / edge2-npu

19 stars 6 forks source link

Steps for custom model conversion for yolov5 and yolov8 #4

Open programmeddeath1 opened 1 year ago

programmeddeath1 commented 1 year ago

Were you ablle to convert custom yolov5 and yolov8 models to rknn and build inference using the python api?

I am running the steps for conversion and it is working with the default models given in the rk libraries. While converting my custom models from onnx to rknn, I am getting version mismatch errors between the toolkit libraries and the onnx and torch libraries used to build my model.

On updating the libraries to the compatible ones, my toolkit convert code iss failing with

export_pre_compile_path: ./model_cvt/RK3588/yolov5s.torchscript_RK3588_i8_precompile.rknn ---> Create RKNN object

/home/dt/Projects/Work/greenox/rknn/venv/lib/python3.8/site-packages/rknn/api/rknn.py(57)init() -> self.rknn_base = RKNNBase(cur_path, verbose) (Pdb) c File "../../../../../common/rknn_converter/rknn_convert.py", line 19, in convert rknn = cp.convert() File "/home/dt/Projects/Work/greenox/rknn/rknn_model_zoo/common/rknn_converter/phase.py", line 96, in convert rknn = RKNN(verbose=model_config_dict['verbose'], verbose_file=model_config_dict['verbose_file']) File "/home/dt/Projects/Work/greenox/rknn/venv/lib/python3.8/site-packages/rknn/api/rknn.py", line 57, in init self.rknn_base = RKNNBase(cur_path, verbose) File "rknn/api/rknn_base.py", line 75, in rknn.api.rknn_base.RKNNBase.init File "/home/dt/Projects/Work/greenox/rknn/venv/lib/python3.8/site-packages/pkg_resources/init.py", line 526, in get_distribution dist = get_provider(dist) File "/home/dt/Projects/Work/greenox/rknn/venv/lib/python3.8/site-packages/pkg_resources/init.py", line 398, in get_provider return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0] File "/home/dt/Projects/Work/greenox/rknn/venv/lib/python3.8/site-packages/pkg_resources/init.py", line 695, in find if dist is not None and dist not in req: File "/home/dt/Projects/Work/greenox/rknn/venv/lib/python3.8/site-packages/pkg_resources/init.py", line 3204, in contains return self.specifier.contains(item, prereleases=True) File "/home/dt/Projects/Work/greenox/rknn/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/specifiers.py", line 902, in contains item = Version(item) File "/home/dt/Projects/Work/greenox/rknn/venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py", line 197, in init raise InvalidVersion(f"Invalid version: '{version}'") pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.4.0-22dcfef4'

Do you have a requirements file and the versions of yolov5,v7 and v8 which the rknntoolit2 is compatible with?