## Reproducing our results

### 1. Learning masks  
Train the mask tokens with the code provided in `mmdetection` folder. Please check [mmdetection/README.md](mmdetection/README.md) for detailed instructions.


### 2. Train students with learned masks 
Modify the `pretrained` parameter of `MasKDLoss` in config files (`mmrazor/configs/distill/maskd`) to your learned mask token checkpoints.

For environment setup, please see [mmrazor/README.md](mmrazor/README.md).

**Train student:**  
```shell
cd mmrazor
sh tools/mmdet/dist_train_mmdet.sh ${CONFIG} 8 ${WORK_DIR}
```

Example for reproducing our `cascade_mask_rcnn_x101-fpn_r50` result:
```shell
sh tools/mmdet/dist_train_mmdet.sh configs/distill/maskd/cascade_mask_rcnn_x101-fpn_x50_coco.py 8 work_dirs/maskd_cmr_x101-fpn_x50
```