Prechádzať zdrojové kódy

关闭tensorflow eager模式

luojiehua 2 rokov pred
rodič
commit
8989e80a49
1 zmenil súbory, kde vykonal 3 pridanie a 3 odobranie
  1. 3 3
      isr/isr_interface.py

+ 3 - 3
isr/isr_interface.py

@@ -6,7 +6,7 @@ import sys
 import traceback
 import traceback
 os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
 os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
 import tensorflow as tf
 import tensorflow as tf
-tf.compat.v1.enable_eager_execution()
+# tf.compat.v1.enable_eager_execution()
 MAX_COMPUTE = False
 MAX_COMPUTE = False
 
 
 if not MAX_COMPUTE:
 if not MAX_COMPUTE:
@@ -41,7 +41,7 @@ from isr.model import get_tiny_inference_model, seal_model, seal_model_se
 from isr.pre_process import count_red_pixel, get_anchors, get_classes, get_colors
 from isr.pre_process import count_red_pixel, get_anchors, get_classes, get_colors
 from isr.utils import get_best_predict_size, pil_resize, letterbox_image, draw_boxes, adjust_boxes
 from isr.utils import get_best_predict_size, pil_resize, letterbox_image, draw_boxes, adjust_boxes
 from flask import Flask, request
 from flask import Flask, request
-
+tf.compat.v1.disable_eager_execution()
 sess1 = tf.compat.v1.Session(graph=tf.Graph())
 sess1 = tf.compat.v1.Session(graph=tf.Graph())
 sess2 = tf.compat.v1.Session(graph=tf.Graph())
 sess2 = tf.compat.v1.Session(graph=tf.Graph())
 
 
@@ -100,7 +100,7 @@ def detect_seal(image_np, model):
     # inference data
     # inference data
     with sess1.as_default():
     with sess1.as_default():
         with sess1.graph.as_default():
         with sess1.graph.as_default():
-            out_boxes, out_scores, out_classes = model.predict([image_resize, image_shape], steps=2)
+            out_boxes, out_scores, out_classes = model.predict([image_resize, image_shape], steps=1)
     if int(out_boxes.shape[0]) == 0:
     if int(out_boxes.shape[0]) == 0:
         log("there is no seal!")
         log("there is no seal!")
         return image_np, [], []
         return image_np, [], []