In the previous article TensorFlow Handwritten Numbers-Training , we trained our neural network. In this issue, we use the model trained last time to recognize handwritten numbers (this issue builds the TensorFlow neural network code to share the code for the previous article)
http://scs.ryerson.ca/~aharley/vis/conv/
0. Insert third-party library
from PIL import Image# 处理图片
import tensorflow as tf
import numpy as np
1. Image processing function
def image_tva():
file_name='data/1.png'#导入自己的图片
im = Image.open(file_name).convert('L')
tv = list(im.getdata()) #get pixel values
#normalize pixels to 0 and 1. 0 is pure white, 1 is pure bl