Home

Awesome

OnlyPlanes: Incrementally Tuning Synthetic Training Datasets for Satellite Object Detection

Project Links: [Paper] [Project Page] [Video] [Blog]

Abstract: This paper addresses the challenge of solely using synthetic data to train and improve computer vision models for detecting airplanes in satellite imagery by iteratively tuning the training dataset. The domain gap for computer vision algorithms remains a continued struggle to generalize when learning only from synthetic images and produce results comparable to models learning from real images. We present OnlyPlanes, a synthetic satellite image training dataset of airplanes in a top-view that contains 12,500 images, 132,967 aircraft instances, with 80 fine grain attributes. We detail the synthetic rendering process to procedurally-generate and render training images and introduce the synthetic learning feedback loop that iteratively finetunes the training dataset to improve model performance. Experiments show the prior performance degradations and false positives when testing the model on real-world images were corrected when incrementally incorporating new features to the training dataset such as diverse plane formations and altitude variations. We demonstrate the promising future for continually improving models by tuning the synthetic training data developed in an iterative fashion to effectively close the synthetic to real domain gap. The OnlyPlanes dataset, source code and trained models are available at https://github.com/naivelogic/OnlyPlanes.

Example Inference Results from OnlyPlanes Models tested on Real-World Datasets

Dataset Overview

OnlyPlanes is a small dataset (less than 50k images and less than 20GB in weight) for airplane object and instant segmentation computer vision task from satellite imagery.

DatasetSizeDescription
OnlyPlanes.zip14.8 GBTraining
binary_plane_annotations.json1.57 GBLabels
civil_role_annotations.json506.43 MBLabels
Bing2D_Empty.zip531.8 MBTraining
Bing2Dempty_annotations.json0.137 MBLabels
<details> <summary>Dataset Description</summary> The OnlyPlanes dataset contains 12,500 images and 132,967 instance objects consisting of four categories (plane, jumbo jet, military, helicopter) with 80 fine-grain attributes that define the plane model (e.g., Boeing 737). A single training dataset is provided for both object detection and instance segmentation tasks at 1024x1024 image resolution using ten different airport.

</details>

Models Overview

The training methodology implemented involved a Faster-RCNN and a Mask-RCNN model solely trained on the OnlyPlanes synthetic dataset. The Faster-RCNN model is used for object detection and the Mask-RCNN model is used for instance segmentation.

NameModel Zoo ConfigTrained ModelTrain Config
OnlyPlanes Object Detectionfaster_rcnn_R_50_FPN_3xonlyplanes_faster_rcnn_r50-0034999.pthconfig.yaml
OnlyPlanes Instance Segmentationmask_rcnn_R_50_FPN_3xonlyplanes_mask_rcnn_r50-0054999.pthconfig.yaml

Benchmarking

To evaluate the performance of OnlyPlanes we tested the performance on detecting airplanes in other notable datasets. Benchmark datasets include: RarePlanes Real Test, DIOR Test, iSAID Val, and NWPU VHR-10.

Benchmark DatasetmAPmAP50AROnlyPlanes Model
RarePlanes59.1091.1065.40Faster R-CNN
NWPU VHR1073.6698.3278.90Faster R-CNN
NWPU VHR1042.5398.2547.61Mask R-CNN
DIOR48.5682.7357.48Faster R-CNN
iSAID46.4868.9953.89Faster R-CNN
iSAID20.5657.7430.25Mask R-CNN
<details> <summary>Download and Prepare Benchmark Datasets</summary>

To test the performance of the model the below benchmark datasets were used.

Here is the file structure used for these benchmark datasets

Benchmark Datasets
├── data
│   ├── dior
│   │   ├── Annotations
│   │   ├── ImageSets
│   │   ├── JPEGImages-test
│   │   └── JPEGImages-trainval
│   ├── rareplanes
│   │   └── real
|   │       ├── metadata_annotations
|   |       │   ├── instances_test_aircraft.json
|   |       │   └── instances_test_role.json
|   │       └── test
|   |           └── PS-RGB_tiled
│   ├── isaid
│   │   ├── annotations
│   │   |   ├── instances_val.json  # original - not used
|   │   │   └── val_binary_plane_coco_annotations_ALL.json # used for benchmarking
│   │   └── val
    └── nwpu_vhr10
        ├── ground truth
        └── positive image set
</details>

Getting Started

This step we install all the necessary dependencies to train an object detector on a local machine. For this workshop we will be utilizing detectron2 that runs on PyTorch as the framework for training DNNs. Quick start

<details> <summary>Usage: Local vs AML</summary> For this repository to simplify the usage, we will provide the code from a local computational perspective. In the paper, we utilized Azure Machine Learning for training and evaluating the performance of the models. Additionally, in the paper all data was stored on an Azure blob container. While Azure ML is great for scaling compute intensive workloads, as long as you meet the requirements below a single GPU can put utilized to reperform results. </details>

Requirements

<details> <summary>special notes on getting started with requirements</summary> My OS for this project was a ubuntu-18.04 Azure VM with a K8 GPU. I highly recommend using at least one GPU (w/ >20GB of memory) with the correct CUDA installed. Make sure the CUDA, Pytorch and Detectron2 have the correct CUDA version if using GPU. </details>

Usage


This project contains various scripts to reproduce the results in the paper.

Dataset Preparations

Download and unzip the training and evaluation datasets either locally or in an Azure blob container. For each of the zip datasets, contains the coco annotations .json file and images in the data folder. Start by downloading the OnlyPlanes dataset using the following commands:

sudo chmod u+x scripts/01a_download_OnlyPlanes_dataset.sh
sh scripts/01a_download_OnlyPlanes_dataset.sh
<details> <summary>details on the structure of OnlyPlanes Dataset and annotations</summary> The structure of each dataset is as follows:
.
└── OnlyPlanes
    ├── LICENSE.txt
    ├── coco_annotations
    │   ├── all_labels_coco_annotations.json    # all plane labels including fine-grain attributes
    │   ├── binary_plane_coco_annotations.json  # use this for **training on binary planes** 1 class
    │   ├── role_coco_annotations.json          
    │   ├── civil_role_coco_annotations.json    
    │   ├── OnlyPlanes_Role_Counts.csv
    │   └── OnlyPlanes_metadata.csv
    └── images
        ├── 1.png
        └── ...
</details>

Train model on Synthetic OnlyPlanes dataset

OnlyPlanes paper provides an object detection and a segmentation model. You can train the model by yourself or directly use the snapshot provided by us. The following script lets you train them using the configurations defined in the OnlyPlanes paper.

To train the dataset run the following, also update the training config .yaml files as necessary (e.g., number of classes)

conda activate OP

TRAIN_IMG_DIR=/path/to/image/directory         #(e.g., datasets/OnlyPlanes/images)
TRAIN_COCO_JSON=/path/to/coco_annotations.json #(e.g., datasets/OnlyPlanes/coco_ds/OnlyPlanes_binary_plane_annotations.json)

VAL_IMG_DIR=/path/to/image/directory         
VAL_COCO_JSON=/path/to/coco_annotations.json 

OUTPUT_FOLDER=/path/to/output_training_results
TRAINCONFIG=/path/to/training_configs.yaml    #(e.g., configs/frcnn_r50_fpn_demo.yaml)
TRAIN_METHOD=bbox #bbox segm (rotated and obb not supported yet)
python train.py --output-folder $OUTPUT_FOLDER --config-file $TRAINCONFIG \
                --train_img_dir $TRAIN_IMG_DIR --train_coco_json $TRAIN_COCO_JSON \
                --val_img_dir $VAL_IMG_DIR --val_coco_json $VAL_COCO_JSON \
                --train_method $TRAIN_METHOD

Evaluation on real images

The inference.py script has been provided to demo the performance of the trained detector or segmentation on a folder containing test images of real world aircrafts.

INPUT_DIR=/path/to/images
OUTPUT_DIR=/path/to/save/predicted_images
CONF=0.5
USE_GPU=True
CKPT_PATH=/path/to/model/model_final.pth
NUM_IMAGES=2

python inference.py --input_dir ${INPUT_DIR} --output_dir ${OUTPUT_DIR} --conf ${CONF} \
                    --use_gpu ${USE_GPU} --ckpt_path ${CKPT_PATH} --num_images ${NUM_IMAGES}

License

The source code of this repository is released only for academic use. See the license file for details.

Notes

The codes of this repository are built upone the folloiwng open sources. Thanks to the authors for sharing the code!


Citation

If you find this project useful or utilize the OnlyPlanes Dataset for your research, please kindly cite our paper.

@article{hale2022OnlyPlanes,
  title={OnlyPlanes: Incrementally Tuning Synthetic Training Datasets for Satellite Object Detection},
  author={Hale, Phillip and Tiday, Luke and Urbina, Pedro},
  number={arXiv:TBD},
  year={2022}
}