Explorar o código

附件分类返回值更新

fangjiasheng %!s(int64=2) %!d(string=hai) anos
pai
achega
64fe98016a
Modificáronse 3 ficheiros con 6 adicións e 10 borrados
  1. 2 6
      atc/atc_interface.py
  2. 2 2
      format_convert/convert.py
  3. 2 2
      isr/isr_interface.py

+ 2 - 6
atc/atc_interface.py

@@ -44,11 +44,9 @@ def atc(data, model):
         # print("data", data)
         _, classification = model.evaluate(data)
         return {"classification": classification}
-    except TimeoutError:
-        return {"classification": [-5]}
     except:
         traceback.print_exc()
-        return {"classification": [-1]}
+        return {"classification": ""}
 
 
 # 接口配置
@@ -80,11 +78,9 @@ def _atc():
 
         classification = atc(data, atc_model).get("classification")
         return json.dumps({"classification": classification})
-    except TimeoutError:
-        return json.dumps({"classification": str([-5])})
     except:
         traceback.print_exc()
-        return json.dumps({"classification": str([-1])})
+        return json.dumps({"classification": ""})
     finally:
         log("atc interface finish time " + str(time.time()-start_time))
 

+ 2 - 2
format_convert/convert.py

@@ -594,7 +594,7 @@ def _convert():
             + str(time.time() - start_time))
         return json.dumps({"result_html": ["-2"], "result_text": ["-2"],
                            "is_success": 0, "swf_images": str([]),
-                           "classification": ["-2"]})
+                           "classification": ""})
     except Exception as e:
         log("md5: " + str(_md5) + " failed result: [-1] is_success: 0 "
             + str(_type) + " " +
@@ -602,7 +602,7 @@ def _convert():
         traceback.print_exc()
         return json.dumps({"result_html": ["-1"], "result_text": ["-1"],
                            "is_success": 0, "swf_images": str([]),
-                           "classification": ["-1"]})
+                           "classification": ""})
     finally:
         # _global._del()
         # gc.collect()

+ 2 - 2
isr/isr_interface.py

@@ -6,7 +6,7 @@ import sys
 import traceback
 # os.environ["CUDA_VISIBLE_DEVICES"] = "0"
 import tensorflow as tf
-# tf.compat.v1.enable_eager_execution()
+tf.compat.v1.disable_eager_execution()
 MAX_COMPUTE = False
 
 if not MAX_COMPUTE:
@@ -100,7 +100,7 @@ def detect_seal(image_np, model):
     # inference data
     with sess1.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:
         log("there is no seal!")
         return image_np, [], []