发布时间:2024-12-30 14:01
提示:好像没什么提示!嘿嘿,在这里提前祝大家新年快乐吧!(_ _)。゜zzZ
女朋友是一名光荣可爱的小学语文老师,由于疫情的原因,班级里需要每天统计学生的健康码和行程码截图,这可把她难坏了!
我一想,这可不行!咱专业可是程序员,人生苦短,我用python!
给她写一个方便的软件,一键就搞定了!(●ˇ∀ˇ●)
说实话我能想到的功能就是这么几个,来看一看4.0版本吧
把图片给拼接起来,赋予图片 当前文件夹的名称。
拼接代码 我是按照横向排列的!
这个功能就是对这几个功能的调用,首先找出学生表格中的图片,然后把图片拼接起来,放到新建的该学生的名字的文件夹里。
这个功能就是按照 学生表的名字创建文件夹,这个功能其实在功能2中就集成运用了,但是呢,说不定有用到的地方,毕竟懂代码的几行代码就完成了,大部分人都不太懂。
这个呢就是检查,新建的文件夹里到底有没有,学生的截图,这里代码里你们就会发现,我不仅仅是判断这下面有没有文件,而是和文件名进行了相应的核对。
这里就是调用了easyocr实现了简单的识别,因为识别得很多嘛,所以必须要输入学生表格,让程序按照表格去分析,正则在统计这种健康码样式不统一的状况还是不太好用的。
我能想到的就只有这些了,当然你们可以补充!
GIthub:https://github.com/Escapethebug/Mengyong4.0
CSDN:https://download.csdn.net/download/jnbfknasf113/85487436
界面我才用的PySide2,反正就是Qtdesigner 大概是这个东西,毕竟时间过去有点久了。这种界面设计就是拖拽式的,非常的简单类似于C#.
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file \'untitledBghGRj.ui\'
##
## Created by: Qt User Interface Compiler version 5.15.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file \'untitled22zxbXoD.ui\'
##
## Created by: Qt User Interface Compiler version 5.15.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
import sys
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
if not MainWindow.objectName():
MainWindow.setObjectName(u\"MainWindow\")
MainWindow.resize(746, 478)
self.centralwidget = QWidget(MainWindow)
self.centralwidget.setObjectName(u\"centralwidget\")
self.groupBox = QGroupBox(self.centralwidget)
self.groupBox.setObjectName(u\"groupBox\")
self.groupBox.setGeometry(QRect(0, 10, 461, 81))
self.lineEdit = QLineEdit(self.groupBox)
self.lineEdit.setObjectName(u\"lineEdit\")
self.lineEdit.setGeometry(QRect(90, 20, 211, 20))
self.pushButton = QPushButton(self.groupBox)
self.pushButton.setObjectName(u\"pushButton\")
self.pushButton.setGeometry(QRect(400, 20, 51, 41))
self.lineEdit_2 = QLineEdit(self.groupBox)
self.lineEdit_2.setObjectName(u\"lineEdit_2\")
self.lineEdit_2.setGeometry(QRect(90, 50, 211, 20))
self.label_2 = QLabel(self.groupBox)
self.label_2.setObjectName(u\"label_2\")
self.label_2.setGeometry(QRect(10, 20, 71, 16))
self.label_3 = QLabel(self.groupBox)
self.label_3.setObjectName(u\"label_3\")
self.label_3.setGeometry(QRect(10, 50, 71, 16))
self.pushButton_5 = QPushButton(self.groupBox)
self.pushButton_5.setObjectName(u\"pushButton_5\")
self.pushButton_5.setGeometry(QRect(320, 20, 75, 23))
self.pushButton_6 = QPushButton(self.groupBox)
self.pushButton_6.setObjectName(u\"pushButton_6\")
self.pushButton_6.setGeometry(QRect(320, 50, 75, 23))
self.textBrowser = QTextBrowser(self.centralwidget)
self.textBrowser.setObjectName(u\"textBrowser\")
self.textBrowser.setGeometry(QRect(480, 30, 256, 421))
self.label = QLabel(self.centralwidget)
self.label.setObjectName(u\"label\")
self.label.setGeometry(QRect(490, 0, 81, 31))
self.groupBox_2 = QGroupBox(self.centralwidget)
self.groupBox_2.setObjectName(u\"groupBox_2\")
self.groupBox_2.setGeometry(QRect(0, 90, 461, 121))
self.lineEdit_3 = QLineEdit(self.groupBox_2)
self.lineEdit_3.setObjectName(u\"lineEdit_3\")
self.lineEdit_3.setGeometry(QRect(90, 20, 211, 20))
self.pushButton_2 = QPushButton(self.groupBox_2)
self.pushButton_2.setObjectName(u\"pushButton_2\")
self.pushButton_2.setGeometry(QRect(400, 40, 51, 41))
self.lineEdit_4 = QLineEdit(self.groupBox_2)
self.lineEdit_4.setObjectName(u\"lineEdit_4\")
self.lineEdit_4.setGeometry(QRect(90, 50, 211, 20))
self.label_4 = QLabel(self.groupBox_2)
self.label_4.setObjectName(u\"label_4\")
self.label_4.setGeometry(QRect(10, 20, 51, 16))
self.label_5 = QLabel(self.groupBox_2)
self.label_5.setObjectName(u\"label_5\")
self.label_5.setGeometry(QRect(10, 50, 71, 16))
self.label_10 = QLabel(self.groupBox_2)
self.label_10.setObjectName(u\"label_10\")
self.label_10.setGeometry(QRect(10, 80, 71, 16))
self.lineEdit_9 = QLineEdit(self.groupBox_2)
self.lineEdit_9.setObjectName(u\"lineEdit_9\")
self.lineEdit_9.setGeometry(QRect(90, 80, 211, 20))
self.pushButton_7 = QPushButton(self.groupBox_2)
self.pushButton_7.setObjectName(u\"pushButton_7\")
self.pushButton_7.setGeometry(QRect(320, 20, 75, 23))
self.pushButton_8 = QPushButton(self.groupBox_2)
self.pushButton_8.setObjectName(u\"pushButton_8\")
self.pushButton_8.setGeometry(QRect(320, 50, 75, 23))
self.pushButton_9 = QPushButton(self.groupBox_2)
self.pushButton_9.setObjectName(u\"pushButton_9\")
self.pushButton_9.setGeometry(QRect(320, 80, 75, 23))
self.groupBox_3 = QGroupBox(self.centralwidget)
self.groupBox_3.setObjectName(u\"groupBox_3\")
self.groupBox_3.setGeometry(QRect(0, 210, 461, 81))
self.lineEdit_5 = QLineEdit(self.groupBox_3)
self.lineEdit_5.setObjectName(u\"lineEdit_5\")
self.lineEdit_5.setGeometry(QRect(90, 20, 211, 20))
self.pushButton_3 = QPushButton(self.groupBox_3)
self.pushButton_3.setObjectName(u\"pushButton_3\")
self.pushButton_3.setGeometry(QRect(400, 20, 51, 41))
self.lineEdit_6 = QLineEdit(self.groupBox_3)
self.lineEdit_6.setObjectName(u\"lineEdit_6\")
self.lineEdit_6.setGeometry(QRect(90, 50, 211, 20))
self.label_6 = QLabel(self.groupBox_3)
self.label_6.setObjectName(u\"label_6\")
self.label_6.setGeometry(QRect(10, 20, 71, 16))
self.label_7 = QLabel(self.groupBox_3)
self.label_7.setObjectName(u\"label_7\")
self.label_7.setGeometry(QRect(10, 50, 71, 16))
self.pushButton_10 = QPushButton(self.groupBox_3)
self.pushButton_10.setObjectName(u\"pushButton_10\")
self.pushButton_10.setGeometry(QRect(320, 20, 75, 23))
self.pushButton_11 = QPushButton(self.groupBox_3)
self.pushButton_11.setObjectName(u\"pushButton_11\")
self.pushButton_11.setGeometry(QRect(320, 50, 75, 23))
self.groupBox_4 = QGroupBox(self.centralwidget)
self.groupBox_4.setObjectName(u\"groupBox_4\")
self.groupBox_4.setGeometry(QRect(0, 290, 461, 81))
self.lineEdit_7 = QLineEdit(self.groupBox_4)
self.lineEdit_7.setObjectName(u\"lineEdit_7\")
self.lineEdit_7.setGeometry(QRect(90, 20, 211, 20))
self.pushButton_4 = QPushButton(self.groupBox_4)
self.pushButton_4.setObjectName(u\"pushButton_4\")
self.pushButton_4.setGeometry(QRect(400, 20, 51, 41))
self.lineEdit_8 = QLineEdit(self.groupBox_4)
self.lineEdit_8.setObjectName(u\"lineEdit_8\")
self.lineEdit_8.setGeometry(QRect(90, 50, 211, 20))
self.label_8 = QLabel(self.groupBox_4)
self.label_8.setObjectName(u\"label_8\")
self.label_8.setGeometry(QRect(10, 20, 71, 16))
self.label_9 = QLabel(self.groupBox_4)
self.label_9.setObjectName(u\"label_9\")
self.label_9.setGeometry(QRect(10, 50, 71, 16))
self.pushButton_12 = QPushButton(self.groupBox_4)
self.pushButton_12.setObjectName(u\"pushButton_12\")
self.pushButton_12.setGeometry(QRect(320, 20, 75, 23))
self.pushButton_13 = QPushButton(self.groupBox_4)
self.pushButton_13.setObjectName(u\"pushButton_13\")
self.pushButton_13.setGeometry(QRect(320, 50, 75, 23))
self.groupBox_5 = QGroupBox(self.centralwidget)
self.groupBox_5.setObjectName(u\"groupBox_5\")
self.groupBox_5.setGeometry(QRect(0, 370, 461, 81))
self.lineEdit_10 = QLineEdit(self.groupBox_5)
self.lineEdit_10.setObjectName(u\"lineEdit_10\")
self.lineEdit_10.setGeometry(QRect(90, 20, 211, 20))
self.pushButton_14 = QPushButton(self.groupBox_5)
self.pushButton_14.setObjectName(u\"pushButton_14\")
self.pushButton_14.setGeometry(QRect(400, 20, 51, 41))
self.lineEdit_11 = QLineEdit(self.groupBox_5)
self.lineEdit_11.setObjectName(u\"lineEdit_11\")
self.lineEdit_11.setGeometry(QRect(90, 50, 211, 20))
self.label_11 = QLabel(self.groupBox_5)
self.label_11.setObjectName(u\"label_11\")
self.label_11.setGeometry(QRect(10, 20, 71, 16))
self.label_12 = QLabel(self.groupBox_5)
self.label_12.setObjectName(u\"label_12\")
self.label_12.setGeometry(QRect(10, 50, 71, 16))
self.pushButton_15 = QPushButton(self.groupBox_5)
self.pushButton_15.setObjectName(u\"pushButton_15\")
self.pushButton_15.setGeometry(QRect(320, 20, 75, 23))
self.pushButton_16 = QPushButton(self.groupBox_5)
self.pushButton_16.setObjectName(u\"pushButton_16\")
self.pushButton_16.setGeometry(QRect(320, 50, 75, 23))
self.label_14 = QLabel(self.centralwidget)
self.label_14.setObjectName(u\"label_14\")
self.label_14.setGeometry(QRect(30, 720, 411, 16))
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QStatusBar(MainWindow)
self.statusbar.setObjectName(u\"statusbar\")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QMetaObject.connectSlotsByName(MainWindow)
# setupUi
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(QCoreApplication.translate(\"MainWindow\", u\"\\u840c\\u7528-4.0\\u7248\", None))
self.groupBox.setTitle(QCoreApplication.translate(\"MainWindow\", u\"\\u529f\\u80fd1\\uff1a\\u6587\\u4ef6\\u5939\\u6240\\u6709\\u56fe\\u7247\\u62fc\\u63a5\\u5e76\\u8d4b\\u4e88\\u6587\\u4ef6\\u5939\\u540d\\u79f0\", None))
self.pushButton.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u6267\\u884c\", None))
self.lineEdit_2.setText(\"\")
self.label_2.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u8bfb\\u53d6\\u5730\\u5740\", None))
self.label_3.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u5b58\\u653e\\u5730\\u5740\", None))
self.pushButton_5.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u9009\\u53d6\\u5730\\u5740\", None))
self.pushButton_6.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u9009\\u53d6\\u5730\\u5740\", None))
self.label.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u901a\\u77e5\\u680f\", None))
self.groupBox_2.setTitle(QCoreApplication.translate(\"MainWindow\", u\"\\u529f\\u80fd2\\uff1a\\u4ece\\u6587\\u4ef6\\u5939\\u4e2d\\u627e\\u51fa\\u5e76\\u5b58\\u653e\", None))
self.pushButton_2.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u6267\\u884c\", None))
self.label_4.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u5b66\\u751fexcel\", None))
self.label_5.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u8bfb\\u53d6\\u5730\\u5740\", None))
self.label_10.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u5b58\\u653e\\u5730\\u5740\", None))
self.pushButton_7.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u9009\\u53d6\\u6587\\u4ef6\", None))
self.pushButton_8.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u9009\\u53d6\\u5730\\u5740\", None))
self.pushButton_9.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u9009\\u53d6\\u5730\\u5740\", None))
self.groupBox_3.setTitle(QCoreApplication.translate(\"MainWindow\", u\"\\u529f\\u80fd3\\uff1a\\u6839\\u636e\\u8f93\\u5165excel\\u521b\\u5efa\\u5b66\\u751f\\u59d3\\u540d\\u6587\\u4ef6\\u5939\", None))
self.pushButton_3.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u6267\\u884c\", None))
self.label_6.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u5b66\\u751fexcel\", None))
self.label_7.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u5b58\\u653e\\u5730\\u5740\", None))
self.pushButton_10.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u9009\\u53d6\\u6587\\u4ef6\", None))
self.pushButton_11.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u9009\\u53d6\\u5730\\u5740\", None))
self.groupBox_4.setTitle(QCoreApplication.translate(\"MainWindow\", u\"\\u529f\\u80fd4\\uff1a\\u68c0\\u67e5\\u8c01\\u672a\\u63d0\\u4ea4\\u5065\\u5eb7\\u6570\\u636e\", None))
self.pushButton_4.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u6267\\u884c\", None))
self.label_8.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u5b66\\u751fexcel\", None))
self.label_9.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u6570\\u636e\\u5730\\u5740\", None))
self.pushButton_12.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u9009\\u53d6\\u6587\\u4ef6\", None))
self.pushButton_13.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u9009\\u53d6\\u5730\\u5740\", None))
self.groupBox_5.setTitle(QCoreApplication.translate(\"MainWindow\", u\"\\u529f\\u80fd5\\uff1a\\u8bc6\\u522b\\u56fe\\u7247\\u4e2d\\u7684\\u59d3\\u540d\\uff0c\\u4e3a\\u56fe\\u7247\\u8d4b\\u4e88\\u65b0\\u540d\\u5b57\", None))
self.pushButton_14.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u6267\\u884c\", None))
self.label_11.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u5b66\\u751fexcel\", None))
self.label_12.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u6570\\u636e\\u5730\\u5740\", None))
self.pushButton_15.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u9009\\u53d6\\u6587\\u4ef6\", None))
self.pushButton_16.setText(QCoreApplication.translate(\"MainWindow\", u\"\\u9009\\u53d6\\u5730\\u5740\", None))
# retranslateUi
if __name__ == \'__main__\':
app = QApplication(sys.argv) # 创建应用程序
mainwindow = QMainWindow() # 创建主窗口
ui = Ui_MainWindow() # 调用中的主窗口
ui.setupUi(mainwindow) # 向主窗口添加控件
mainwindow.show() # 显示窗口
sys.exit(app.exec_()) # 程序执行循环
当然界面和功能是分离的啦!
哎呀,没想少年你还能看到这里,那我必须要给你讲一下!
这里没什么好说的啦,就是easyocr的模型,我因为电脑上有GPU,会跑的快一点。CPU对于这种深度学习模型可能会比较慢,不过无所谓啦。等一等就行。
from PySide2 import QtWidgets
from PySide2.QtWidgets import *
from uid import Ui_MainWindow
import sys
from PIL import Image
import re
import easyocr
import os
import xlrd
import torch.jit
import easyocr.model.vgg_model
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.setupUi(self)
self.pushButton.clicked.connect(self.butten)
self.pushButton_2.clicked.connect(self.butten2)
self.pushButton_3.clicked.connect(self.butten3)
self.pushButton_4.clicked.connect(self.butten4)
self.pushButton_5.clicked.connect(self.xuandi)
self.pushButton_6.clicked.connect(self.xuandi2)
self.pushButton_7.clicked.connect(self.xuandi3)
self.pushButton_8.clicked.connect(self.xuandi4)
self.pushButton_9.clicked.connect(self.xuandi5)
self.pushButton_10.clicked.connect(self.xuandi6)
self.pushButton_11.clicked.connect(self.xuandi7)
self.pushButton_12.clicked.connect(self.xuandi8)
self.pushButton_13.clicked.connect(self.xuandi9)
self.pushButton_14.clicked.connect(self.zhitupian)
self.pushButton_15.clicked.connect(self.xuandi10)
self.pushButton_16.clicked.connect(self.xuandi11)
def script_method(fn, _rcb=None):
return fn
def script(obj, optimize=True, _frames_up=0, _rcb=None):
return obj
def xuandi5(self):
m = QtWidgets.QFileDialog.getExistingDirectory(None, \"选取文件夹\", \"C:/\") # 起始路径
self.lineEdit_9.setText(m)
def xuandi6(self):
m = QtWidgets.QFileDialog.getOpenFileName(None, \"选取文件\", \"C:/\") # 起始路径
self.lineEdit_5.setText(m[0])
def butten(self):
csdata=self.lineEdit.text();
cfdata=self.lineEdit_2.text();
csdata=csdata.replace(\'\\\\\',\'/\')
cfdata=cfdata.replace(\'\\\\\',\'/\')
name=csdata.split(\"/\");
filepath=os.listdir(csdata)
kk=0;
for k in filepath:
kk+=1;
# num=kk/3
# if kk%3!=0:
# num=num+1;
w=500;
h=1000;
newImage=Image.new(\'RGB\',(int(kk*w),int(h)),\'WHITE\');
x=0
y=0
for imf in filepath:
print(imf)
im=Image.open(csdata+\'/\'+imf)
im=im.resize((w,h))
newImage.paste(im,(x,y))
x+=w
newImage.save(cfdata+\'/\'+name[-1]+\'.jpg\')
self.textBrowser.setText(name[-1]+\'的图片已经拼接完成啦!\')
def butten2(self):
stu = self.lineEdit_3.text();
csdata = self.lineEdit_4.text();
cfdata = self.lineEdit_9.text();
stu = stu.replace(\'\\\\\', \'/\')
csdata = csdata.replace(\'\\\\\', \'/\')
cfdata = cfdata.replace(\'\\\\\', \'/\')
data = xlrd.open_workbook(stu)
shet = data.sheet_by_index(0)
student = []
stuk = []
for i in range(shet.nrows):
student.append(shet.cell_value(i, 0))
stuk.append(shet.cell_value(i, 0))
pathlist = os.listdir(csdata);
lenstu = len(student)
for i in range(lenstu):
pinjie = []
for fn in pathlist:
m = re.search(student[i], fn)
if m != None:
pinjie.append(fn)
pjlen = len(pinjie);
if pjlen != 0:
w = 500;
h = 1000;
newImage = Image.new(\'RGB\', (int(pjlen * w), int(h)), \'WHITE\');
x = 0
y = 0
for imf in range(pjlen):
im = Image.open(csdata + \'/\' + pinjie[imf])
im = im.resize((w, h))
newImage.paste(im, (x, y))
x += w
isExists = os.path.exists(cfdata + \'/\' + student[i])
if not isExists:
os.makedirs(cfdata + \'/\' + student[i])
newImage.save(cfdata + \'/\' + student[i] + \'/\' + student[i] + \'.jpg\')
stuk.remove(student[i])
number = shet.nrows
lenth = len(stuk)
queshi = number - lenth;
if lenth == 0:
self.textBrowser.setText(\'查找并存储分类完毕!已经全部交齐\')
else:
self.textBrowser.append(
\"查找并存储分类完成情况如下:\\n\" + \"应存储分类:\" + str(number) + \"\\n实存储分类:\" + str(queshi) + \"\\n未交:\" + str(lenth) + \"\\n缺失学生名单如下:\\n\")
for i in range(len(stuk)):
self.textBrowser.append(str(i + 1) + \' \' + stuk[i] + \'\\n\')
def butten3(self):
stu=self.lineEdit_5.text();
cfdata=self.lineEdit_6.text();
stu=stu.replace(\'\\\\\',\'/\')
cfdata = cfdata.replace(\'\\\\\', \'/\')
data = xlrd.open_workbook(stu)
shet = data.sheet_by_index(0)
for i in range(shet.nrows):
isExists = os.path.exists(cfdata + \'\\\\\' + shet.cell_value(i, 0))
if not isExists:
os.makedirs(cfdata + \'\\\\\' + shet.cell_value(i, 0))
self.textBrowser.setText(\'每个学生的文件夹已经创建完成!\')
def butten4(self):
stu = self.lineEdit_7.text();
csdata = self.lineEdit_8.text();
stu = stu.replace(\'\\\\\', \'/\')
csdata = csdata.replace(\'\\\\\', \'/\')
data = xlrd.open_workbook(stu)
shet = data.sheet_by_index(0)
student=[];
for i in range(shet.nrows):
student.append(shet.cell_value(i, 0))
pths = os.listdir(csdata)
true = 0;
for dir in pths:
pth2 = os.listdir(csdata + \'/\' + dir)
for name in pth2:
zname = name.split(\'.\')[0]
if zname == dir:
true = 1;
if true == 1:
student.remove(dir)
true = 0;
number=shet.nrows
lenth=len(student)
queshi=number-lenth;
if lenth==0:
self.textBrowser.setText(\'检查完毕!已经全部交齐\')
else:
self.textBrowser.append(\"检查情况如下:\\n\"+\"应交:\"+str(number)+\"\\n实交:\"+str(queshi)+\"\\n未交:\"+str(lenth)+\"\\n缺失学生名单如下:\\n\")
for i in range(len(student)):
self.textBrowser.append(str(i+1)+\' \'+student[i]+\'\\n\')
def zhitupian(self):
script_method1 = torch.jit.script_method
script1 = torch.jit.script
torch.jit.script_method = script_method1
torch.jit.script = script1
stu = self.lineEdit_10.text();
csdata = self.lineEdit_11.text();
stu = stu.replace(\'\\\\\', \'/\')
csdata = csdata.replace(\'\\\\\', \'/\')
path = csdata
file = os.listdir(path)
data = xlrd.open_workbook(stu)
shet = data.sheet_by_index(0)
reader = easyocr.Reader([\'ch_sim\'])
student = []
stuk = []
for i in range(shet.nrows):
student.append(shet.cell_value(i, 0))
stuk.append(shet.cell_value(i, 0))
sjm = 100
for name in file:
print(name)
OCRresult = reader.readtext(path + \'/\' + name);
k = 1;
for res in OCRresult:
strn = res[1];
for stuname in range(len(student)):
m = strn.find(student[stuname])
print(m)
if m != -1 and k == 1:
print(student[stuname])
self.textBrowser.append(
\"图片识别情况如下:\\n\"+student[stuname]+\'识别成功!\\n\')
os.rename(path + \'/\' + name, path + \'/\' + student[stuname] + str(sjm) + \'.jpg\')
sjm += 1;
k = 0
self.textBrowser.append(\'--------识别完成 -------\')
终于完工了!
显然非常的成功,还等什么快来试一下吧!
【vue3项目】解决 “TypeError: Cannot read properties of undefined (reading ‘xxx‘)“
darknet框架(两种版本)编译与使用--yolo训练自己的数据集
吴恩达机器学习 作业一线性回归python实现(注释超级详细)
springboot实现mysql主从_基于 SpringBoot,来实现MySQL读写分离技术
wallys/3×3 MIMO 802.11ac Mini PCIe2,4GHz / 5GHz Wireless
ORACLE分区表转换在线重定义DBMS_REDEFINITION
5天学会mysql_5天学完《MySQL必知必会》学习笔记之第四天