Ver Fonte

改变参数

zyc há 3 anos atrás
pai
commit
2646edabc0

+ 1 - 1
invoice_ocr/settings.py

@@ -25,7 +25,7 @@ SECRET_KEY = 'l56929t$rpl&(75-g20nnoe*@q7gxp9c)i*1lh2fi=4+p-4(mj'
 # SECURITY WARNING: don't run with debug turned on in production!
 DEBUG = True
 
-ALLOWED_HOSTS = []
+ALLOWED_HOSTS = ['119.3.54.245', '127.0.0.1']
 
 
 # Application definition

+ 30 - 0
logs/all-2021-03-12.log

@@ -238,3 +238,33 @@ TypeError: The input data is inconsistent with expectations.
 [2021-03-12 11:23:33,707] [basehttp.py:157] [basehttp:log_message] [ERROR]- "POST /ocr/invoice_ocr/ HTTP/1.1" 500 82466
 [2021-03-12 11:24:25,767] [autoreload.py:617] [autoreload:run_with_reloader] [INFO]- Watching for file changes with StatReloader
 [2021-03-12 11:24:28,224] [basehttp.py:157] [basehttp:log_message] [INFO]- "POST /ocr/invoice_ocr/ HTTP/1.1" 200 61
+[2021-03-12 12:07:10,402] [autoreload.py:617] [autoreload:run_with_reloader] [INFO]- Watching for file changes with StatReloader
+[2021-03-12 12:07:14,765] [log.py:230] [log:log_response] [WARNING]- Not Found: /
+[2021-03-12 12:07:14,766] [basehttp.py:157] [basehttp:log_message] [WARNING]- "GET / HTTP/1.1" 404 2030
+[2021-03-12 12:07:14,772] [log.py:230] [log:log_response] [WARNING]- Not Found: /
+[2021-03-12 12:07:14,772] [basehttp.py:157] [basehttp:log_message] [WARNING]- "GET / HTTP/1.1" 404 2030
+[2021-03-12 12:07:14,840] [log.py:230] [log:log_response] [WARNING]- Not Found: /favicon.ico
+[2021-03-12 12:07:14,840] [basehttp.py:157] [basehttp:log_message] [WARNING]- "GET /favicon.ico HTTP/1.1" 404 2081
+[2021-03-12 12:07:19,604] [basehttp.py:157] [basehttp:log_message] [INFO]- "GET /admin HTTP/1.1" 301 0
+[2021-03-12 12:07:19,623] [basehttp.py:157] [basehttp:log_message] [INFO]- "GET /admin/ HTTP/1.1" 302 0
+[2021-03-12 12:07:19,701] [basehttp.py:157] [basehttp:log_message] [INFO]- "GET /admin/login/?next=/admin/ HTTP/1.1" 200 2194
+[2021-03-12 12:07:19,728] [basehttp.py:157] [basehttp:log_message] [INFO]- "GET /static/admin/css/base.css HTTP/1.1" 200 16307
+[2021-03-12 12:07:19,733] [basehttp.py:157] [basehttp:log_message] [INFO]- "GET /static/admin/css/nav_sidebar.css HTTP/1.1" 200 2138
+[2021-03-12 12:07:19,734] [basehttp.py:157] [basehttp:log_message] [INFO]- "GET /static/admin/css/login.css HTTP/1.1" 200 1185
+[2021-03-12 12:07:19,736] [basehttp.py:157] [basehttp:log_message] [INFO]- "GET /static/admin/css/responsive.css HTTP/1.1" 200 18344
+[2021-03-12 12:07:19,739] [basehttp.py:157] [basehttp:log_message] [INFO]- "GET /static/admin/js/nav_sidebar.js HTTP/1.1" 200 1360
+[2021-03-12 12:07:19,751] [basehttp.py:157] [basehttp:log_message] [INFO]- "GET /static/admin/css/fonts.css HTTP/1.1" 200 423
+[2021-03-12 12:07:19,788] [basehttp.py:157] [basehttp:log_message] [INFO]- "GET /static/admin/fonts/Roboto-Light-webfont.woff HTTP/1.1" 200 85692
+[2021-03-12 12:07:19,788] [basehttp.py:157] [basehttp:log_message] [INFO]- "GET /static/admin/fonts/Roboto-Regular-webfont.woff HTTP/1.1" 200 85876
+[2021-03-12 12:07:26,692] [basehttp.py:157] [basehttp:log_message] [INFO]- "GET /admin/ HTTP/1.1" 302 0
+[2021-03-12 12:07:26,707] [basehttp.py:157] [basehttp:log_message] [INFO]- "GET /admin/login/?next=/admin/ HTTP/1.1" 200 2194
+[2021-03-12 14:04:43,609] [autoreload.py:617] [autoreload:run_with_reloader] [INFO]- Watching for file changes with StatReloader
+[2021-03-12 14:05:58,993] [basehttp.py:157] [basehttp:log_message] [INFO]- "POST /ocr/invoice_ocr/ HTTP/1.1" 200 454
+[2021-03-12 14:06:14,431] [basehttp.py:157] [basehttp:log_message] [INFO]- "POST /ocr/invoice_ocr/ HTTP/1.1" 200 447
+[2021-03-12 14:06:30,574] [basehttp.py:157] [basehttp:log_message] [INFO]- "POST /ocr/invoice_ocr/ HTTP/1.1" 200 374
+[2021-03-12 14:09:16,172] [autoreload.py:617] [autoreload:run_with_reloader] [INFO]- Watching for file changes with StatReloader
+[2021-03-12 14:09:23,605] [basehttp.py:157] [basehttp:log_message] [INFO]- "POST /ocr/invoice_ocr/ HTTP/1.1" 200 286
+[2021-03-12 14:10:35,165] [autoreload.py:617] [autoreload:run_with_reloader] [INFO]- Watching for file changes with StatReloader
+[2021-03-12 14:10:42,951] [basehttp.py:157] [basehttp:log_message] [INFO]- "POST /ocr/invoice_ocr/ HTTP/1.1" 200 374
+[2021-03-12 14:11:00,533] [basehttp.py:157] [basehttp:log_message] [INFO]- "POST /ocr/invoice_ocr/ HTTP/1.1" 200 447
+[2021-03-12 14:11:13,776] [basehttp.py:157] [basehttp:log_message] [INFO]- "POST /ocr/invoice_ocr/ HTTP/1.1" 200 454

+ 1 - 0
ocr/views.py

@@ -4,6 +4,7 @@ from django import http
 from . import ocrModel
 import numpy as np
 
+
 class InvoiceOCRView(View):
     def post(self, request):
         images = request.FILES.getlist('images', '')

+ 3 - 3
utils/PaddleOCR/deploy/hubserving/ocr_system/module.py

@@ -52,7 +52,7 @@ class OCRSystem:
                 img_path), "The {} isn't a valid file.".format(img_path)
             img = cv2.imread(img_path)
             if img is None:
-                # logger.info("error in loading image:{}".format(img_path))
+                print("error in loading image:{}".format(img_path))
                 continue
             images.append(img)
         return images
@@ -91,7 +91,7 @@ class OCRSystem:
             self.inv_identifier = ["", ""]
 
             if img is None:
-                # logger.info("error in loading image")
+                print("error in loading image")
                 all_results.append([])
                 continue
 
@@ -101,7 +101,7 @@ class OCRSystem:
             starttime = time.time()
             dt_boxes, rec_res = self.text_sys(img)
             elapse = time.time() - starttime
-            # logger.info("Predict time: {}".format(elapse))
+            print("Predict time: {}".format(elapse))
 
             dt_num = len(dt_boxes)
             rec_res_final = []

+ 1 - 1
utils/PaddleOCR/deploy/hubserving/ocr_system/params.py

@@ -32,7 +32,7 @@ def read_params():
     cfg.rec_algorithm = "CRNN"
     cfg.rec_model_dir = "./utils/PaddleOCR/inference/ch_ppocr_mobile_v2.0_rec_infer/"
 
-    cfg.rec_image_shape = "3, 32, 128"
+    cfg.rec_image_shape = "3, 32, 96"
     cfg.rec_char_type = 'ch'
     cfg.rec_batch_num = 1
     cfg.max_text_length = 20