1. Check the torchvision version (can be checked through pip list or conda list)
2. If toechvision >= 0.4, you need to from torchvision.models.utils import load_state_dict_from_url
change it to from torch.hub import load_state_dict_from_url
. (This is the problem I had and solved it this way)
3. If toechvision <0.4, please check other issues
Copyright statement: This article is an original article by CSDN blogger "playing Saburo x", original text: https://blog.csdn.net/weixin_45044286/article/details/121331070