Created
May 24, 2017 20:19
-
-
Save donflopez/6822cad81cbb64a4d5b44c501e014897 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# convert the input file to RGB | |
img = Image.open(fil).convert(‘RGB’) | |
# get an array of pixeles as [(255, 255, 255),...] | |
data = img.getdata() | |
# create a numpy array | |
narr = numpy.array(data) | |
# flatten the array [255, 255, 255,...] | |
narr = narr.flatten() | |
# normalize the rgb channels now [0. - 1.] | |
narr = [ (255-j)*1.0/255.0 for j in narr ] | |
# predict the result over the numpy array with the image information | |
res = self.prediction.eval(feed_dict={self.x: [narr], | |
self.keep_prob: 0.5}, session=self.sess) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment