1. 三维重建MVSNet代码调试
可能遇到的报错1
message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
- Downgrade the protobuf package to 3.20.x or lower.
- Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
报错1解决方法
报错1解决办法:在虚拟环境“You_env”中重新安装protobuf
pip install protobuf==3.20.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
可能遇到的报错2
self.num_batches_tracked = self.num_batches_tracked + 1 # type: ignore[has-type]
RuntimeError: CUDA error: no kernel image is available for execution on the device
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
报错2解决方法
问题参考详细见:pytorch算力报错讨论
报错2解决办法:在虚拟环境“You_env”中重新安装与当前显卡算力相匹配的环境依赖库
pip3 install torch torchvision torchaudio --force-reinstall --extra-index-url https://download.pytorch.org/whl/cu111
注意,cu111根据你的cuda版本来设置,使用nvcc -V查看,如果显示11.4则使用cu114
2. ESPNetV2代码调试
可能遇到的报错3
rgb_img = rgb_img.resize(new_size, Image.ANTIALIAS)
AttributeError: module ‘PIL.Image’ has no attribute ‘ANTIALIAS’
报错3解决方法
Pillow版本不符合,Pillow-10.X 的版本已经弃用“Image.ANTIALIAS”,换用低版本的Pillow即可。
pip install Pillow==9.5.0
可能遇到的报错4(调试MMsegmentation)
assert (mmcv_min_version <= mmcv_version < mmcv_max_version),
AssertionError: MMCV==2.2.0 is used but incompatible. Please install mmcv>=2.0.0rc4.
报错4解决方法
按照提示要求安装对应版本的mmcv
pip install "mmcv==2.0.0rc4"
可能遇到的报错5 (Conda环境错误问题)
问题描述:在激活了conda环境之后进行的pip安装,没能把所需的依赖库安装到当前已经激活的虚拟环境中。使用命令pip install show XXX
查看对应的依赖库位置,大象并不在我指定的虚拟环境目录下,卸载此库发现此依赖库也不在指定的虚拟环境目录下,如下所示。
报错5解决方法
使用“conda”进行安装
再次查看,发现所需的依赖库已经在指定的虚拟环境目录下了。
可能遇到的报错6
问题描述:
使用mmsegmentation时无法恢复训练,原因是mmengine版本过高导致
更换MMengine版本时遇到报错
执行:mim install mmengine==0.10.2
from charset_normalizer.md import mess_ratio
File “charset_normalizer/md.py”, line 5, in
ImportError: cannot import name ‘COMMON_SAFE_ASCII_CHARACTERS’ from ‘charset_normalizer.constant’ (/home/ly/anaconda3/envs/openmmlab/lib/python3.8/site-packages/charset_normalizer/constant.py)
报错6解决方法
先升级:charset-normalizer
pip install --upgrade charset-normalizer
再执行命令:
mim install mmengine==0.10.2