pytorch 1.4.0, torchvison 0.5.0, cuda 10.1, cudnn 8.0.5
项目的requirement.txt
# This file may be used to create an environment using:
# $ conda create --name --file
# platform: win-64
apex=0.1=pypi_0
argon2-cffi=21.1.0=py36h68aa20f_0
async_generator=1.10=py_0
attrs=21.2.0=pyhd8ed1ab_0
backcall=0.2.0=pyh9f0ad1d_0
backports=1.0=py_2
backports.functools_lru_cache=1.6.4=pyhd8ed1ab_0
blas=1.0=mkl
bleach=4.1.0=pyhd8ed1ab_0
ca-certificates=2021.10.8=h5b45459_0
certifi=2021.5.30=py36ha15d459_0
cffi=1.14.6=py36he58ceb7_1
colorama=0.4.4=pyh9f0ad1d_0
cudatoolkit=10.1.243=h3826478_9
cycler=0.11.0=pyhd8ed1ab_0
cython=0.29.24=pypi_0
decorator=5.1.0=pyhd8ed1ab_0
defusedxml=0.7.1=pyhd8ed1ab_0
entrypoints=0.3=pyhd8ed1ab_1003
fonttools=4.28.2=pypi_0
freetype=2.10.4=h546665d_1
hdf5=1.8.20=hac2f561_1
icc_rt=2019.0.0=h0cc432a_1
icu=68.2=h0e60522_0
importlib-metadata=4.8.1=py36ha15d459_0
intel-openmp=2021.4.0=h57928b3_3556
ipykernel=5.5.5=py36hfacbf0b_0
ipython=7.16.1=py36h5ca1d4c_0
ipython_genutils=0.2.0=py_1
jbig=2.1=h8d14728_2003
jedi=0.17.2=py36ha15d459_1
jinja2=3.0.3=pyhd8ed1ab_0
jpeg=9d=h8ffe710_0
jsonschema=4.1.2=pyhd8ed1ab_0
jupyter_client=7.1.0=pyhd8ed1ab_0
jupyter_core=4.8.1=py36ha15d459_0
jupyterlab_pygments=0.1.2=pyh9f0ad1d_0
kiwisolver=1.3.1=py36he95197e_1
lcms2=2.12=h2a16943_0
lerc=3.0=h0e60522_0
libblas=3.9.0=8_mkl
libcblas=3.9.0=8_mkl
libclang=11.1.0=default_h5c34c98_1
libdeflate=1.8=h8ffe710_0
liblapack=3.9.0=8_mkl
libopencv=3.4.2=h20b85fd_0
libpng=1.6.37=h1d00b33_2
libsodium=1.0.18=h8d14728_1
libtiff=4.3.0=hd413186_2
libzlib=1.2.11=h8ffe710_1013
lz4-c=1.9.3=h8ffe710_1
markupsafe=2.0.1=py36h68aa20f_0
maskrcnn-benchmark=0.1=dev_0
matplotlib=3.3.4=py36ha15d459_0
matplotlib-base=3.3.4=py36h1abdf75_0
mistune=0.8.4=py36h68aa20f_1004
mkl=2020.4=hb70f87d_311
nb_conda=2.2.1=py36ha15d459_4
nb_conda_kernels=2.3.1=py36ha15d459_0
nbclient=0.5.9=pyhd8ed1ab_0
nbconvert=6.0.7=py36ha15d459_3
nbformat=5.1.3=pyhd8ed1ab_0
nest-asyncio=1.5.1=pyhd8ed1ab_0
ninja=1.10.2.3=pypi_0
notebook=6.3.0=py36ha15d459_0
numpy=1.21.4=pypi_0
olefile=0.46=pyh9f0ad1d_1
opencv=3.4.2=py36h40b0b35_0
openjpeg=2.4.0=hb211442_1
openssl=1.1.1l=h8ffe710_0
packaging=21.3=pyhd8ed1ab_0
pandoc=2.16.2=h8ffe710_0
pandocfilters=1.5.0=pyhd8ed1ab_0
parso=0.7.1=pyh9f0ad1d_0
pickleshare=0.7.5=py_1003
pillow=8.4.0=pypi_0
pip=21.3.1=pyhd8ed1ab_0
prometheus_client=0.12.0=pyhd8ed1ab_0
prompt-toolkit=3.0.22=pyha770c72_0
py-opencv=3.4.2=py36hc319ecb_0
pycocotools=2.0=pypi_0
pycparser=2.21=pyhd8ed1ab_0
pygments=2.10.0=pyhd8ed1ab_0
pyparsing=3.0.6=pyhd8ed1ab_0
pyqt=5.12.3=py36ha15d459_7
pyqt-impl=5.12.3=py36he2d232f_7
pyqt5-sip=4.19.18=py36he2d232f_7
pyqtchart=5.12=py36he2d232f_7
pyqtwebengine=5.12.1=py36he2d232f_7
pyrsistent=0.17.3=py36h68aa20f_2
python=3.6.2=h09676a0_15
python-dateutil=2.8.2=pyhd8ed1ab_0
python_abi=3.6=2_cp36m
pytorch=1.4.0=py3.6_cuda101_cudnn7_0
pywin32=301=py36h68aa20f_0
pywinpty=1.1.4=py36hcae0e51_0
pyyaml=6.0=pypi_0
pyzmq=22.3.0=py36h1d5d788_0
qt=5.12.9=h5909a2a_4
scipy=1.2.1=py36h29ff71c_0
send2trash=1.8.0=pyhd8ed1ab_0
setuptools=58.0.4=py36ha15d459_2
setuptools-scm=6.3.2=pypi_0
six=1.16.0=pyh6c4a22f_0
sqlite=3.36.0=h8ffe710_2
terminado=0.12.1=py36ha15d459_0
testpath=0.5.0=pyhd8ed1ab_0
tk=8.6.11=h8ffe710_1
tomli=1.2.2=pypi_0
torchvision=0.5.0=pypi_0
tornado=6.1=py36h68aa20f_1
tqdm=4.62.3=pypi_0
traitlets=4.3.3=pyhd8ed1ab_2
typing_extensions=4.0.0=pyha770c72_0
ucrt=10.0.20348.0=h57928b3_0
vc=14.2=hb210afc_5
vs2015_runtime=14.29.30037=h902a5da_5
wcwidth=0.2.5=pyh9f0ad1d_2
webencodings=0.5.1=py_1
wheel=0.37.0=pyhd8ed1ab_1
winpty=0.4.3=4
xz=5.2.5=h62dcd97_1
yacs=0.1.8=pypi_0
zeromq=4.3.4=h0e60522_1
zipp=3.6.0=pyhd8ed1ab_0
zlib=1.2.11=h8ffe710_1013
zstd=1.5.0=h6255e5f_0
D:/Anacoda/envs/maskrcnn/lib/site-packages/torch/include\c10/util/BFloat16.h(63): note: 参见“c10::BFloat16”的声明
D:/Anacoda/envs/maskrcnn/lib/site-packages/torch/include\THC/generic/THCTensorMathReduce.h(38): warning C4190: “THCudaBFloat16Tensor_medianall”有 指定的 C 链接,但返回了与 C 不兼容的 UDT“c10::BFloat16”
D:/Anacoda/envs/maskrcnn/lib/site-packages/torch/include\c10/util/BFloat16.h(63): note: 参见“c10::BFloat16”的声明
D:/Anacoda/envs/maskrcnn/lib/site-packages/torch/include\THC/THCNumerics.cuh(81): warning C4804: “/”: 在操作中使用类型“bool”不安全
C:\Users\29983\AppData\Local\Temp\tmpxft_00003a00_00000000-9_deform_conv_kernel_cuda.cudafe1.cpp : fatal error C1083: 无法打开编译器生成的文件: “”: Invalid argument
error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\bin\\nvcc.exe' failed with exit status 1
源码问题,从github上https://github.com/facebookresearch/maskrcnn-benchmark,重新下载官方源码
下载 visualcppbuildtools_full.exe. 目前从网上找到的不是无法安装就是损坏,可从百度网盘下载。
链接:https://pan.baidu.com/s/14-kvQB55ykfuwcRWeh3IrQ
提取码:1234
解压后直接点击安装即可
安装之后需要配置环境变量
在Path中添加Microsoft Visual Sudio 14 的 安装路径
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64,如果安装过VS2017或VS2019,确保该路径位于其他VS路径之上,否则前面的会覆盖掉后面的变量
Traceback (most recent call last):
File "webcam.py", line 6, in <module>
from predictor import COCODemo
File "E:\LDHD_Competition\TinyBenchmark-master\test\maskrcnn-benchmark\demo\predictor.py", line 6, in <module>
from maskrcnn_benchmark.modeling.detector import build_detection_model
File "D:\Anacoda\envs\maskrcnn\lib\site-packages\maskrcnn_benchmark\modeling\detector\__init__.py", line 2, in <module>
from .detectors import build_detection_model
File "D:\Anacoda\envs\maskrcnn\lib\site-packages\maskrcnn_benchmark\modeling\detector\detectors.py", line 2, in <module>
from .generalized_rcnn import GeneralizedRCNN
File "D:\Anacoda\envs\maskrcnn\lib\site-packages\maskrcnn_benchmark\modeling\detector\generalized_rcnn.py", line 10, in <module>
from ..backbone import build_backbone
File "D:\Anacoda\envs\maskrcnn\lib\site-packages\maskrcnn_benchmark\modeling\backbone\__init__.py", line 2, in <module>
from .backbone import build_backbone
File "D:\Anacoda\envs\maskrcnn\lib\site-packages\maskrcnn_benchmark\modeling\backbone\backbone.py", line 7, in <module>
from maskrcnn_benchmark.modeling.make_layers import conv_with_kaiming_uniform
File "D:\Anacoda\envs\maskrcnn\lib\site-packages\maskrcnn_benchmark\modeling\make_layers.py", line 10, in <module>
from maskrcnn_benchmark.layers import Conv2d
File "D:\Anacoda\envs\maskrcnn\lib\site-packages\maskrcnn_benchmark\layers\__init__.py", line 9, in <module>
from .nms import nms
File "D:\Anacoda\envs\maskrcnn\lib\site-packages\maskrcnn_benchmark\layers\nms.py", line 4, in <module>
from ._utils import _C
File "D:\Anacoda\envs\maskrcnn\lib\site-packages\maskrcnn_benchmark\layers\_utils.py", line 39, in <module>
_C = _load_C_extensions()
File "D:\Anacoda\envs\maskrcnn\lib\site-packages\maskrcnn_benchmark\layers\_utils.py", line 35, in _load_C_extensions
File "D:\Anacoda\envs\maskrcnn\lib\site-packages\torch\utils\cpp_extension.py", line 680, in load
is_python_module)
File "D:\Anacoda\envs\maskrcnn\lib\site-packages\torch\utils\cpp_extension.py", line 877, in _jit_compile
return _import_module_from_library(name, build_directory, is_python_module)
File "D:\Anacoda\envs\maskrcnn\lib\site-packages\torch\utils\cpp_extension.py", line 1084, in _import_module_from_library
file, path, description = imp.find_module(module_name, [path])
File "D:\Anacoda\envs\maskrcnn\lib\imp.py", line 296, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named 'torchvision'
torchvision 版本过高或者是由于VS编译问题(参考3重新配置VS 2014环境),卸载torchvision后使用如下命令重新安装
pip install torchvision==0.2.1
之后,使用
cd maskrcnn-benchmark
python setup.py build develop
重新编译