这里写目录标题
- 清华镜像加速
- 安装cuda11.3 +PyTorch 1.10.1
- https://pytorch.org/get-started/previous-versions/
- [如果没有可以点Previous pyTorch Versions,这里面有更多的更早的版本](https://pytorch.org/get-started/locally/)
- 复制非空文件夹cp: -r not specified; omitting directory XXX
- MultiplexedOCR
- cannot import name ‘_download_url_to_file‘ from ‘torch.utils.model_zoo‘
- ImportError: cannot import name 'TopologicalError' from 'shapely.geos'
- ImportError: /data1/xyj/MultiplexedOCR-main/multiplexer/_C.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN3c106SymInt19promote_to_negativeEv
- TypeError: join() argument must be str, bytes, or os.PathLike object, not ‘NoneType‘
- masktextspotter
- apex安装
- 安装maskrcnn-benchmark(maskrcnn)
- maskrcnn-benchmark疯狂报错
- ImportError: cannot import name ‘_C’ from ‘maskrcnn_benchmark’
- Test_spotting_transformer
- /data1/xyj/anaconda3/envs/TESTR/lib/python3.8/site-packages/detectron2/utils/visualizer.py:308: UserWarning: Glyph 21475 (\N{CJK UNIFIED IDEOGRAPH-53E3}) missing from current font.
- openmmlab
- error: metadata-generation-failed
- ERROR: Failed building wheel for mmpycocotools
- ERROR: Could not build wheels for mmpycocotools, which is required to install pyproject.toml-based projects
清华镜像加速
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip install torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1+cu118 -f https://download.pytorch.org/whl/torch_stable.html
安装cuda11.3 +PyTorch 1.10.1
https://pytorch.org/get-started/previous-versions/
conda install pytorch1.10.1 torchvision0.11.2 torchaudio==0.10.1 cudatoolkit=11.3 -c pytorch -c conda-forge
不可以,一直在解析环境
如果没有可以点Previous pyTorch Versions,这里面有更多的更早的版本
pip3 install torch==1.10.0+cu113 torchvision==0.11.1+cu113 torchaudio==0.10.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
通过以上指令会把Pytorch1.10以及需要的CUDA11.3全部安装好(不需要单独安装CUDA)
复制非空文件夹cp: -r not specified; omitting directory XXX
linux复制操作 cp: -r not specified; omitting directory XXX 错误
记得加上 -r
MultiplexedOCR
cannot import name ‘_download_url_to_file‘ from ‘torch.utils.model_zoo‘
ImportError: cannot import name ‘HASH_REGEX’ from ‘torch.utils.model_zoo’
try:
from torch.hub import HASH_REGEX, _download_url_to_file, urlparse
except ImportError:
from torch.hub import download_url_to_file
from torch.hub import urlparse
from torch.hub import HASH_REGEX
#from torch.utils.model_zoo import _download_url_to_file
#from torch.utils.model_zoo import urlparse
#from torch.utils.model_zoo import HASH_REGEX
ImportError: cannot import name ‘TopologicalError’ from ‘shapely.geos’
Revert Shapely to 1.8.5 and Numpy to 1.23.4
Should work.
ImportError: /data1/xyj/MultiplexedOCR-main/multiplexer/_C.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN3c106SymInt19promote_to_negativeEv
I’ve faced of this issue recently and creating a new environment with parameters below solved my problem.
PS : I assume that you’re using torch with CUDA, if you’re not you can install non-GPU versions.
torch version : 1.9 + cu111
torchvision : 0.10.0 + cu111
torchaudio : 0.9.0
You can download these from ;
pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
好像不管什么版本 -f 后面接的都是一个网址
TypeError: join() argument must be str, bytes, or os.PathLike object, not ‘NoneType‘
masktextspotter
conda create -n masktextspotter python=3.8
conda activate maskrcnn_benchmark
#安装各种依赖包
conda install ipython
pip install ninja yacs cython matplotlib tqdm opencv-python
# install PyTorch 反正后面torch报错,我换了个版本
conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
# install pycocotools
cd $INSTALL_DIR
git clone https://github.com/cocodataset/cocoapi.git
cd cocoapi/PythonAPI
python setup.py build_ext install
# install apex
cd $INSTALL_DIR
git clone https://github.com/NVIDIA/apex.git
cd apex
python setup.py install --cuda_ext --cpp_ext
# clone repo
cd $INSTALL_DIR
git clone https://github.com/MhLiao/MaskTextSpotterV3.git
cd MaskTextSpotterV3
# build
python setup.py build develop
apex安装
此句报错,
python setup.py install --cuda_ext --cpp_ext
或许换成这句有用pip install -v --no-cache-dir ./
,待会试试
注意apex
和下面的maskrcnn-benchmark
都不可以直接pip
安装maskrcnn-benchmark(maskrcnn)
一堆报错,报错找不到maskrcnn-benchmark
,
但是清楚地看到项目同级文件夹下有maskrcnn-benchmark
这个包
我甚至很愚蠢地
import torch
print(torch.__file__)
查看包的路径,想把maskrcnn-benchmark
这个文件夹复制到搜寻的路径(安装的包就是一个文件夹嘛)TT,查到是 anaconda3/envs/masktextspotter/lib/python3.8/site-packages,放到这个路径下,好像没再报错了,但可能这个文件夹就没安装成功,是错的
python import 搜索包路径的机制,以及添加自定义python包的方法
cd ../
git clone https://github.com/facebookresearch/maskrcnn-benchmark.git
cd maskrcnn-benchmark
#安装相应的包
pip3 install -r requirements.txt
maskrcnn-benchmark疯狂报错
ImportError: cannot import name ‘_C’ from ‘maskrcnn_benchmark’
修改处:
nms.py
from maskrcnn_benchmark import _C
修改为:
from ._utils import _C
没用,继续报错TT TT
有时间再看看把
maskrcnn安装及遇到的各种问题
搭建maskrcnn-benchmark的环境遇到问题
Test_spotting_transformer
训练语料库只含少量中文数据,论文中写到将其忽略
python demo/demo.py --config-file configs/TESTR/TotalText/TESTR_R_50_Polygon.yaml --input work_dirs/ocr_en_422k --output output/en --opts MODEL.WEIGHTS work_dirs/totaltext_testr_R_50_polygon.pth MODEL.TRANSFORMER.INFERENCE_TH_TEST 0.3
python demo/demo.py --config-file configs/TESTR/TotalText/TESTR_R_50_Polygon.yaml --input work_dirs/ocr_en_422k --output output/en --opts MODEL.WEIGHTS work_dirs/totaltext_testr_R_50_polygon.pth MODEL.TRANSFORMER.INFERENCE_TH_TEST 0.3
检测中文时出现以下错误
/data1/xyj/anaconda3/envs/TESTR/lib/python3.8/site-packages/detectron2/utils/visualizer.py:308: UserWarning: Glyph 21475 (\N{CJK UNIFIED IDEOGRAPH-53E3}) missing from current font.
openmmlab
从网上上找到的资料看,可能是由于最新版本的pytorch (1.11以上)去除对这个头文件的支持,所以我们建议使用pytorch 1.8版本会比较稳定
pip install torch==1.8.1+cu102 torchvision==0.9.1+cu102 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
原来是conda install pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 pytorch-cuda=11.8 -c pytorch -c nvidia
这个版本
error: metadata-generation-failed
error: metadata-generation-failed
需要执行命令 pip install setuptools==50.3.2
问题解决
ERROR: Failed building wheel for mmpycocotools
安装cython=0.29.33版本就可以解决
pip3 install cython==0.29.33 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
pip install mmpycocotools