D:\Work Bag\Python\lib\site-packages\torchvision\models\_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead. warnings.warn( D:\Work Bag\Python\lib\site-packages\torchvision\models\_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing `weights=ResNet34_Weights.IMAGENET1K_V1`. You can also use `weights=ResNet34_Weights.DEFAULT` to get the most up-to-date weights. warnings.warn(msg) Traceback (most recent call last): File "C:/Users/29800/Desktop/rPPG-master/run.py", line 65, in <module> runPOS(source) File "C:/Users/29800/Desktop/rPPG-master/run.py", line 39, in __call__ capture = CaptureFrames(self.batch_size, source, show_mask=True) File "C:\Users\29800\Desktop\rPPG-master\capture_frames.py", line 20, in __init__ self.model.load_state_dict(torch.load('linknet.pth')) File "D:\Work Bag\Python\lib\site-packages\torch\serialization.py", line 815, in load return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args) File "D:\Work Bag\Python\lib\site-packages\torch\serialization.py", line 1033, in _legacy_load magic_number = pickle_module.load(f, **pickle_load_args) _pickle.UnpicklingError: invalid load key, 'v'.
时间: 2023-08-29 20:06:26 浏览: 1540
这个警告和错误可能是由于使用了不兼容的 pickle 版本造成的。pickle 在序列化和反序列化 Python 对象时,需要使用相同版本的 pickle。如果对象是使用不同版本的pickle进行序列化的,那么在反序列化时就会出现 _pickle.UnpicklingError 错误。
解决方法是尝试更新 pickle 版本或者使用相同版本的 pickle 进行序列化和反序列化操作。如果你使用的是 Python 3,在进行 pickle 操作时,建议使用 "pickle" 模块的 "protocol" 参数指定协议版本,例如 pickle.dump(obj, file, protocol=4),指定协议版本为 4。这样可以确保在不同 Python 版本之间进行 pickle 操作时,能够更好地兼容。
此外,第一个警告是关于 PyTorch 中的 pretrained 参数已经被弃用,建议使用 weights 参数替代;第二个警告是关于传递给函数的参数已经被弃用,建议使用更合适的参数传递方式。建议按照警告信息进行修改,以免在将来的版本中出现问题。
相关问题
36085 WARNING: lib not found: c10.dll dependency of D:\python\lib\site-packages\torchvision\_C.pyd 36099 WARNING: lib not found: torch_cpu.dll dependency of D:\python\lib\site-packages\torchvision\_C.pyd 36113 WARNING: lib not found: c10_cuda.dll dependency of D:\python\lib\site-packages\torchvision\_C.pyd 36127 WARNING: lib not found: torch_cuda_cpp.dll dependency of D:\python\lib\site-packages\torchvision\_C.pyd 36146 WARNING: lib not found: torch_python.dll dependency of D:\python\lib\site-packages\torch\_C_flatbuffer.cp37-win_amd64.pyd 36287 WARNING: lib not found: torch_python.dll dependency of D:\python\lib\site-packages\torch\_C.cp37-win_amd64.pyd 37214 WARNING: lib not found: api-ms-win-security-systemfunctions-l1-1-0.dll dependency of D:\python\lib\site-packages\torchvision\cudart64_110.dll 326321 INFO: Looking for eggs 326578 INFO: Using Python library D:\python\python37.dll 326578 INFO: Found binding redirects: [] 326631 INFO: Warnings written to D:\python-zuoye\pythonProject_001\build\main\warn-main.txt 327409 INFO: Graph cross-reference written to D:\python-zuoye\pythonProject_001\build\main\xref-main.html 327899 INFO: checking PYZ 327900 INFO: Building PYZ because PYZ-00.toc is non existent 327901 INFO: Building PYZ (ZlibArchive) D:\python-zuoye\pythonProject_001\build\main\PYZ-00.pyz 334452 INFO: Building PYZ (ZlibArchive) D:\python-zuoye\pythonProject_001\build\main\PYZ-00.pyz completed successfully. 334974 INFO: checking PKG 334974 INFO: Building PKG because PKG-00.toc is non existent 334975 INFO: Building PKG (CArchive) main.pkg
这个警告信息看起来像是在使用torchvision和torch库时,找不到相关的依赖库。其中,c10.dll, torch_cpu.dll, c10_cuda.dll, torch_cuda_cpp.dll, torch_python.dll 这些库都是与pytorch相关的依赖库。api-ms-win-security-systemfunctions-l1-1-0.dll是Windows系统的API库。
您可以尝试重新安装最新版本的pytorch和torchvision库,并确保您的环境变量已正确配置。如果您使用的是Windows系统,可以尝试安装 Microsoft Visual C++ Redistributable for Visual Studio 2019,它包括了一些必要的系统dll文件。如果问题依然存在,您可以在pytorch或torchvision的官方论坛上提问,寻求帮助。
python中报Usage:C:\anaconda\lib\site-packages\ipykernel_launcher.py camera_id face_num_max path_name
这个错误提示是一个使用指令时的错误提示,其中“Usage”表示使用方法,后面的“C:\anaconda\lib\site-packages\ipykernel_launcher.py camera_id face_num_max path_name”是命令的具体参数。这个错误提示的意思是你在使用某个命令时,没有按照正确的格式输入参数。你需要检查一下你输入的命令是否符合要求,并且保证每个参数都正确填写。