Exemplo n.º 1
0
def main():
    if not os.path.isfile('X_train.npy'):
        X, y = io.load_pictures('../../data/characters/', True)
        X_train, X_test, y_train, y_test = io.split_data(X, y, 85)
        io.write_data_to_file(X_train, X_test, y_train, y_test)
    else:
        X_train, X_test, y_train, y_test = io.load_data_from_file()

    #Train and test
    run_train_and_test(X_train, X_test, y_train, y_test)
Exemplo n.º 2
0
def main():
	if not os.path.isfile('X_train.npy'):
		X,y = io.load_pictures('../../data/characters/', True)
		X_train, X_test, y_train, y_test = io.split_data(X, y, 85)
		io.write_data_to_file(X_train, X_test, y_train, y_test)
	else:
		X_train, X_test, y_train, y_test = io.load_data_from_file()
	
	logging.getLogger().setLevel(logging.DEBUG) 
	batch_size = 10
	
	print "\n start train autoencoder 1..."
	autoencoder1 = autoencoder_one(X_train, batch_size)
	input_for_autoencoder2 = forward_autoencoder_one(autoencoder1, X_train)
	print "\n start train autoencoder 2..."
	autoencoder2 = autoencoder_two(input_for_autoencoder2, batch_size)
	print " \n start train fcnn ..."
	run_train_and_test_fcnn(X_train, X_test, y_train, y_test, batch_size, autoencoder1, autoencoder2)
Exemplo n.º 3
0
def main():
    get_model('http://data.mxnet.io/models/imagenet/resnet/18-layers/resnet-18', 0)
    sym, arg_params, aux_params = mx.model.load_checkpoint('resnet-18', 0)
    #print (sym.get_internals())
    
    batch_size = 10
    num_classes = 18
    
    if not os.path.isfile('X_train.npy'):
        X,y = io.load_pictures('characters/', True)
        X_train, X_test, y_train, y_test = io.split_data(X, y, 85)
        io.write_data_to_file(X_train, X_test, y_train, y_test)
    else:
        X_train, X_test, y_train, y_test = io.load_data_from_file()
    
    train_iter, val_iter = get_iterators(X_train, y_train, X_test, y_test, batch_size)

    mod_score = fit(sym, train_iter, val_iter, batch_size)
    print (mod_score)