ClaRAN - Classifying Radio Galaxies Automatically with Neural Networks
As an upgrade of the ClaRAN v0.1, ClaRAN v0.2 is based on the awesome Tensorpack project, which is likely the best-performing open source TensorFlow reimplementation of Faster R-CNN. Moreover, Tensorpack has integrated the Feature Pyramid Networks for Object Detection (FPN). It also supports instance segmentation based on Mask R-CNN, although ClaRAN v0.2 currently does not support source segmentation.
In summary, ClaRAN v0.2 includes the following new features:
- The default "backbone" network is now ResNet50.
- By default, FPN is used for multi-scale feature extraction
- We further extended the image augmentation pipeline to support rotations (of both images and bounding boxes of sources) "on the fly"
With the above changes, ClaRAN has achieved an mAP of 86.1% for D3 (83% for v0.1) and 85.9% for D1 (79% for v0.1). The D3 dataset overlays radio contours onto Infrared maps, whereas the D1 dataset contains radio maps only.
- Python 3.5+; OpenCV
- TensorFlow โฅ 1.5 but < 2.0
- TensorPack:
pip install --upgrade git+https://github.com/tensorpack/tensorpack.git
- pycocotools:
pip install pycocotools
- Pre-trained ImageNet ResNet50 model from tensorpack model zoo
- (Optional) Pre-trained ClaRAN v0.2 RGZ D3 model
- RGZ data, which needs to be organised as the following directory structure:
RGZ/DATA_DIR/
annotations/
instances_trainD3.json
instances_testD3.json
trainD3_hg/
FIRSTJ23*_infraredct.png
testD3_hg/
FIRSTJ23*_infraredct.jpg
This is tested on both in-house GPU nodes and the Google Colab environment
python train.py --logdir ../train_logs/ --config \
MODE_MASK=False MODE_FPN=True \
DATA.BASEDIR=./data \
BACKBONE.WEIGHTS=./weights/pretrained/ImageNet-R50-AlignPadding.npz \
DATA.TRAIN=trainD3_hg DATA.VAL=testD3_hg \
PREPROC.TRAIN_SHORT_EDGE_SIZE=600,600 \
PREPROC.TEST_SHORT_EDGE_SIZE=600 \
TRAIN.LR_SCHEDULE=20000,30000,40000
To detect all radio sources on a D3 image (needs DISPLAY to show the outputs):
python train.py --predict ./data/testD3_hg/FIRSTJ235752.4+101110_infraredct.png \
--load ./weights/rgz_models/d3/model-70000.data-00000-of-00001 \
--config MODE_MASK=False MODE_FPN=True \
DATA.BASEDIR=./data \
BACKBONE.WEIGHTS=../weights/pretrained/ImageNet-R50-AlignPadding.npz \
DATA.TRAIN=trainD3_hg DATA.VAL=testD3_hg \
PREPROC.TRAIN_SHORT_EDGE_SIZE=600,600 \
PREPROC.TEST_SHORT_EDGE_SIZE=600 \
TEST.RESULT_SCORE_THRESH_VIS=0.7 \
TEST.RESULT_SCORE_THRESH=0.7 \
If the DISPLAY is not set, it will produce an PNG image under the current directory:
On the left is the original D3 image, and the detected sources are shown on the right.
Notice that the --load
argument loads the pre-trained D3 model (470 MB) that can also be downloaded if you want to skip the training (A couple of hours using four P100 GPUs) altogether.
Some result comparisons between different methods and architectures will be posted here hopefully soon.