Classifying radio galaxies as Fanaroff-Riley Type I (FR-I) and Fanaroff-Riley Type II (FR-II).
You will need
- The data used in https://arxiv.org/pdf/1705.03413.pdf. This is stored in
asu.tsv
.
- Run
fri-frii-download.ipynb
to download all FRI/FRII samples in fri-cat, frii-cat, and FIRST. Data will be stored asdata.h5
in (current_directory/data/data.h5) - Use the get_data function from
format_data.py
to generate the training and testing data indices fromdata.h5
andasu.tsv
. - Open
data.h5
asdata
and and use indices to select training and test images fromdata['images']
anddata['labels']
- Use the
data_gen
function informat_data.py
to construct the data generator. - Instantiate the
HOGNnet
and/orSklearnModel
frommodels.py
. Both takedatagen
andseed
as arguments.SklearnModel
takes additional arguments likeModel
(the sklearn classifier being used),nb_augment
(factor data is increased via augmentations), as well as any number of parameters specific toModel
.HOGNnet
takesbatch_size
,steps_per_epoch
,max_epoch
, andpatience
as additional arguments. - Use the
fit
method to train the model. Both havetrain_x
andtrain_y
as inputs. - Optional: If training times are long or you want to store your trained model, use the save method to save the model to disk (
SklearnModel
as a.pk
file andHOGnet
as a.h5
file) - Optional: Load model from disk with the
load
method. - Use
predict
method to predict class labels andpredict_proba
class probabilities for unseen samples (test_x
).
A working example can be found at example_usage.ipynb
.