Error when loading weights file in PyTorch - _pickle.UnpicklingError

  • Hello, due to the incompatibility between the latest `python-touch` and the yolov5 source code provided by Rockchip, the `requirements.txt` in `<yolov5>` specifies `touch>=1.7.0`, which by default installs the latest version of `python-touch`. To address this, you need to modify `<yolov5>/models/experimental.py` at line 80:

    Code: Select all

    # ckpt = torch.load(attempt_download(w), map_location='cpu')
    ckpt = torch.load(attempt_download(w), map_location='cpu', weights_only=False)  # load
    
    After making this change, you can rerun:

    Code: Select all

    python export.py --rknpu --weight yolov5s.pt
    
    This will generate the ONNX model.
  • Thank you very much, I have exported the .onnx file.