We use detectron2 to train the object detection models.
-
Install detectron2.
-
Put dataset under "benchmarks/detection/datasets" directory, following the directory structure requried by detectron2.
-
Convert the pre-trained backbone weights to detectron2's format:
cd benchmarks/detection WEIGHT_FILE=../../work_dirs/selfsup/densecl/densecl_coco_800ep/extracted_densecl_coco_800ep.pth OUTPUT_FILE=extracted_densecl_coco_800ep.pkl python convert-pretrain-to-detectron2.py ${WEIGHT_FILE} ${OUTPUT_FILE}
-
Start training:
DET_CFG=configs/pascal_voc_R_50_C4_24k_moco.yaml bash run.sh ${DET_CFG} ${OUTPUT_FILE} output/run_1_voc_R_50_C4_24k_densecl_coco_800ep
We use mmsegmentation to train the semantic segmentation models.
-
Clone and install our modified mmsegmentation.
-
Prepare the datasets according to dataset_prepare.md.
-
Modify the pretrained model path in config.
-
Start training (here we use Cityscapes for example):
CONFIG_FILE=configs/densecl/fcn_r50-d8_769x769_40k_cityscapes.py GPUS=4 OUTPUT_DIR=models/fcn_r50-d8_769x769_40k_cityscapes_densecl_coco_800ep ./tools/dist_train.sh ${CONFIG_FILE} ${GPUS} --work-dir ${OUTPUT_DIR}