This downstream_mmdet
is isolated from pre-training codes. One can treat this downstream_mmdet
as an independent codebase 🛠️.
Installation MMDetection with commit 6a979e2 before fine-tuning ConvNeXt on COCO
We refer to the codebases of ConvNeXt and Swin-Transformer-Object-Detection. Please refer to README.md for installation and dataset preparation instructions.
Note the COCO dataset folder should be at downstream_mmdet/data/coco
.
The folder should follow the directory structure requried by MMDetection
, which should look like this:
downstream_mmdet/data/coco:
annotations/:
captions_train2017.json captions_val2017.json
instances_train2017.json instances_val2017.json
person_keypoints_train2017.json person_keypoints_val2017.json
train2017/:
a_lot_images.jpg
val2017/:
a_lot_images.jpg
To train a detector with pre-trained models, run:
# single-gpu training
python tools/train.py <CONFIG_FILE> --cfg-options model.pretrained=<PRETRAIN_MODEL> [other optional arguments]
# multi-gpu training
tools/dist_train.sh <CONFIG_FILE> <GPU_NUM> --cfg-options model.pretrained=<PRETRAIN_MODEL> [other optional arguments]
For example, to train a Mask R-CNN model with a SparK pretrained ConvNeXt-B
backbone and 4 gpus, run:
tools/dist_train.sh configs/convnext_spark/mask_rcnn_convnext_base_patch4_window7_mstrain_480-800_adamw_3x_coco_in1k.py 4 \
--cfg-options model.pretrained=/some/path/to/official_convnext_base_1kpretrained.pth
The Mask R-CNN 3x fine-tuning config file can be found at configs/convnext_spark
. This config is basically a copy of https://github.com/facebookresearch/ConvNeXt/blob/main/object_detection/configs/convnext/mask_rcnn_convnext_tiny_patch4_window7_mstrain_480-800_adamw_3x_coco_in1k.py.
# single-gpu testing
python tools/test.py <CONFIG_FILE> <DET_CHECKPOINT_FILE> --eval bbox segm
# multi-gpu testing
tools/dist_test.sh <CONFIG_FILE> <DET_CHECKPOINT_FILE> <GPU_NUM> --eval bbox segm
We appreciate these useful codebases: