Added tfdebug

parent 26a4c0a2
Pipeline #13940 canceled with stages
in 27 seconds
......@@ -6,6 +6,7 @@
import tensorflow as tf
import os
from tensorflow.python import debug as tf_debug
class Extractor(object):
......@@ -14,7 +15,7 @@ class Extractor(object):
def __init__(self, checkpoint_filename, input_tensor, graph):
def __init__(self, checkpoint_filename, input_tensor, graph, debug=False):
"""Loads the tensorflow model
......@@ -34,17 +35,21 @@ class Extractor(object):
self.graph = graph
# Initializing the variables of the current graph
self.session = tf.Session()
self.session = tf.Session()
# Loading the last checkpoint and overwriting the current variables
saver = tf.train.Saver()
if os.path.splitext(checkpoint_filename)[1] == ".meta":
saver.restore(self.session, tf.train.latest_checkpoint(os.path.dirname(checkpoint_filename)))
if os.path.isdir(checkpoint_filename):
saver.restore(self.session, tf.train.latest_checkpoint(checkpoint_filename))
saver.restore(self.session, checkpoint_filename)
# Activating the debug
if debug:
self.session = tf_debug.LocalCLIDebugWrapperSession(self.session)
def __del__(self):
......@@ -65,6 +70,5 @@ class Extractor(object):
The features.
return, feed_dict={self.input_tensor: data})
#!/usr/bin/env python
from .Extractor import Extractor
from .InceptionResNet_v1 import InceptionResNet_v1
def scratch_network(inputs, end_point="fc1", reuse = False):
import tensorflow as tf
......@@ -53,7 +57,6 @@ def download_file(url, out_file):
with open(out_file, 'wb') as f:
copyfileobj(response, f)
from .Extractor import Extractor
def get_config():
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment