This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def load_from_dir(imgs_dir, height, width): | |
| img_names = os.listdir(imgs_dir) | |
| res = [] | |
| filenames = [] | |
| for img_name in img_names: | |
| if img_name == '.DS_Store': continue | |
| img_dir = imgs_dir + '/' + img_name | |
| x = image.load_img(img_dir, target_size=(height, width)) | |
| x = image.img_to_array(x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from __future__ import print_function | |
| from tensorflow.examples.tutorials.mnist import input_data | |
| mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) | |
| import tensorflow as tf | |
| def weight_variable(shape): | |
| initial = tf.truncated_normal(shape, stddev=0.1) | |
| return tf.Variable(initial) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tensorflow as tf | |
| import numpy as np | |
| import uuid | |
| x = tf.placeholder(shape=[None, 3], dtype=tf.float32) | |
| nn = tf.layers.dense(x, 3, activation=tf.nn.sigmoid) | |
| nn = tf.layers.dense(nn, 5, activation=tf.nn.sigmoid) | |
| encoded = tf.layers.dense(nn, 2, activation=tf.nn.sigmoid) | |
| nn = tf.layers.dense(encoded, 5, activation=tf.nn.sigmoid) | |
| nn = tf.layers.dense(nn, 3, activation=tf.nn.sigmoid) |