最近从github上下载的实例分割代码是detectron2-0.5的记录下配置过程。
1、前面什么pytorch基本步骤网上教程很多, 对着项目的要求下就行
2、到这里一般都是让你去下一个detectron2,但是我们从github上白嫖的项目都是有detectron2的,所以只需要找到那个setpu.py文件,然后安装它,即python setup.py build develop
过程中如果提示xxxx下载超时等下载错误,那就直接把它的下载地址复制到浏览器里手动下载,然后在当前环境进行pip install xxxx.whl
,比如:
Installed c:\programdata\anaconda3\envs\detectron2_0.5\lib\site-packages\click-8.1.7-py3.7.egg
Searching for importlib-resources
Reading https://pypi.org/simple/importlib-resources/
Downloading https://files.pythonhosted.org/packages/93/e8/facde510585869b5ec694e8e0363ffe4eba067cb357a8398a55f6a1f8023/impo
rtlib_resources-6.1.1-py3-none-any.whl#sha256=e8bf90d8213b486f428c9c39714b920041cb02c184686a3dee24905aaa8105d6
error: Download error for https://files.pythonhosted.org/packages/93/e8/facde510585869b5ec694e8e0363ffe4eba067cb357a8398a55
f6a1f8023/importlib_resources-6.1.1-py3-none-any.whl#sha256=e8bf90d8213b486f428c9c39714b920041cb02c184686a3dee24905aaa8105d
6: [SSL: KRB5_S_TKT_NYV] unexpected eof while reading (_ssl.c:1091)
我就复制
https://files.pythonhosted.org/packages/93/e8/facde510585869b5ec694e8e0363ffe4eba067cb357a8398a55
f6a1f8023/importlib_resources-6.1.1-py3-none-any.whl
粘贴到浏览器里下载,
然后就在当前环境使用pip install安装,
如果提示python版本不对,要么升级python版本,要么在去找一个符合当前版本的包安装。
我这边会有一个错误是下面这样的:
D:/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign_cuda.cu(337): error: no instance of function template “at::cuda::ATenCeilDiv” matches the argument list
argument types are: (long long, long)
D:/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign_cuda.cu(337): error: no instance of overloaded function “std::min” matches the argument list
argument types are: (, long)
D:/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign_cuda.cu(394): error: no instance of function template “at::cuda::ATenCeilDiv” matches the argument list
argument types are: (int64_t, long)
D:/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign_cuda.cu(394): error: no instance of overloaded function “std::min” matches the argument list
argument types are: (, long)
解决方法是将它提示错误的这2个地方的long改为int64_t, 就是说把那行的L删了然后用int64_t把值括起来,就像下面这样。
dim3 grid(std::min(at::cuda::ATenCeilDiv(grad.numel(), int64_t(512)), int64_t(4096)));
3、到此就继续python setup.py build develop
缺啥下啥
4、如果其他问题,下面博主的文档可能对你有帮助
Win10下安装Detectron2,超详细教程!