Exemplo n.º 1
0
    def without_ngraph(self, l, config=None):
        if config is None:
            config = tf.compat.v1.ConfigProto()
        openvino_tf_disable_deassign_clusters = os.environ.pop(
            'OPENVINO_TF_DISABLE_DEASSIGN_CLUSTERS', None)

        openvino_tensorflow.disable()
        with tf.compat.v1.Session(config=config) as sess:
            retval = l(sess)

        if openvino_tf_disable_deassign_clusters is not None:
            os.environ['OPENVINO_TF_DISABLE_DEASSIGN_CLUSTERS'] = \
                openvino_tf_disable_deassign_clusters

        return retval
Exemplo n.º 2
0
    if model_file == "":
        model = hub.load(
            "https://tfhub.dev/google/imagenet/inception_v3/classification/4")
    else:
        model = tf.saved_model.load(model_file)

    if not args.disable_ovtf:
        #Print list of available backends
        print('Available Backends:')
        backends_list = ovtf.list_backends()
        for backend in backends_list:
            print(backend)
        ovtf.set_backend(backend_name)
    else:
        ovtf.disable()

    #Load the labels
    cap = None
    images = []
    if label_file:
        labels = load_labels(label_file)
    input_mode = get_input_mode(input_file)
    if input_mode == "video":
        cap = cv2.VideoCapture(input_file)
    elif input_mode == "camera":
        cap = cv2.VideoCapture(0)
    elif input_mode == 'image':
        images = [input_file]
    elif input_mode == 'directory':
        if not os.path.isdir(input_file):
Exemplo n.º 3
0
 def test_disable(self):
     openvino_tensorflow.disable()
     if not openvino_tensorflow.is_enabled() == 0:
         raise AssertionError