def main(_):
    sess = tf.Session()
    print('---Prepare data...')

    ### YOUR CODE HERE
    #data_dir = "/content/drive/My Drive/Colab Notebooks/code/HW3/data/"
    data_dir = "/content/drive/My Drive/data"
    ### END CODE HERE

    x_train, y_train, x_test, y_test = load_data(data_dir)
    x_train_new, y_train_new, x_valid, y_valid = train_valid_split(
        x_train, y_train)

    model = Cifar(sess, configure())

    ### YOUR CODE HERE
    # First step: use the train_new set and the valid set to choose hyperparameters.
    #model.train(x_train_new, y_train_new, 200)
    #model.test_or_validate(x_valid, y_valid, [10,20,30,40,50,100,150,200])

    # Second step: with hyperparameters determined in the first run, re-train
    # your model on the original train set.
    # model.train(x_train, y_train, 200)

    # Third step: after re-training, test your model on the test set.
    # Report testing accuracy in your hard-copy report.
    model.test_or_validate(
        x_test, y_test,
        [100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200])
예제 #2
0
def main(_):
    sess = tf.Session()
    print('---Prepare data...')

    ### YOUR CODE HERE
    data_dir = "/home/seizethedty/DATA/cifar-10-batches-py/"
    ### END CODE HERE

    x_train, y_train, x_test, y_test = load_data(data_dir)
    x_train_new, y_train_new, x_valid, y_valid = train_valid_split(
        x_train, y_train)

    model = Cifar(sess, configure())

    ### YOUR CODE HERE
    # First step: use the train_new set and the valid set to choose hyperparameters.
    #model.train(x_train_new, y_train_new, 200)
    #model.test_or_validate(x_valid, y_valid, [140, 150, 160, 170, 180, 190, 200])

    # Second step: with hyperparameters determined in the first run, re-train
    # your model on the original train set.
    #model.train(x_train, y_train, 200)

    # Third step: after re-training, test your model on the test set.
    # Report testing accuracy in your hard-copy report.
    model.test_or_validate(x_test, y_test, [200])
예제 #3
0
def main(_):
    sess = tf.Session()
    print('---Prepare data...')

    ### YOUR CODE HERE
    data_dir = "data/"
    ### END CODE HERE

    x_train, y_train, x_test, y_test = load_data(data_dir)
    x_train_new, y_train_new, x_valid, y_valid = train_valid_split(
        x_train, y_train)

    model = Cifar(sess, configure())

    ### YOUR CODE HERE
    # First step: use the train_new set and the valid set to choose hyperparameters.

    #
    #model.train(x_train_new, y_train_new, 200)
    #model.train(x_train_new, y_train_new, 3)
    #model.test_or_validate(x_valid, y_valid, [160, 170, 180, 190, 200])
    #model.test_or_validate(x_valid, y_valid, [10])

    # Second step: with hyperparameters determined in the first run, re-train
    # your model on the original train set.
    model.train(x_train, y_train, 150)
예제 #4
0
def main(_):

	sess = tf.Session()
	print('---Prepare data...')

	### YOUR CODE HERE
	data_dir = os.path.join(os.path.abspath(os.getcwd()),"ResNet/data")

	### END CODE HERE

	x_train, y_train, x_test, y_test = load_data(data_dir)
	x_train_new, y_train_new, x_valid, y_valid = train_valid_split(x_train, y_train)

	model = Cifar(sess, configure())

	### YOUR CODE HERE
	# First step: use the train_new set and the valid set to choose hyperparameters.
	model.train(x_train_new, y_train_new, 200)
예제 #5
0
파일: main.py 프로젝트: neelg1193/CSCE_636
def main(_):
    sess = tf.Session()
    print('---Prepare data...')

    ### YOUR CODE HERE
    data_dir = '../cifar-10-batches-py'
    ### END CODE HERE

    x_train, y_train, x_test, y_test = load_data(data_dir)
    x_train_new, y_train_new, x_valid, y_valid = train_valid_split(
        x_train, y_train)

    model = Cifar(sess, configure())

    ### YOUR CODE HERE
    # from Network import ResNet
    # network = ResNet(1, 3, 10, 16)
    # ips = tf.placeholder(tf.float32, shape=(100, 32, 32, 3))
    # sess.run(tf.global_variables_initializer())
    # sess.run(tf.local_variables_initializer())
    # net = network(ips,training=True)
    # from tensorflow.keras import Model
    # model = Model(inputs=ips, outputs=net)

    # print(model.summary)
    # # print(sess.run(network(ips,training=True)))
    # writer = tf.summary.FileWriter('output', sess.graph)
    # writer.close()
    # First step: use the train_new set and the valid set to choose hyperparameters.
    # model.train(x_train_new, y_train_new, 200)
    # while True:
    # model.train(x_train_new, y_train_new, 600)
    # model.test_or_validate(x_valid,y_valid,[i*10 for i in range(1,11)])
    # model.test_or_validate(x_valid,y_valid,[20])
    # model.test_or_validate(x_valid, y_valid, [160, 170, 180, 190, 200])
    # model.test_or_validate(x_valid,y_valid,[10])

    # Second step: with hyperparameters determined in the first run, re-train
    # your model on the original train set.
    # model.train(x_train, y_train, 200)

    # Third step: after re-training, test your model on the test set.
    # Report testing accuracy in your hard-copy report.
    model.test_or_validate(x_test, y_test, [170])
예제 #6
0
def main(_):
    tf.set_random_seed(1234)
    sess = tf.Session()
    print('---Prepare data...')

    ### YOUR CODE HERE
    data_dir = './'
    ### END CODE HERE

    x_train, y_train, x_test, y_test = load_data(data_dir)
    x_train_new, y_train_new, x_valid, y_valid = train_valid_split(
        x_train, y_train)

    model = Cifar(sess, configure())

    ### YOUR CODE HERE
    # First step: use the train_new set and the valid set to choose hyperparameters.

    # Second step: with hyperparameters determined in the first run, re-train
    # your model on the original train set.
    model.train(x_train, y_train, 50)

    # Third step: after re-training, test your model on the test set.
    # Report testing accuracy in your hard-copy report.
    model.test_or_validate(x_test, y_test, [30, 35, 40, 45, 50])
예제 #7
0
파일: main.py 프로젝트: tiandi111/lake
def main(_):
	sess = tf.Session()
	print('---Prepare data...')

	### YOUR CODE HERE
	data_dir = "/Users/tiandi03/Desktop/dataset/cifar-10-batches-py"
	### END CODE HERE

	x_train, y_train, x_test, y_test = load_data(data_dir)
	x_train_new, y_train_new, x_valid, y_valid = train_valid_split(x_train, y_train)
	model = Cifar(sess, configure())

	### YOUR CODE HERE
	# First step: use the train_new set and the valid set to choose hyperparameters.
	model.train(x_train_new, y_train_new, 200)
	model.test_or_validate(x_valid, y_valid, [160, 170, 180, 190, 200])
예제 #8
0
def main(_):
    sess = tf.Session()
    print('---Prepare data...')

    ### YOUR CODE HERE
    # Download cifar-10 dataset from https://www.cs.toronto.edu/~kriz/cifar.html
    data_dir = "cifar-10-batches-py"
    ### END CODE HERE

    x_train, y_train, x_test, y_test = load_data(data_dir)
    x_train_new, y_train_new, x_valid, y_valid = train_valid_split(
        x_train, y_train)

    model = Cifar(sess, configure())

    ### YOUR CODE HERE
    model.train(x_train, y_train, 40)
    model.test_or_validate(x_test, y_test, [5, 10, 15, 20, 25, 30, 35, 40])