The problem background
function yolov5 The following warning, Although it does not affect operation , But it looks bad . stay python In the environment import torchvision
It is also the following problem , Description: unable to load torchvision library .
/home/firefly/anaconda3/envs/yolo/lib/python3.8/site-packages/torchvision/io/image.py:13:
UserWarning: Failed to load image Python extension: warn(f"Failed to load image Python extension: {e}")
Question why
pytorch and torchvision The version of does not correspond to , The picture below is pytorch and torchvision The correct corresponding version of , Please according to your own situation , reinstall pytorch Or repack torchvision.
Problem solving
1、 Into our anaconda Environmental Science ,pip list
Show all our libraries . You can see my torch yes 1.11.0, According to the above table, the corresponding torchvision Should be 0.10.0, And what I installed was 0.12.0, So wrong reporting .
2、pip3 uninstall torchvision
uninstall torchvision.
3、pip3 install torchvision==0.10.0
Specify installation torchvision Version of .
Once again import torchvision
, There is no mistake , Successful import , Problem solving !