From 826069b429ef2cd5ca9085df0158405f26f158cd Mon Sep 17 00:00:00 2001
From: chenyukun <764784960@qq.com>
Date: Tue, 29 Nov 2022 17:20:07 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E7=A9=BA=E6=B8=AF=E7=95=85=E8=A1=8C?=
=?UTF-8?q?=E9=80=9A=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/workspace.xml | 20 +++++----
entity/FeedBack.py | 1 +
fk_application.yml | 2 +-
service/Dispatcher.py | 86 ++++++++++++++++++------------------
test/kafka/producer_start.py | 2 +-
5 files changed, 58 insertions(+), 53 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 92703ee..a895a5a 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,10 +5,11 @@
-
-
-
+
+
+
+
@@ -65,7 +66,7 @@
@@ -158,7 +159,7 @@
-
+
@@ -301,10 +302,11 @@
+
-
+
@@ -366,6 +368,8 @@
+
+
@@ -406,7 +410,7 @@
-
+
@@ -417,7 +421,7 @@
-
+
diff --git a/entity/FeedBack.py b/entity/FeedBack.py
index 240e6f9..dfb024f 100644
--- a/entity/FeedBack.py
+++ b/entity/FeedBack.py
@@ -7,5 +7,6 @@ def message_register(registerId="", carUrl="", carCode="", flowManRecognitionlLi
"registerId": registerId,
"carUrl": carUrl,
"carCode": carCode,
+ "carCodeScore": '',
"flowManRecognitionlList": flowManRecognitionlList
}
diff --git a/fk_application.yml b/fk_application.yml
index caf3cd9..611ece7 100644
--- a/fk_application.yml
+++ b/fk_application.yml
@@ -33,7 +33,7 @@ kafka:
enable_auto_commit: False
max_poll_records: 1
test:
- bootstrap_servers: ['192.168.11.242:9092']
+ bootstrap_servers: ['106.14.96.218:19092']
producer:
acks: -1
retries: 3
diff --git a/service/Dispatcher.py b/service/Dispatcher.py
index e25b0b6..c6824af 100644
--- a/service/Dispatcher.py
+++ b/service/Dispatcher.py
@@ -25,9 +25,11 @@ def distinguish(flowMan, fkmodel, gpuId, orc, msgId):
carUrl = flowMan.get("carUrl")
flowManUrlList = flowMan.get("flowManUrlList")
args_list = []
- args_list.append(('plate', carUrl, gpuId, fkmodel, orc, msgId))
+ if carUrl is not None or len(carUrl) > 0:
+ args_list.append(('plate', carUrl, gpuId, fkmodel, orc, msgId))
for flowManUrl in flowManUrlList:
- args_list.append(('code', flowManUrl, gpuId, fkmodel, orc, msgId))
+ if flowManUrl is not None or len(flowManUrl) > 0:
+ args_list.append(('code', flowManUrl, gpuId, fkmodel, orc, msgId))
register = message_register(registerId=registerId, carUrl=carUrl, carCode="", flowManRecognitionlList=[])
with ThreadPoolExecutor(max_workers=2) as t:
for result in t.map(ai_segmentation_recognition, args_list):
@@ -85,17 +87,17 @@ def ai_segmentation_recognition(param):
# 行程码
if dataBack.get("type") == 0:
# 手机号
- if dataBack.get("phoneNumberImage") is None or len(dataBack.get("phoneNumberImage")) == 0:
- phoneNumberRecognition = ''
- phone_score = ''
- else:
- phone = param[4].universal_text_recognition(dataBack.get("phoneNumberImage")[0], param[5])
- phone_score = dataBack.get("phoneNumberImage")[1]
- if phone is None or phone.get("words_result") is None or len(phone.get("words_result")) == 0:
- logger.error("手机号识别为空: {}", phone)
- phoneNumberRecognition = ''
- else:
- phoneNumberRecognition = phone.get("words_result")
+ # if dataBack.get("phoneNumberImage") is None or len(dataBack.get("phoneNumberImage")) == 0:
+ # phoneNumberRecognition = ''
+ # phone_score = ''
+ # else:
+ # phone = param[4].universal_text_recognition(dataBack.get("phoneNumberImage")[0], param[5])
+ # phone_score = dataBack.get("phoneNumberImage")[1]
+ # if phone is None or phone.get("words_result") is None or len(phone.get("words_result")) == 0:
+ # logger.error("手机号识别为空: {}", phone)
+ # phoneNumberRecognition = ''
+ # else:
+ # phoneNumberRecognition = phone.get("words_result")
if dataBack.get("cityImage") is None or len(dataBack.get("cityImage")) == 0:
cityRecognition = ''
city_score = ''
@@ -109,35 +111,33 @@ def ai_segmentation_recognition(param):
cityRecognition = city.get("words_result")
return {'type': str(dataBack.get("type")),
'imageUrl': param[1],
- 'phoneNumberRecognition': phoneNumberRecognition,
- 'phone_sorce': phone_score,
+ # 'phoneNumberRecognition': phoneNumberRecognition,
+ # 'phone_sorce': phone_score,
'cityRecognition': cityRecognition,
'city_score': city_score}
elif dataBack.get("type") == 1:
- if dataBack.get("nameImage") is None or len(dataBack.get("nameImage")) == 0:
- nameRecognition = ''
- name_score = ''
- else:
- name = param[4].universal_text_recognition(dataBack.get("nameImage")[0], param[5])
- name_score = dataBack.get("nameImage")[1]
- if name is None or name.get("words_result") is None or len(name.get("words_result")) == 0:
- logger.error("名字识别为空: {}", name)
- nameRecognition = ''
- else:
- nameRecognition = name.get("words_result")
-
- if dataBack.get("phoneNumberImage") is None or len(dataBack.get("phoneNumberImage")) == 0:
- phoneNumberRecognition = ''
- phone_score = ''
- else:
- phone = param[4].universal_text_recognition(dataBack.get("phoneNumberImage")[0], param[5])
- phone_score = dataBack.get("phoneNumberImage")[1]
- if phone is None or phone.get("words_result") is None or len(phone.get("words_result")) == 0:
- logger.error("手机号识别为空: {}", phone)
- phoneNumberRecognition = ''
- else:
- phoneNumberRecognition = phone.get("words_result")
-
+ # if dataBack.get("nameImage") is None or len(dataBack.get("nameImage")) == 0:
+ # nameRecognition = ''
+ # name_score = ''
+ # else:
+ # name = param[4].universal_text_recognition(dataBack.get("nameImage")[0], param[5])
+ # name_score = dataBack.get("nameImage")[1]
+ # if name is None or name.get("words_result") is None or len(name.get("words_result")) == 0:
+ # logger.error("名字识别为空: {}", name)
+ # nameRecognition = ''
+ # else:
+ # nameRecognition = name.get("words_result")
+ # if dataBack.get("phoneNumberImage") is None or len(dataBack.get("phoneNumberImage")) == 0:
+ # phoneNumberRecognition = ''
+ # phone_score = ''
+ # else:
+ # phone = param[4].universal_text_recognition(dataBack.get("phoneNumberImage")[0], param[5])
+ # phone_score = dataBack.get("phoneNumberImage")[1]
+ # if phone is None or phone.get("words_result") is None or len(phone.get("words_result")) == 0:
+ # logger.error("手机号识别为空: {}", phone)
+ # phoneNumberRecognition = ''
+ # else:
+ # phoneNumberRecognition = phone.get("words_result")
if dataBack.get("hsImage") is None or len(dataBack.get("hsImage")) == 0:
hsRecognition = ''
hs_score = ''
@@ -153,10 +153,10 @@ def ai_segmentation_recognition(param):
return {'type': str(dataBack.get("type")),
'imageUrl': param[1],
'color': dataBack.get("color"),
- 'nameRecognition': nameRecognition,
- 'name_score': name_score,
- 'phoneNumberRecognition': phoneNumberRecognition,
- 'phone_score': phone_score,
+ # 'nameRecognition': nameRecognition,
+ # 'name_score': name_score,
+ # 'phoneNumberRecognition': phoneNumberRecognition,
+ # 'phone_score': phone_score,
'hsRecognition': hsRecognition,
'hs_score': hs_score}
else:
diff --git a/test/kafka/producer_start.py b/test/kafka/producer_start.py
index 093b43c..9be6246 100644
--- a/test/kafka/producer_start.py
+++ b/test/kafka/producer_start.py
@@ -67,7 +67,7 @@ aa = {
}
]
}
-producer = KafkaProducer(bootstrap_servers=['192.168.11.13:9092'],
+producer = KafkaProducer(bootstrap_servers=['106.14.96.218:19092'],
value_serializer=lambda m: json.dumps(m).encode('utf-8'))
future = producer.send(topicName, key=b'ffa29db9c4c7451997b3d5038bf13381', value=aaa)
result = future.get(timeout=10)
--
2.27.0
From 5feff77b0c0ec269e7dd01ceef0447682736b3e1 Mon Sep 17 00:00:00 2001
From: chenyukun <764784960@qq.com>
Date: Wed, 30 Nov 2022 11:50:40 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E7=A9=BA=E6=B8=AF=E7=95=85=E8=A1=8C?=
=?UTF-8?q?=E9=80=9A=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/deployment.xml | 4 ++--
.idea/workspace.xml | 7 +++----
service/Dispatcher.py | 4 ++--
3 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/.idea/deployment.xml b/.idea/deployment.xml
index 8c75b9a..1856413 100644
--- a/.idea/deployment.xml
+++ b/.idea/deployment.xml
@@ -1,11 +1,11 @@
-
+
-
+
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a895a5a..2904612 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,11 +5,9 @@
+
-
-
-
@@ -369,7 +367,8 @@
-
+
+
diff --git a/service/Dispatcher.py b/service/Dispatcher.py
index c6824af..2252b32 100644
--- a/service/Dispatcher.py
+++ b/service/Dispatcher.py
@@ -25,10 +25,10 @@ def distinguish(flowMan, fkmodel, gpuId, orc, msgId):
carUrl = flowMan.get("carUrl")
flowManUrlList = flowMan.get("flowManUrlList")
args_list = []
- if carUrl is not None or len(carUrl) > 0:
+ if carUrl is not None and len(carUrl) > 0:
args_list.append(('plate', carUrl, gpuId, fkmodel, orc, msgId))
for flowManUrl in flowManUrlList:
- if flowManUrl is not None or len(flowManUrl) > 0:
+ if flowManUrl is not None and len(flowManUrl) > 0:
args_list.append(('code', flowManUrl, gpuId, fkmodel, orc, msgId))
register = message_register(registerId=registerId, carUrl=carUrl, carCode="", flowManRecognitionlList=[])
with ThreadPoolExecutor(max_workers=2) as t:
--
2.27.0