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

Something confused with the D_basic() function? #8

Open
hufengshuo07 opened this issue Oct 9, 2019 · 0 comments
Open

Something confused with the D_basic() function? #8

hufengshuo07 opened this issue Oct 9, 2019 · 0 comments

Comments

@hufengshuo07
Copy link

I tried read images directly as the input of D_basic() function. But no matter which kinds of images I read (real face, fake face ,or even boats), the outputs are always 0.00xxxx or 0.01xxxx. Has someone ever tried this? I can't figure it out.

Here's the session code:

with tf.Session(config=tf.ConfigProto(allow_soft_placement=True)) as sess:
img_placeholder1 = tf.placeholder(tf.float32, [1, 3, 1024, 1024])
img_placeholder2 = tf.placeholder(tf.float32, [1, 3, 1024, 1024])

img_now = cv2.imread('/media/sure/H/image_restoration/Compute-Features-master/test_images/Places365_test_00000002.jpg')/255.0*2-1
img_now = cv2.resize(img_now, (1024, 1024))

img_now = cv2.GaussianBlur(img_now, (9, 9), 2.0)
imgsmall = cv2.resize(img_now, (int(1024/ 16), int(1024/ 16)))
imgsmall = cv2.resize(imgsmall, (1024,1024))    #degraded
img_now = np.expand_dims(np.transpose(img_now,(2,0,1)), 0)
imgsmall = np.expand_dims(np.transpose(imgsmall,(2,0,1)), 0)

ddd1 = tf.nn.softplus(D_basic(img_placeholder1, None, is_training=False))
ddd2 = tf.nn.softplus(D_basic(img_placeholder2, None, is_training=False))

saver = tf.train.Saver()
saver.restore(sess,'./pretrain_model/gan_conv.ckpt')   #ckpt converted from official pkl

score1,score2 = sess.run([ddd1,ddd2], feed_dict={img_placeholder1:img_now,img_placeholder2:imgsmall})
print(score1,score2)

And got a result as ([0.01984515],[0.01300943]), which i think should be a value near 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant