Skip to content

Commit 078246e

Browse files
committed
test
1 parent 8d96309 commit 078246e

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

LinkGAN/essential.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ def show_active_img_and_save_denoise_filter(name,image,path):
9292
return mat
9393

9494

95-
def show_active_img_and_save_denoise_filter2(name,image,path):
95+
def show_active_img_and_save_denoise_filter2(name,image,path, i):
96+
97+
path = path + '/sketch'
9698
mat = image.astype(np.float)
9799
mat[mat<0.1] = 0
98100
mat = -mat + 1
@@ -104,7 +106,7 @@ def show_active_img_and_save_denoise_filter2(name,image,path):
104106
mat = ndimage.median_filter(mat,1)
105107
if not os.path.exists(path):
106108
os.makedirs(path)
107-
109+
path = path + '/sketched_' + str(i) + '.jpeg'
108110
cv2.imwrite(path,mat)
109111

110112
return mat

LinkGAN/preprocess.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ def preprocess(image_path, mod_path, content_to_sketch):
5454
show_active_img_and_save('sketches', line_mat, './' + str(i) + '.jpeg')
5555
line_mat = np.amax(line_mat, 2)
5656

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

6060
sketch_path = new_path + '/sketch'
6161
content_path = new_path
6262

63-
return content_path, sketch_path
63+
return content_path, sketch_path

LinkGAN/test.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import tensorflow as tf
2+
import numpy as np
3+
import io
4+
import os
5+
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
6+
import cv2
7+
import pandas as pd
8+
9+
10+
from keras.models import load_model
11+
from preprocess import *
12+
13+
path = '/media/linkwong/D/1girl'
14+
mod_path = '/media/linkwong/D/mod.h5'
15+
16+
content_to_sketch = True
17+
18+
19+
content_path, sketch_path = preprocess(path, mod_path, content_to_sketch)
20+
21+
print content_path
22+
print sketch_path

0 commit comments

Comments
 (0)