ImportError: libcudart.so.10.1: cannot open shared object file: No such file or directory
解决方法感觉可能是因为cuda版本不太对劲 创了一个虚拟环境整(但后续发现就是detectron2的版本和cuda不对应)
module ‘PIL.Image’ has no attribute ‘LINEAR’
这个博客说是Pillow版本过高导致的
ImportError: libcudart.so.10.1: cannot open shared object file: No such file or directory
重新安装一下detectron2 吧!!生气!这个报错应该是因为版本太老了!
这里我直接卸载了detectron2然后在这个网址找了对应版本的detectron2
python -m pip install detectron2==0.5 -f \
https://dl.fbaipublicfiles.com/detectron2/wheels/cu110/torch1.7/index.html
然后报了如下的错
TypeError: __init__() got an unexpected keyword argument 'first_stride'
感谢这位大佬!他这篇说是因为detectron2 0.5版本的问题,0.3版本可能没有这个问题。但我这个0.5版本的detectron2很奇怪 报错位置并不在roi_heads文件,而是在另一个文件,最后保险起见我选择重新下载了0.3。
这里run_voc.sh
文件中我是把每一步分开跑的,上述基本完成了下面这一步。
# ------------------------------- Base Pre-train ---------------------------------- #
python3 main.py --num-gpus 1 --config-file configs/voc/defrcn_det_r101_base${SPLIT_ID}.yaml \
--opts MODEL.WEIGHTS ${IMAGENET_PRETRAIN} \
OUTPUT_DIR ${SAVE_DIR}/defrcn_det_r101_base${SPLIT_ID}
然后接下来我运行了这部分代码
# ------------------------------ Model Preparation -------------------------------- #
python3 tools/model_surgery.py --dataset voc --method remove \
--src-path ${SAVE_DIR}/defrcn_det_r101_base${SPLIT_ID}/model_final.pth \
--save-dir ${SAVE_DIR}/defrcn_det_r101_base${SPLIT_ID}
BASE_WEIGHT=${SAVE_DIR}/defrcn_det_r101_base${SPLIT_ID}/model_reset_remove.pth
这一步没碰到问题,如果有问题一定要检查一下路径,大概率是路径问题。
紧接着是FSRW-like的微调方式
# ------------------------------ Novel Fine-tuning -------------------------------- #
# --> 1. FSRW-like, i.e. run seed0 10 times (the FSOD results on voc in most papers)
for repeat_id in 0 1 2 3 4 5 6 7 8 9
do
for shot in 1 2 3 5 10 # if final, 10 -> 1 2 3 5 10
do
for seed in 0
do
python3 tools/create_config.py --dataset voc --config_root configs/voc \
--shot ${shot} --seed ${seed} --setting 'fsod' --split ${SPLIT_ID}
CONFIG_PATH=configs/voc/defrcn_fsod_r101_novel${SPLIT_ID}_${shot}shot_seed${seed}.yaml
OUTPUT_DIR=${SAVE_DIR}/defrcn_fsod_r101_novel${SPLIT_ID}/fsrw-like/${shot}shot_seed${seed}_repeat${repeat_id}
python3 main.py --num-gpus 8 --config-file ${CONFIG_PATH} \
--opts MODEL.WEIGHTS ${BASE_WEIGHT} OUTPUT_DIR ${OUTPUT_DIR} \
TEST.PCB_MODELPATH ${IMAGENET_PRETRAIN_TORCH}
rm ${CONFIG_PATH}
rm ${OUTPUT_DIR}/model_final.pth
done
done
done
python3 tools/extract_results.py --res-dir ${SAVE_DIR}/defrcn_fsod_r101_novel${SPLIT_ID}/fsrw-like --shot-list 1 2 3 5 10 # surmarize all results
这个微调方式的配置是fsod的,这里基本上也没有问题,注意路径!