31
31
'image_file' , '' , 'The name of the image to run an inference.' )
32
32
33
33
tf .app .flags .DEFINE_integer (
34
- 'batch_size' , 100 , 'The number of samples in each batch.' )
34
+ 'batch_size' , 1 , 'The number of samples in each batch.' )
35
35
36
36
tf .app .flags .DEFINE_integer (
37
- 'max_num_batches' , None ,
37
+ 'max_num_batches' , 1 ,
38
38
'Max number of batches to evaluate by default use all.' )
39
39
40
40
tf .app .flags .DEFINE_string (
53
53
'The number of threads used to create the batches.' )
54
54
55
55
tf .app .flags .DEFINE_string (
56
- 'dataset_name' , 'imagenet ' , 'The name of the dataset to load.' )
56
+ 'dataset_name' , 'arts ' , 'The name of the dataset to load.' )
57
57
58
58
tf .app .flags .DEFINE_string (
59
59
'dataset_split_name' , 'test' , 'The name of the train/test split.' )
80
80
'If left as None, then moving averages are not used.' )
81
81
82
82
tf .app .flags .DEFINE_integer (
83
- 'eval_image_size' , 100 , 'Eval image size' )
83
+ 'eval_image_size' , 299 , 'Eval image size' )
84
84
85
85
FLAGS = tf .app .flags .FLAGS
86
86
@@ -116,7 +116,7 @@ def main(_):
116
116
is_training = False )
117
117
118
118
eval_image_size = FLAGS .eval_image_size or network_fn .default_image_size
119
- image_data_0 = tf .placeholder ( tf . string , [] )
119
+ image_data_0 = tf .gfile . FastGFile ( FLAGS . image_file , 'rb' ). read ( )
120
120
image_0 = tf .image .decode_jpeg (image_data_0 , channels = 3 )
121
121
image = image_preprocessing_fn (image_0 , eval_image_size , eval_image_size )
122
122
label = 0
@@ -139,7 +139,7 @@ def main(_):
139
139
variables_to_restore = slim .get_variables_to_restore ()
140
140
141
141
predictions = tf .argmax (logits , 1 )
142
-
142
+
143
143
num_batches = 1
144
144
145
145
if tf .gfile .IsDirectory (FLAGS .checkpoint_path ):
@@ -149,14 +149,12 @@ def main(_):
149
149
150
150
tf .logging .info ('Restoring model checkpoint %s' % checkpoint_path )
151
151
152
- raw_image_data = tf .gfile .FastGFile (FLAGS .image_file , 'rb' ).read ()
153
152
answer = slim .evaluation .evaluate_once (
154
153
master = FLAGS .master ,
155
154
checkpoint_path = checkpoint_path ,
156
155
logdir = FLAGS .eval_dir ,
157
156
num_evals = num_batches ,
158
157
final_op = predictions ,
159
- final_op_feed_dict = {image_data_0 : raw_image_data },
160
158
variables_to_restore = variables_to_restore )
161
159
162
160
label_name = dataset .labels_to_names .get (answer [0 ])
0 commit comments