Created
October 1, 2016 14:25
-
-
Save bhautikj/3546c7ea86cc1e9d268f807df50739c6 to your computer and use it in GitHub Desktop.
deep dreaming + open nsfw
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
# git clone https://github.com/jrosebr1/bat-country.git | |
# git clone https://github.com/yahoo/open_nsfw | |
# cd bat-country | |
from batcountry import BatCountry | |
import numpy as np | |
from PIL import Image | |
import caffe | |
import sys | |
bc = BatCountry("../open_nsfw/nsfw_model", model_path="../open_nsfw/nsfw_model/resnet_50_1by2_nsfw.caffemodel", mean=(104.0, 117.0, 123.0)) | |
image = bc.dream(np.float32(Image.open(sys.argv[1])),end="eltwise_stage3_block0",iter_n=12) | |
bc.cleanup() | |
result = Image.fromarray(np.uint8(image)) | |
result.save(sys.argv[2]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment