def _test_dataset(): import sflow.py as py data = dataset_testA(16) for d in tf.feeds(data): py.imshow(d) if not py.plot_pause(): break
def _test_dataset(): import sflow.py as py data = dataset_valB(16) for d in tf.feeds(data): py.imshow([d.A, d.B]) if not py.plot_pause(): break
def _test_dataset(): import sflow.py as py data = dataset_trainA(16) with tf.feeding() as (sess, coord): while not coord.should_stop(): py.plt.imshow(data.eval()) if not py.plot_pause(): break
x_train = _resize_mnist_image(x_train, size) x_test = _resize_mnist_image(x_test, size) np.savez(f, x_train=x_train, y_train=y_train, x_test=x_test, y_test=y_test) return (x_train, y_train), (x_test, y_test) else: return _load_numpy(f) def _load_data(size=(28, 28), folder=None): folder = folder or _asset_folder() f = os.path.join(folder, 'mnist.npz') url = 'http://s3.amazonaws.com/img-datasets/mnist.npz' py.download_if_not(url, f) return _load_resized_local(folder, size) if __name__ == '__main__': data = dataset_train(16, (7, 7)) for d in tf.feeds(data): py.imshow(d.image) print(d.label) if not py.plot_pause(): break