更新CRNN,lightCRNN模型,修正pyqt的问号,增加识别框上方的车牌号,更新模型选择列表

This commit is contained in:
2025-09-17 20:34:50 +08:00
parent 74821bb02c
commit 2b443b7373
12 changed files with 78 additions and 490 deletions

20
main.py
View File

@@ -308,7 +308,7 @@ class MainWindow(QMainWindow):
method_label.setFont(QFont("Arial", 10))
self.method_combo = QComboBox()
self.method_combo.addItems(["CRNN", "LPRNET", "OCR"])
self.method_combo.addItems(["CRNN", "LightCRNN", "OCR"])
self.method_combo.setCurrentText("CRNN") # 默认选择CRNN
self.method_combo.currentTextChanged.connect(self.change_recognition_method)
@@ -578,7 +578,19 @@ class MainWindow(QMainWindow):
def draw_detections(self, frame):
"""在图像上绘制检测结果"""
return self.detector.draw_detections(frame, self.detections)
# 获取车牌号列表
plate_numbers = []
for detection in self.detections:
# 矫正车牌图像
corrected_image = self.correct_license_plate(detection)
# 获取车牌号
if corrected_image is not None:
plate_number = self.recognize_plate_number(corrected_image, detection['class_name'])
plate_numbers.append(plate_number)
else:
plate_numbers.append("识别失败")
return self.detector.draw_detections(frame, self.detections, plate_numbers)
def display_frame(self, frame):
"""显示帧到界面"""
@@ -760,7 +772,7 @@ class MainWindow(QMainWindow):
# 根据当前选择的识别方法调用相应的函数
if self.current_recognition_method == "CRNN":
from CRNN_part.crnn_interface import LPRNmodel_predict
elif self.current_recognition_method == "LPRNET":
elif self.current_recognition_method == "LightCRNN":
from lightCRNN_part.lightcrnn_interface import LPRNmodel_predict
elif self.current_recognition_method == "OCR":
from OCR_part.ocr_interface import LPRNmodel_predict
@@ -798,7 +810,7 @@ class MainWindow(QMainWindow):
if method == "CRNN":
from CRNN_part.crnn_interface import LPRNinitialize_model
LPRNinitialize_model()
elif method == "LPRNET":
elif method == "LightCRNN":
from lightCRNN_part.lightcrnn_interface import LPRNinitialize_model
LPRNinitialize_model()
elif method == "OCR":