Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style transfer algo gpu #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added lib/images/style/west-elm-brightcolors.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/custom_vgg19V2.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self, vgg19_npy_path=None):
exit(0)

if data is None:
data = np.load(vgg19_npy_path, encoding='latin1')
data = np.load(vgg19_npy_path, encoding='latin1', allow_pickle=True)
self.data_dict = data.item()
print("VGG19 weights loaded")

Expand Down
5 changes: 2 additions & 3 deletions src/utilsV2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from PIL import Image



# Return a numpy array of an image specified by its path
def load_image(path):
# Load image [height, width, depth]
Expand Down Expand Up @@ -50,10 +49,10 @@ def load_image2(path, height=None, width=None):
# Render the generated image given a tensorflow session and a variable image (x)
def render_img(session, x, save=False, out_path=None):
shape = x.get_shape().as_list()
img = np.clip(session.run(x), 0, 1)
img = (np.clip(session.run(x), 0, 1) * 255).astype(np.uint8)

if save:
Image.fromarray(np.reshape(img, shape[1:])).save(out_path)
Image.fromarray(np.reshape(img, shape[1:])).resize((1200, 1200)).save(out_path)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we resizing to 1200x1200? If this is arbitrary, can we make this configurable via flag arg?

# toimage(np.reshape(img, shape[1:])).save(out_path)
else:
Image.fromarray(np.reshape(img, shape[1:])).show()
Expand Down