This repo is for the python implementation of OBBStacking: An Ensemble Method for Remote Sensing Object Detection, an learned ensemble method compatible with oriented bounding boxes (OBB) for the object detection problems. This ensemble method helps us win 1st place in the challenge track Fine-grained Object Recognition in High-Resolution Optical Images, which was featured in 2021 Gaofen Challenge on Automated High-Resolution Earth Observation Image Interpretation
2022/10/11
Dota data format is supported now.
--image_glob_url
argmument is removed.
2022/09/30
First version released, only FAIR1M data format (results and labels stored in xmls) supported for now.
pip install -r requirements.txt
FAIR1M is a new dataset released alongside the 2021 Gaofen Challenge. Go to https://www.gaofen-challenge.com/benchmark for more details. It also has a published article at ISPRS.
For FAIR1M data format, assume such folder structure for results from both the validation set and the test set:
result_root_dir/
├── model_1_val/
│ └── test/
│ ├── 1.xml
│ ├── 2.xml
│ └── ...
├── model_2_val/
│ └── test/
│ ├── 1.xml
│ ├── 2.xml
│ └── ...
├── model_1_test/
│ └── test/
│ ├── 1.xml
│ ├── 2.xml
│ └── ...
├── model_2_test/
│ └── test/
│ ├── 1.xml
│ ├── 2.xml
│ └── ...
└── ...
To train the meta-learner, use the command below. Make sure to use the results from the validation set.
Note that parameter output_name
should point to the folder of the groundtruth xmls.
The learned meta-learner will be saved to weights_url
python obbstacking.py --root_dir result_root_dir --input_names model_1_val model_2_val --output_name /path/to/ground/truth/folder/ --mode train --format FAIR --weights_url "weight.pkl"
To ensemble the test results, use the command below. Make sure to use the results from the test set.
The ensemble results will be saved in the folder output_name
under the root_dir
folder.
python obbstacking.py --root_dir result_root_dir --input_names model_1_test model_2_test --output_name "ensemble_result" --mode test --format FAIR --weights_url "weight.pkl"
For DOTA data format, we assume a similar data structure as FAIR and use similar commands. The only changes are listed below:
- Change --format argmument in both commands from "FAIR" to "DOTA"
- The results for DOTA are stored in txt files instead of xml files, the folder structure is like the below table:
result_root_dir/
├── model_1_val/
│ └── test/
│ ├── Task1_baseball-diamond.txt
│ ├── Task1_basketball-court.txt
│ └── ...
├── model_2_val/
│ └── test/
│ ├── Task1_baseball-diamond.txt
│ ├── Task1_basketball-court.txt
│ └── ...
├── model_1_test/
│ └── test/
│ ├── Task1_baseball-diamond.txt
│ ├── Task1_basketball-court.txt
│ └── ...
├── model_2_test/
│ └── test/
│ ├── Task1_baseball-diamond.txt
│ ├── Task1_basketball-court.txt
│ └── ...
└── ...
Please cite my article if you find the code or method helpful.
@article{lin2023obbstacking,
title={OBBStacking: An Ensemble Method for Remote Sensing Object Detection},
author={Lin, Haoning and Sun, Changhao and Liu, Yunpeng},
journal={IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing},
volume={16},
pages={2112--2120},
year={2023},
publisher={IEEE}
}