Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import tensorflow as tf
class ExitOnExceptionHandler(logging.StreamHandler):
def __init__(self, critical_levels, *args, **kwargs):
self.lvls = critical_levels
super().__init__(*args, **kwargs)
def emit(self, record):
if record.levelno in self.lvls:
raise SystemExit(-1)
logger = logging.getLogger(__name__)
click_log.basic_config(logger)
logger.handlers.append(ExitOnExceptionHandler([logging.CRITICAL]))
tf.enable_eager_execution()
def indices_all(ground_truth_dir):
return [
os.path.splitext(os.path.basename(f))[0]
for f in glob.glob(os.path.join(ground_truth_dir, "*.jpg"))
]
def serialize_example(f_in, f_out, is_strict=True):
def _bytes(value):
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
def _int(value):