1、安装Detectron2
按照官方安装步骤进行安装
官方文档
https://github.com/facebookresearch/detectron2/blob/main/INSTALL.md
下载Detectron2相关代码
git clone https://github.com/facebookresearch/detectron2.git #用git下载代码
python -m pip install -e detectron2 #安装detectron2
2、安装AdelaiDet
git clone https://github.com/aim-uofa/AdelaiDet.git
cd AdelaiDet
python setup.py build develop
python demo/demo.py \
--config-file configs/BlendMask/R_101_dcni3_5x.yaml \
--input datasets/input1.jpg \
--confidence-threshold 0.35 \
--opts MODEL.WEIGHTS blendmask_r101_dcni3_5x.pth
python demo/demo.py --config-file configs/BlendMask/R_101_dcni3_5x.yaml --input ./datasets/00000.jpg --confidence-threshold 0.35 --opts MODEL.WEIGHTS ./blendmask_r101_dcni3_5x.pth
3、运行
报错
1、 ImportError(“cannot import name ‘string_metric’ from ‘rapidfuzz’
错误原因:rapidfuzz包版本过高
解决办法:降低该包版本为1.1.1版本,直接下载报错,去官网下载相应轮子文件进行安装
pip install rapidfuzz==1.1.1
2、AttributeError: module ‘PIL.Image’ has no attribute ‘LINEAR’
解决办法:卸载Pillow-10.0.0
重新安装Pilow=8.4.0
即降低Pillow版本即可。
3、ImportError: /home/jy/segement/detectron2/detectron2/_C.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZNK2at6Tensor7reshapeEN3c108ArrayRefIlEE
AdelaiDet训练自己的数据集(COCO格式数据集)
注册数据集
从detectron2/data/datasets中修改builtin.py
# builtin中添加的内容
# 在_PREDEFINED_SPLITS_COCO["coco"]中添加自己数据集的路径
_PREDEFINED_SPLITS_COCO["coco"] = {
# 自己的数据集:
# "coco_handwritten_train"为自定义名称,后面会用到;后面的两个路径第一个是图片目录,第二个是对应json文件路径
# 训练集
"coco_handwritten_train":


1768

被折叠的 条评论
为什么被折叠?



