错误如下:
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'torchvision.models.video.io'
debug调试发现问题出现在mmengine中的包导入,函数位于mmengine.runner.checkpoint.
def get_torchvision_models(): import torchvision if digit_version(torchvision.__version__) < digit_version('0.13.0a0'): model_urls = dict() # When the version of torchvision is lower than 0.13, the model url is # not declared in `torchvision.model.__init__.py`, so we need to # iterate through `torchvision.models.__path__` to get the url for each # model. for _, name, ispkg in pkgutil.walk_packages( torchvision.models.__path__): if ispkg: continue # if 'video' in name: # continue _zoo = import_module(f'torchvision.models.{name}') if hasattr(_zoo, 'model_urls'): _urls = getattr(_zoo, 'model_urls') model_urls.update(_urls)
调试后发现torch.models.video中并无io文件。解决办法如下;
添加代码,过滤掉video中的无效导入包。
标签:torchvision,MMRotate,models,RetinaNet,Dev,version,video,urls,model From: https://www.cnblogs.com/lzqdeboke/p/17584599.html