GitHub - facebookresearch/maskrcnn-benchmark: Fast, modular reference implementation of Instance Segmentation and Object Detection algorithms in PyTorch.
安装时一直提示报错fatal error: THC/THC.h: No such file or directory
主要原因是pytorch版本过高要选择1.10的,1.11的就会过高[Debug] Pytorch 版本问题 THC/THC.h: No such file or directory_文三路张同学的博客-CSDN博客
conda create -n maskrcnn python=3.7
conda activate maskrcnn
# pytorch官网下载1.10版本
pip install torch==1.10.1+cu111 torchvision==0.11.2+cu111 torchaudio==0.10.1 -f https://download.pytorch.org/whl/cu111/torch_stable.html
conda install ipython pip
pip install ninja yacs cython matplotlib tqdm opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple
# 安装pycoco
git clone https://github.com/cocodataset/cocoapi.git
cd cocoapi/PythonAPI
python setup.py build_ext install
# 安装apex
git clone https://github.com/NVIDIA/apex
cd apex
python setup.py install
#安装maskrcnn
cd maskrcnn-benchmark
python setup.py install
然后会出现error: ‘AT_CHECK’ was not declared in this scope解决方法(版本过高的问题但是30系列的需要11.0以上的,因此pytorch最好选这个)
解决方法:将所有待编译的源文件中的‘AT_CHECK’全部替换为‘TORCH_CHECK’。
error: ‘AT_CHECK’ was not declared in this scope解决方法_hailanyi的博客-CSDN博客
安装好了后执行测试
cd demo
python webcam.py --min-image-size 800
AttributeError:模块'torch._six‘没有特性'PY3’
https://www.cnblogs.com/BlogLwc/p/15663776.html
查看安装时的错误提示修改imports.py和c2_model_loading.py里的PY3成PY37(python版本)
Can‘t parse ‘org‘. Sequence item with index 0 has a wrong type
原因是opencv与python版本不匹配
去清华镜像Links for opencv-python (tsinghua.edu.cn)
找cp37的whl文件下载(因为之前已经安装了opencv-pytorch的记得先删除)
pip uninstall opencv-python
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python==3.4.10.35
Can‘t parse ‘org‘. Sequence item with index 0 has a wrong type_lolitaaaa的博客-CSDN博客
最后就安装成功了