Beispiel #1
0
    trainer = unet.Trainer(net,
                           optimizer="momentum",
                           opt_kwargs=dict(momentum=0.2))
    path = trainer.train(dp,
                         model_dir,
                         training_iters=training_iters,
                         epochs=epochs,
                         dropout=0.5,
                         display_step=1000000)

else:

    test_files = sorted(glob.glob('../data/data/test/*.h5'))

    pred_dir = 'predictions/unet_' + str(features_root) + '/'
    rfc.ch_mkdir(pred_dir)
    res_file = 'results/unet_' + str(features_root) + '_' + str(threshold)
    rfc.ch_mkdir('results')

    times = []
    pr_list = []
    roc_list = []
    auc_list = []

    clrs = ['b', 'r', 'g', 'k']
    trsh = np.linspace(1, 0, 300, endpoint=1)

    for fil in test_files:

        fname = fil.split('/')[-1]
        dp = rfc.DataProvider(a_min=0,
Beispiel #2
0
                      one_hot=1,
                      thresholds=thresholds,
                      th_labels=th_labels,
                      a_min=0, a_max=200)

_,nx,ny,nc = dp(1)[1].shape
print(dp(1)[1].shape)

conv = rfc.ConvolutionalLayers(nx=nx,ny=ny,n_channel=1,n_class=nc,
                               restore=os.path.exists(model_add),
                               model_add=model_add,
                               arch_file_name=arch)


res_file = 'results/threeclass_'+arch+'_'+mode
rfc.ch_mkdir('results')
rfc.ch_mkdir('predictions')
pred_dir = 'predictions/'

times = []
cnf_matrix = []

for fil in test_files:

    fname = fil.split('/')[-1]
    dp = rfc.DataProvider(files=[fil],label_name='RFI',
                  one_hot=1,
                  thresholds=thresholds,
                  th_labels=th_labels,
                  a_min=0, a_max=200)
    data,mask = dp(1)
Beispiel #3
0
        conv.train(data_provider=dp,
                   training_epochs=10000000,
                   n_s=n_rounds,
                   learning_rate=learning_rate,
                   dropout=0.7,
                   time_limit=time_limit // n_rounds,
                   verbose=1)
        learning_rate = learning_rate / 4.

else:
    import pickle

    #    pred_dir = 'predictions/threeclass_'+arch+'_'+mode+'/'
    #    rfc.ch_mkdir(pred_dir)
    res_file = 'results/threeclass_' + arch + '_' + mode
    rfc.ch_mkdir('results')

    #    weights = conv.get_filters()
    #    with open(res_file+'_filters', 'w') as filehandler:
    #        pickle.dump(weights, filehandler)
    #    np.save(res_file+'_filters',weights)

    test_files = sorted(
        glob.glob('../../../data/hide_sims_test/calib_1month/*.fits'))

    times = []
    pr_list = []
    roc_list = []
    auc_list = []
    cnf_matrix = []
Beispiel #4
0
import matplotlib as mpl

mpl.use('agg')

import os
import glob
import numpy as np
import pylab as plt
from matplotlib.colors import LogNorm
import rficnn as rfc

dss = ['training', 'validation', 'test']

rfc.ch_mkdir('plots')

for ds in dss:
    test_files = sorted(glob.glob('../../../data/kat7/dataset/' + ds +
                                  '/*.h5'))

    for fil in test_files:

        fname = fil.split('/')[-1]
        dp = rfc.DataProvider(a_min=0,
                              a_max=100,
                              files=[fil],
                              label_name='mask')
        data, mask = dp(1)

        mask = mask[0, :, :, 0]

        fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(12, 8))