April 2017
Intermediate to advanced
320 pages
7h 46m
English
The second part of the implemented classifier is listed here:
from scipy import misc import numpy as np import matplotlib.cm as cm import tensorflow as tf from matplotlib import pyplot as plt import matplotlib.image as mpimg import EmotionDetectorUtils from EmotionDetectorUtils import testResult def rgb2gray(rgb): return np.dot(rgb[...,:3], [0.299, 0.587, 0.114]) img = mpimg.imread('author_image.jpg') gray = rgb2gray(img) plt.imshow(gray, cmap = plt.get_cmap('gray')) plt.show() sess = tf.InteractiveSession() new_saver = tf.train.import_meta_graph('logs/model.ckpt-1000.meta') new_saver.restore(sess, 'logs/model.ckpt-1000') tf.get_default_graph().as_graph_def() x = sess.graph.get_tensor_by_name("input:0") y_conv = sess.graph.get_tensor_by_name("output:0") ...Read now
Unlock full access