Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
Merge branch 'doc-readme-contrib' of https://github.com/gnes-ai/gnes
Browse files Browse the repository at this point in the history
…into doc-readme-contrib
  • Loading branch information
hanhxiao committed Jul 22, 2019
2 parents 7fe7919 + 9019102 commit 2b165ec
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions gnes/encoder/image/inception.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,25 @@ def post_init(self):
from .inception_cores.inception_v4 import inception_v4
from .inception_cores.inception_utils import inception_arg_scope

arg_scope = inception_arg_scope()
inception_v4.default_image_size = self.inception_size_x
self.inputs = tf.placeholder(tf.float32, (None,
self.inception_size_x,
self.inception_size_y, 3))
g = tf.Graph()
with g.as_default():
arg_scope = inception_arg_scope()
inception_v4.default_image_size = self.inception_size_x
self.inputs = tf.placeholder(tf.float32, (None,
self.inception_size_x,
self.inception_size_y, 3))

with tf.contrib.slim.arg_scope(arg_scope):
self.logits, self.end_points = inception_v4(self.inputs,
is_training=False,
dropout_keep_prob=1.0)
with tf.contrib.slim.arg_scope(arg_scope):
self.logits, self.end_points = inception_v4(self.inputs,
is_training=False,
dropout_keep_prob=1.0)

config = tf.ConfigProto(log_device_placement=False)
if self._use_cuda:
config.gpu_options.allow_growth = True
self.sess = tf.Session(config=config)
self.saver = tf.train.Saver()
self.saver.restore(self.sess, self.model_dir)
config = tf.ConfigProto(log_device_placement=False)
if self._use_cuda:
config.gpu_options.allow_growth = True
self.sess = tf.Session(config=config)
self.saver = tf.train.Saver()
self.saver.restore(self.sess, self.model_dir)

@batching
def encode(self, img: List['np.ndarray'], *args, **kwargs) -> np.ndarray:
Expand Down

0 comments on commit 2b165ec

Please sign in to comment.