import numpy as np import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data import os %matplotlib inline import matplotlib.pyplot as plt mnist = input_data.read_data_sets('MNIST_data', one_hot=True) class ConvModel(object):…
from numpy import * def img2vector(filename): returnVect = zeros((1,1024)) fr = open(filename) for i in range(32): lineStr = fr.readline() for j in range(32): returnVect[0,32*i+j] = int(lineStr[j]) return returnVect def loadImages(dirName): from os i…