<!-- ### Hi there 👋 -->

# Revisiting Open World Object Detection [[arXiv]](https://arxiv.org/abs/2201.00471)

## Installation
See [INSTALL.md](INSTALL.md).

## Dataset
Our new data division is based on COCO2017. We divide the training set into four tasks, in which each task has 20 categories. For each task, we obtained images containing the categories of each task from the training set, and removed the annotation information of other categories in these pictures during training.  In each task, 1000 images are sampled as the validation set. And we de duplicate the training set and the  validation set.
For the testing set, we adopt the validation set of COCO2017, which contains relatively complete annotation information.

The data files are at [./datasets/Main/](./datasets/Main/).
<!-- And the codes for creating these files are at [datasets/coco_utils](datasets/coco_utils) -->

## Train
Train with PAD:

The PAD module is implemented in [./detectron2/modeling/roi_heads/roi_heads.py](./detectron2/modeling/roi_heads/roi_heads.py),where the file generated by selective search needs to be loaded. The code that generates these files is in the [./datasets/save_selective_search.py](./datasets/save_selective_search.py).




## Inference
Inference with CEC
```
python tools/train_net.py --num-gpus 3\
                          --eval-only --config-file ./configs/OWOD/t1/t1_test.yaml \
                          SOLVER.IMS_PER_BATCH 6 SOLVER.BASE_LR 0.005 \
                          OUTPUT_DIR "./output/t1/test_dir/" \
                          MODEL.WEIGHTS "/Path/To/Your/Model" \
                          OWOD.GENERATE_CALI False \
                          OWOD.CALI_PATH "/home/RE-OWOD-main/analysis/t1_REOWOD_train_scores_cali_07" \
                          OWOD.UNK_THRESH 0.6
```

Inference without CEC
```
python tools/train_net.py --num-gpus 3\
                          --eval-only --config-file ./configs/OWOD/t1/t1_test.yaml \
                          SOLVER.IMS_PER_BATCH 6 SOLVER.BASE_LR 0.005 \
                          OUTPUT_DIR "./output/t1/test_dir/" \
                          MODEL.WEIGHTS "/Path/To/Your/Model" \
                          OWOD.GENERATE_CALI True
```

If you want to generate CEC pickle file with train datasets, you need to repalce "./detectron2/evaluation/evaluator.py" with "./detectron2/evaluation/evaluator_cali.py".
Remember to add current stage to CEC pickle files' name in "./detectron2/evaluation/evaluator_cali.py".
```
python tools/train_net.py --num-gpus 3\
                          --eval-only --config-file ./configs/OWOD/t1/t1_test.yaml \
                          SOLVER.IMS_PER_BATCH 6 SOLVER.BASE_LR 0.005 \
                          OUTPUT_DIR "./output/t1/test_dir/" \
                          MODEL.WEIGHTS "/Path/To/Your/Model" \
                          OWOD.GENERATE_CALI True
```


<!-- 
## Citation

If you use our work in your research please cite us: -->



<!--
**RE-OWOD/RE-OWOD** is a ✨ _special_ ✨ repository because its `README.md` (this file) appears on your GitHub profile.

Here are some ideas to get you started:

- 🔭 I’m currently working on ...
- 🌱 I’m currently learning ...
- 👯 I’m looking to collaborate on ...
- 🤔 I’m looking for help with ...
- 💬 Ask me about ...
- 📫 How to reach me: ...
- 😄 Pronouns: ...
- ⚡ Fun fact: ...
-->
