Beispiel #1
0
                              nb_dense_block=nb_dense_block,
                              growth_rate=growth_rate,
                              nb_filter=nb_filter,
                              dropout_rate=dropout_rate,
                              weights=None)
    print('Model created')
    model.summary()

    model.load_weights('densenet-filter20.hdf5', by_name=True)
    
    model.compile(loss='categorical_crossentropy',
                  optimizer=Adam(lr=1e-3),
                  metrics=['accuracy'])
    print('Model compiled')

    x = resource.load_train_x(t=30)
    y = resource.load_train_y()
    (trainX, testX) = (x[:int(50000 * 0.9)], x[int(50000 * 0.9):])
    (trainY, testY) = (y[:int(50000 * 0.9)], y[int(50000 * 0.9):])
    trainX = trainX.astype('float32')
    testX = testX.astype('float32')
    mean_image = np.mean(trainX, axis=0)
    trainX -= mean_image
    testX -= mean_image
    trainX /= 128.0
    testX /= 128.0
    trainY = np_utils.to_categorical(trainY, nb_classes)
    testY = np_utils.to_categorical(testY, nb_classes)

    generator = ImageDataGenerator(rotation_range=15,
                                   width_shift_range=5./64,
Beispiel #2
0
                              nb_dense_block=nb_dense_block,
                              growth_rate=growth_rate,
                              nb_filter=nb_filter,
                              dropout_rate=dropout_rate,
                              weights=None)
    print('Model created')
    model.summary()

    model.load_weights('densenet-filter200.hdf5', by_name=True)

    model.compile(loss='categorical_crossentropy',
                  optimizer=Adam(lr=1e-3),
                  metrics=['accuracy'])
    print('Model compiled')

    x = resource.load_train_x(t=255)
    y = resource.load_train_y()
    (trainX, testX) = (x[:int(50000 * 0.9)], x[int(50000 * 0.9):])
    (trainY, testY) = (y[:int(50000 * 0.9)], y[int(50000 * 0.9):])
    trainX = trainX.astype('float32')
    testX = testX.astype('float32')
    mean_image = np.mean(trainX, axis=0)
    trainX -= mean_image
    testX -= mean_image
    trainX /= 128.0
    testX /= 128.0
    trainY = np_utils.to_categorical(trainY, nb_classes)
    testY = np_utils.to_categorical(testY, nb_classes)

    generator = ImageDataGenerator(rotation_range=15,
                                   width_shift_range=5. / 64,
Beispiel #3
0
    img_rows, img_cols = 64, 64
    img_channels = 1

    img_dim = (img_channels, img_rows, img_cols)

    model = resnet.ResnetBuilder.build_resnet_50(img_dim, nb_classes)
    print('Model created')
    model.summary()

    model.compile(loss='categorical_crossentropy',
                  optimizer=Adam(lr=1e-3),
                  metrics=['accuracy'])
    print('Model compiled')

    x = resource.load_train_x()
    y = resource.load_train_y()
    (trainX, testX) = (x[:int(50000 * 0.9)], x[int(50000 * 0.9):])
    (trainY, testY) = (y[:int(50000 * 0.9)], y[int(50000 * 0.9):])
    trainX = trainX.astype('float32')
    testX = testX.astype('float32')
    mean_image = np.mean(trainX, axis=0)
    trainX -= mean_image
    testX -= mean_image
    trainX /= 128.0
    testX /= 128.0
    trainY = np_utils.to_categorical(trainY, nb_classes)
    testY = np_utils.to_categorical(testY, nb_classes)

    generator = ImageDataGenerator(rotation_range=15,
                                   width_shift_range=5. / 64,
Beispiel #4
0
                              nb_dense_block=nb_dense_block,
                              growth_rate=growth_rate,
                              nb_filter=nb_filter,
                              dropout_rate=dropout_rate,
                              weights=None)
    print('Model created')
    model.summary()

    model.load_weights('densenet-filter70.hdf5', by_name=True)

    model.compile(loss='categorical_crossentropy',
                  optimizer=Adam(lr=1e-3),
                  metrics=['accuracy'])
    print('Model compiled')

    x = resource.load_train_x(t=100)
    y = resource.load_train_y()
    (trainX, testX) = (x[:int(50000 * 0.9)], x[int(50000 * 0.9):])
    (trainY, testY) = (y[:int(50000 * 0.9)], y[int(50000 * 0.9):])
    trainX = trainX.astype('float32')
    testX = testX.astype('float32')
    mean_image = np.mean(trainX, axis=0)
    trainX -= mean_image
    testX -= mean_image
    trainX /= 128.0
    testX /= 128.0
    trainY = np_utils.to_categorical(trainY, nb_classes)
    testY = np_utils.to_categorical(testY, nb_classes)

    generator = ImageDataGenerator(rotation_range=15,
                                   width_shift_range=5. / 64,