# Tensorflow Graph load
import os
import tensorflow as tf


CWD_PATH = os.path.join(os.getenv('FACEREC_APP_DIR', '..'), 'aat')

# Path to frozen detection graph. This is the actual model that is used for the object detection.
if True:
    MODEL_NAME = 'ssd_mobilenet_v1_coco_2017_11_17'
elif 1==2:
    MODEL_NAME = 'faster_rcnn_inception_v2_coco_2018_01_28'
else:
    MODEL_NAME = 'faster_rcnn_inception_resnet_v2_atrous_oid_2018_01_28'

PATH_TO_CKPT = os.path.join(CWD_PATH, 'object_detection', MODEL_NAME, 'frozen_inference_graph.pb')

_detection_graph = tf.Graph()
with _detection_graph.as_default():
    od_graph_def = tf.GraphDef()
    with tf.gfile.GFile(PATH_TO_CKPT, 'rb') as fid:
        serialized_graph = fid.read()
        od_graph_def.ParseFromString(serialized_graph)
        tf.import_graph_def(od_graph_def, name='')
