mnist

numpy array 数字范围设定

笑着哭i 提交于 2019-12-14 11:58:56
在处理 mnist 数据库,把数据库的数组加一发现,数组范围还是 [0, 255];发现把256的数切片加一等于零? 原来是 mnist 数据库数组的数据类型是 “uint8”,最多256个数,把数据类型改成 “int” 成功使数组加一 mnist = tf . keras . datasets . mnist ( x_train , y_train ) , ( x_test , y_test ) = mnist . load_data ( ) x_train = x_train . reshape ( 60000 , - 1 ) x_test = x_test . reshape ( 10000 , - 1 ) x_train = x_train . astype ( int ) x_train = x_train + 1 x_train . min ( ) x_train . max ( ) 输出 1 256 来源: CSDN 作者: 调羹(勾) 链接: https://blog.csdn.net/weixin_43414981/article/details/103456453

DCGAN-tensorflow使用经历

隐身守侯 提交于 2019-12-14 05:41:39
DCGAN-tensorflow使用经历 原网站:https://github.com/carpedm20/DCGAN-tensorflow 1.使用官方训练集 坑: 命令:python download.py mnist celebA celebA数据库下载,众所周知的原因,需要自己想办法。 mnist在下载好一个文件之后报错,不多说直接留下网盘自己下载 链接:https://pan.baidu.com/s/13FlJTDrV4tAf_vl8N1GzCA 提取码:x7ww 下载之后四个文件 train-images-idx3-ubyte.gz train-labels-idx1-ubyte.gz t10k-images-idx3-ubyte.gz t10k-labels-idx1-ubyte.gz 下载好之后的文件夹关系是: DCGAN-tensorflow-master>data>celebA,mnist celebA>一堆人脸图片 mnist>四个文件 这里又遇到一个坑,解包之后文件名字“-”自动变成“.” 例如:train-images-idx3.ubyte.gz 可能是我使用windows,7z解压的锅。 四个都分别手动改回来例如train-images-idx3-ubyte之后成功。 命令:python main.py --dataset mnist --input

How can I read the MNIST dataset with C++?

冷暖自知 提交于 2019-12-13 12:12:24
问题 I was reading the following question: How to read MNIST data in C++? and there was some C++ code for reading the MNIST database. Upon trying it I found out that it worked fine until the place where it started reading the data. which is the following code: for(int i=0;i<number_of_images;++i) { for(int r=0;r<n_rows;++r) { for(int c=0;c<n_cols;++c) { unsigned char temp=0; file.read((char*)&temp,sizeof(temp)); //cout<<(int)temp<<" "; //printing the pixel in integer format } } } I tried printing

expected dense_218_input to have 2 dimensions, but got array with shape (512, 28, 28, 1)

ε祈祈猫儿з 提交于 2019-12-13 03:26:13
问题 I am trying to augment my MNIST dataset in keras but for some reason its not working. Any help will be appreciated. Part of the code: x_train = x_train.reshape(x_train.shape[0],28, 28,1) x_test = x_test.reshape(x_test.shape[0],28, 28,1) x_train = x_train.reshape(x_train.shape[0],28, 28,1) x_test = x_test.reshape(x_test.shape[0],28, 28,1) datagen = ImageDataGenerator( rotation_range=40, width_shift_range=0.2, height_shift_range=0.2, shear_range=0.2, zoom_range=0.2) model.compile(loss=

Logistic Regression implementation with MNIST - not converging?

放肆的年华 提交于 2019-12-12 17:55:44
问题 I hope someone can help me. I did an implementation of logistic regression from scratch (so without library, except numpy in Python). I used MNIST dataset as input, and decided to try (since I am doing binary classification) a test on only two digits: 1 and 2. My code can be found here https://github.com/michelucci/Logistic-Regression-Explained/blob/master/MNIST%20with%20Logistic%20Regression%20from%20scratch.ipynb The notebook should run on any system that have the necessary library

Keras: Error when downloading Fashion_MNIST Data

南楼画角 提交于 2019-12-12 13:05:06
问题 I am trying to download data from Fashion MNIST, but it produces an error. Originally, it was downloading and working properly, but I had to terminate it because I had to turn off my computer. Once I opened the file up again, it gives me an error. I'm not sure what the problem is, but is it because I already downloaded some parts of the data once, and keras doesn't recognize that? I am using Jupyter notebook in a conda environment Here is the link to the image: https://i.stack.imgur.com/wLGDm

cPickle.UnpicklingError: invalid load key, ' '.?

邮差的信 提交于 2019-12-12 10:55:34
问题 I am trying to use the mnist_data for hand written digit recognition.Now i tried this code to load the data. import cPickle import numpy as np def load_data(): f = open('G:/thesis paper/data sets/mnist.pkl.gz', 'rb') training_data, validation_data, test_data = cPickle.load(f) f.close() return (training_data, validation_data, test_data) def load_data_nn(): training_data, validation_data, test_data = load_data() inputs = [np.reshape(x, (784, 1)) for x in training_data[0]] results = [vectorized

Tensorflow ValueError: Too many vaues to unpack (expected 2)

你离开我真会死。 提交于 2019-12-12 10:01:09
问题 I have looked this up on Reddit, Stack Overflow, tech forums, documentation, GitHub issues etc etc and still can't solve this issue. For reference, I am using Python 3 TensorFlow on Windows 10, 64 Bit. I am trying to use my own dataset (300 pics of cats, 512x512, .png format) in Tensorflow to train it to know what a cat looks like. If this works I will train it with other animals and eventually objects. I can't seem to figure out why I am getting the error ValueError: too many values to

How to put my dataset in a .pkl file in the exact format and data structure used in “mnist.pkl”?

試著忘記壹切 提交于 2019-12-12 09:59:30
问题 I'm trying to make a dataset of images in the same format as mnist.pkl I have used https://github.com/dmitriy-serdyuk/cats_vs_dogs/blob/master/cats_vs_dogs/make_dataset.py as reference. This is what i have so far path = '/home/dell/thesis/neon/Images' def PIL2array(img): return numpy.array(img.getdata(), numpy.uint8).reshape(img.size[1], img.size[0], 1) def main(): fileList = [os.path.join(dirpath, f) for dirpath, dirnames, files in os.walk(path) for f in files if f.endswith('.jpg')] print

Tensorflow - Testing a mnist neural net with my own images

£可爱£侵袭症+ 提交于 2019-12-12 07:48:26
问题 I'm trying to write a script that will allow me to draw an image of a digit and then determine what digit it is with a model trained on MNIST. Here is my code: import random import image from tensorflow.examples.tutorials.mnist import input_data import tensorflow as tf import numpy as np import scipy.ndimage mnist = input_data.read_data_sets( "MNIST_data/", one_hot=True ) x = tf.placeholder(tf.float32, [None, 784]) W = tf.Variable(tf.zeros([784, 10])) b = tf.Variable(tf.zeros([10])) y = tf.nn