-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_EyeConvnet.py
32 lines (26 loc) · 1.03 KB
/
test_EyeConvnet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import EyeConvnet
import tensorflow as tf
import numpy as np
import pytest
import mltest.mltest as mltest
slim = tf.contrib.slim
def setup_function(fnc):
tf.reset_default_graph()
def setup():
mltest.setup()
def test_suite():
face_tensor = tf.placeholder(tf.float32, (None, 128, 128, 3))
left_eye_tensor = tf.placeholder(tf.float32, (None, 36, 60, 3))
right_eye_tensor = tf.placeholder(tf.float32, (None, 36, 60, 3))
face_pts_tensor = tf.placeholder(tf.float32, (None, 102))
model = EyeConvnet.EyeConvnet(
True, face_tensor, left_eye_tensor, right_eye_tensor,
face_pts_tensor)
opt = tf.train.AdamOptimizer()
train = slim.learning.create_train_op(model.prediction, opt)
mltest.test_suite(model.prediction, train, feed_dict={
face_tensor: np.random.normal(size=(1, 128, 128, 3)) + 1000,
left_eye_tensor: np.random.normal(size=(1, 36, 60, 3)),
right_eye_tensor: np.random.normal(size=(1, 36, 60, 3)),
face_pts_tensor: np.random.normal(size=(1, 102))
})