自己手写一个图片,要求:
– – 黑底白字
– --28*28大小
然后输入路径就会得到结果了,
输入end结束程序、
逻辑回归的准确率也就那样,88-90
哦对了,data包自己在目录下建个data文件夹下载就好
搜索mnist,都找得到的
下载网址:http://yann.lecun.com/exdb/mnist/
# coding=utf8
#逻辑回归
import tensorflow as tf
from PIL import Image
from pylab import *
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
import numpy as np
#Activation function : don't Know 没卷积没池化,我也不知道为啥,也不敢问
#lost Function : - log(p) 对数损失函数softmax分类
def ImgToArr(url):
return np.array(Image.open(url).convert('L'))
def sigmoid(x,deriv = False):
if(deriv==True):
return x*(1-x)
return 1/(1+np.exp(-x))
mnist=input_data.read_data_sets('data/',one_hot=True)
#print
#mnist type是dataSet