Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkWoong committed Aug 12, 2017
1 parent 8d96309 commit 078246e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
6 changes: 4 additions & 2 deletions LinkGAN/essential.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ def show_active_img_and_save_denoise_filter(name,image,path):
return mat


def show_active_img_and_save_denoise_filter2(name,image,path):
def show_active_img_and_save_denoise_filter2(name,image,path, i):

path = path + '/sketch'
mat = image.astype(np.float)
mat[mat<0.1] = 0
mat = -mat + 1
Expand All @@ -104,7 +106,7 @@ def show_active_img_and_save_denoise_filter2(name,image,path):
mat = ndimage.median_filter(mat,1)
if not os.path.exists(path):
os.makedirs(path)

path = path + '/sketched_' + str(i) + '.jpeg'
cv2.imwrite(path,mat)

return mat
Expand Down
4 changes: 2 additions & 2 deletions LinkGAN/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ def preprocess(image_path, mod_path, content_to_sketch):
show_active_img_and_save('sketches', line_mat, './' + str(i) + '.jpeg')
line_mat = np.amax(line_mat, 2)

show_active_img_and_save_denoise_filter2('sketches', line_mat, new_path + '/sketch/sketched_' + str(i) + '.jpeg')
show_active_img_and_save_denoise_filter2('sketches', line_mat, new_path, i)
show_active_img_and_save_denoise_filter('sketches', line_mat, './' + str(i) + '.jpeg')

sketch_path = new_path + '/sketch'
content_path = new_path

return content_path, sketch_path
return content_path, sketch_path
22 changes: 22 additions & 0 deletions LinkGAN/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import tensorflow as tf
import numpy as np
import io
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import cv2
import pandas as pd


from keras.models import load_model
from preprocess import *

path = '/media/linkwong/D/1girl'
mod_path = '/media/linkwong/D/mod.h5'

content_to_sketch = True


content_path, sketch_path = preprocess(path, mod_path, content_to_sketch)

print content_path
print sketch_path

0 comments on commit 078246e

Please sign in to comment.