3 Commitit 39ccdca291 ... adeb290540

Tekijä SHA1 Viesti Päivämäärä
  chencheng adeb290540 save images 1 vuosi sitten
  chencheng 897fa0a860 merge 1 vuosi sitten
  chencheng 455258fff7 save images 1 vuosi sitten
1 muutettua tiedostoa jossa 7 lisäystä ja 1 poistoa
  1. 7 1
      server.py

+ 7 - 1
server.py

@@ -1,6 +1,7 @@
 # -*- coding: UTF-8 -*-
 import json
 from base64 import b64decode
+import base64
 
 import cv2
 import numpy as np
@@ -111,17 +112,20 @@ def predict_cls(image, conf=0.8):
         score = res[0]['scores'][0]
         label_name = res[0]['label_names'][0]
         print(f"score: {score}, label_name: {label_name}")
+        # print(conf)
         if score > conf:
             return int(label_name)
     return -1
 
 
 def rotate_to_zero(image, current_degree):
+    # cv2.imwrite('1.jpg', image)
     current_degree = current_degree // 90
     if current_degree == 0:
         return image
     to_rotate = (4 - current_degree) - 1
     image = cv2.rotate(image, to_rotate)
+    # cv2.imwrite('2.jpg', image)
     return image
 
 
@@ -143,11 +147,13 @@ def get_zero_degree_image(img):
 
 def table_res(im, ROTATE=-1):
     im = im.copy()
+    cv2.imwrite('before-rotate.jpg', im)
     # 获取正向图片
     img = get_zero_degree_image(im)
-    # cv2.imwrite('1.jpg', img)
+    cv2.imwrite('after-rotate.jpg', img)
     try:
         table_engine_lock.acquire()
+        # cv2.imwrite('3.jpg', img)
         res = table_engine(img)
     finally:
         table_engine_lock.release()