Пример #1
0
import datetime as dt
#
from sklearn.metrics import log_loss
#
import utils
import models
import params

###############################################################################
if __name__ == '__main__':

    np.random.seed(1017)
    target = 'is_iceberg'

    #Load data
    test, test_bands = utils.read_jason(file='test.json', loc='../input/')
    test_X_dup = utils.rescale(test_bands)
    test_meta = test['inc_angle'].values

    tmp = dt.datetime.now().strftime("%Y-%m-%d-%H-%M")
    file_weights = '../weights/weights_current.hdf5'

    if os.path.isfile(file_weights):

        #define and load model
        nb_filters = params.nb_filters
        nb_dense = params.nb_dense
        weights_file = params.weights_file
        model = models.get_model(img_shape=(75, 75, 2),
                                 f=nb_filters,
                                 h=nb_dense)
        out = Lambda(lambda img: ktf.image.resize_images(img, 224, 224))(inp)

    model = Model(input=inp, output=out)
    out = model.predict(images)

    return out


###############################################################################
if __name__ == '__main__':

    np.random.seed(1017)
    target = 'is_iceberg'

    #Load data
    train, train_bands = utils.read_jason(file='train.json')
    test, test_bands = utils.read_jason(file='test.json')

    #target
    train_y = train[target].values
    split_indices = train_y.copy()

    #data set
    train_X = utils.rescale(train_bands)
    train_meta = train['inc_angle'].values
    test_X_dup = utils.rescale(test_bands)
    test_meta = test['inc_angle'].values

    opt_augments = {
        'Flip': False,
        'Rotate': False,