AdelaiDet is an open source toolbox for multiple instance-level recognition tasks on top of Detectron2. All instance-level recognition works from our group are open-sourced here.
首先需要安装detectron2,参照install.md。注意,目前还不能和最新的版本适配。
Please use Detectron2 with commit id 9eb4831 for now. The incompatibility with the latest one will be fixed soon.
在issue中查阅问题后,需要一下命令:
git clone https://github.com/facebookresearch/detectron2.git cd detectron2 git checkout -f 9eb4831 cd .. python -m pip install -e detectron2 git clone https://github.com/aim-uofa/AdelaiDet.git cd AdelaiDet python setup.py build develop先使用预训练的权重模型测试一下。
python demo/demo.py \ --config-file configs/FCOS-Detection/R_50_1x.yaml \ --input input1.jpg input2.jpg \ --opts MODEL.WEIGHTS fcos_R_50_1x.pth训练自己的模型,与detectron2相同,见dataset.md,数据集都需要转化为COCO,VOC等的格式以及文件的摆放路径要一致。(AdelaiDet默认的yaml文件貌似都是coco格式的,需要转化一下)。
$DETECTRON2_DATASETS/ coco/ lvis/ cityscapes/ VOC20{07,12}/
coco/ annotations/ instances_{train,val}2017.json person_keypoints_{train,val}2017.json {train,val}2017/ # image files that are mentioned in the corresponding json
cd AdelaiDet OMP_NUM_THREADS=1 python tools/train_net.py \ --config-file configs/FCOS-Detection/R_50_1x.yaml \ --num-gpus 8 \ OUTPUT_DIR training_dir/fcos_R_50_1x #OUTPUT_DIR 训练模型的保存路径 #config-file 使用的超参配置文件To evaluate the model after training, run:
OMP_NUM_THREADS=1 python tools/train_net.py \ --config-file configs/FCOS-Detection/R_50_1x.yaml \ --eval-only \ --num-gpus 8 \ OUTPUT_DIR training_dir/fcos_R_50_1x \ MODEL.WEIGHTS training_dir/fcos_R_50_1x/model_final.pth # MODEL.WEIGHTS .pth文件可以用来测试 另外可以在对应的保存文件中查看log.txt 日志