Created
July 13, 2015 01:02
-
-
Save iandouglas/489f25362b3bb9c4d40f to your computer and use it in GitHub Desktop.
deep dream
This file contains hidden or 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
| import shutil | |
| !mkdir dreamed | |
| frame_i = 0 | |
| for i in xrange(firstnum, secondnum): | |
| img = np.float32(PIL.Image.open('/src/'+ str(i) +'.jpg')) | |
| showarray(img) | |
| frame = img | |
| h, w = frame.shape[:2] | |
| s = 0.05 # scale coefficient | |
| frame = deepdream(net, img, end='inception_4c/output') | |
| PIL.Image.fromarray(np.uint8(frame)).save("dreamed/" + str(i) + ".jpg") | |
| frame = nd.affine_transform(frame, [1-s, 1-s, 1], [h/s/2, w/s/2, 0], order=1) | |
| frame_i += 1 | |
| shutil.copy('dreamed/' + str(i) + '.jpg', '/src/done') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment