相比于上一篇文章,主要在enterTest1.py文件里改动,实现需要一定条件才能进入第二个界面。
上一篇文章的链接:
源代码:
链接:https://pan.baidu.com/s/1-cwEfc8XiiSGGGxZkWRhQw
提取码:6vli
main.py
# 这是一个示例 Python 脚本。
# 按 Shift+F10 执行或将其替换为您的代码。
# 按 双击 Shift 在所有地方搜索类、文件、工具窗口、操作和设置。
import sys
# from PyQt5.QtWidgets import QApplication, QMainWindow, QFileDialog
from PyQt5.QtWidgets import QApplication
from enterTest1 import FirstWindowActions
# 从enterTest1里导入FirstWindowActions功能(函数)
if __name__ == '__main__':
# 界面的入口,在这里需要定义QApplication对象,之后界面跳转时不用重新定义,只需要调用show()函数jike
app = QApplication(sys.argv)
# 显示创建的界面
MainWindow = FirstWindowActions() # 创建窗体对象
MainWindow.show() # 显示窗体
sys.exit(app.exec_()) # 程序关闭时退出进程
enterTest1.py
import sys
import enterTest2
import test1
from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QFileDialog, QMessageBox
from PyQt5 import QtWidgets
# 这里定义的第一个界面的后端代码需要继承两个类
class FirstWindowActions(test1.Ui_MainWindow, QMainWindow):
def __init__(self):
super(test1.Ui_MainWindow, self).__init__()
# 创建界面
self.setupUi(self)
self.pushButton.clicked.connect(self.click_login_button)
def click_login_button(self):
"""点击登录按钮,跳转到相应界面"""
username = self.lineEdit.text()
password = self.lineEdit_2.text()
# 检查用户名和密码
if username == "root" and password == "root123":
self.scend_window = enterTest2.SecondWindowActions()
self.scend_window.show()
# 关闭第一个界面
self.close()
else:
QMessageBox.warning(self, "登录失败", "用户名或密码错误")
enterTest2.py
import test2
from PyQt5.QtWidgets import QApplication, QMainWindow
class SecondWindowActions(test2.Ui_MainWindow, QMainWindow):
def __init__(self):
super(test2.Ui_MainWindow, self).__init__()
#调用 setupUi 方法来初始化和设置这个窗口类的用户界面。这里的 self 指的是主窗口类的实例
self.setupUi(self)
# self.pushButton_4.clicked.connect(self.click_login_button2)
test1.py
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import QPalette, QPixmap, QBrush
from PyQt5.QtWidgets import QApplication, QMainWindow
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(943, 641)
# 给MainWindow设置背景图片
# palette = QPalette()
# palette.setBrush(QPalette.Background, QBrush(QPixmap('D:\\python\\RRJ\\pycharmproject\\Practice\\chep2\\bdd'
# '\\background3.jpg')))
# MainWindow.setPalette(palette)
# # 给MainWindow设置背景图片
# palette = QPalette()
# palette.setBrush(QPalette.Background, QBrush(QPixmap("D:\Softwares\Anaconda3\Project\pythonProject1\sumiao\face.jpg")))
# MainWindow.setPalette(palette)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(140, 220, 101, 31))
self.label_2.setStyleSheet("font:32px;")
self.label_2.setObjectName("label_2")
self.label_3 = QtWidgets.QLabel(self.centralwidget)
self.label_3.setGeometry(QtCore.QRect(140, 320, 101, 31))
self.label_3.setStyleSheet("font:32px;")
self.label_3.setObjectName("label_3")
self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit.setGeometry(QtCore.QRect(250, 220, 181, 31))
self.lineEdit.setObjectName("lineEdit")
###############################################################
self.lineEdit.setStyleSheet("font:26px;")
self.lineEdit.setDragEnabled(True)
self.lineEdit.setPlaceholderText("")
###############################################################
self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_2.setGeometry(QtCore.QRect(250, 320, 181, 31))
self.lineEdit_2.setObjectName("lineEdit_2")
###############################################################
self.lineEdit_2.setEchoMode(QtWidgets.QLineEdit.Password)
###############################################################
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(180, 410, 181, 51))
self.pushButton.setStyleSheet("color:rgb(101,153,26);\n"
"background-color:rgb(198,224,205);\n"
"hover{color:red};\n"
"border-radius:6px;\n"
"font:28px;")
self.pushButton.setObjectName("pushButton")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(170, 50, 651, 101))
self.label.setStyleSheet("border-width:0px;\n"
"border-style:solid;\n"
"border-color:rgb(50, 50, 50);\n"
"font:54px;\n"
"\n"
"color:rgb(255, 170, 0)")
self.label.setObjectName("label")
self.label_6 = QtWidgets.QLabel(self.centralwidget)
self.label_6.setGeometry(QtCore.QRect(490, 170, 361, 361))
# self.label_6.setStyleSheet("border-width:1px;\n"
# "border-style:solid;")
self.label_6.setText("")
self.label_6.setObjectName("label_6")
# 给label添加背景图片
# png = QPixmap('D:\\download\\hg.jpg')
# png = QPixmap('D:\Softwares\Anaconda3\Project\pythonProject1\handwriting_detection\img.png')
png = QPixmap('./photos/img.png')
self.label_6.setPixmap(png)
# 图片自适应窗体大小
self.label_6.setScaledContents(True)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 943, 26))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "痤疮检测"))
self.label_2.setText(_translate("MainWindow", "用户名"))
self.label_3.setText(_translate("MainWindow", "密 码"))
self.pushButton.setText(_translate("MainWindow", "登录"))
self.label.setText(_translate("MainWindow", "欢迎使用人脸痤疮检测系统"))
self.lineEdit.setText(_translate("MainWindow", "root"))
self.lineEdit_2.setText(_translate("MainWindow", "root123"))
#################################################################################
# self.pushButton_2.setText(_translate("MainWindow", "分类登录"))
test2.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'test2.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
'''
这个文件用于显示PyQt,无需输入正确的账号和密码就可以登录进去
选择图片的时候只能选择28*28像素的图片,也就是TestDigitImgs的第一张图片
'''
import cv2
import numpy as np
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import QPixmap, QBrush
from PyQt5.QtWidgets import QFileDialog, QApplication
from PyQt5.QtGui import QIcon
from PyQt5.QtGui import QPalette
# from handwriting_detection import *
from torch.autograd import Variable
import torch.nn.functional as F
import torch
from torch import nn
from torch import optim
from torch.nn.parameter import Parameter
import torchvision
import torchvision.transforms as transforms
import torch.nn.functional as F
import numpy as np
# from model import *
import cv2
import os
import json
import torch
from PIL import Image
from torchvision import transforms
# import matplotlib.pyplot as plt
from model import resnet34
import cv2
import numpy as np
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import QPixmap, QBrush
from PyQt5.QtWidgets import QFileDialog, QApplication
from PyQt5.QtGui import QIcon
from PyQt5.QtGui import QPalette
# from handwriting_detection import *
from torch.autograd import Variable
import torch.nn.functional as F
import torch
from torch import nn
from torch import optim
from torch.nn.parameter import Parameter
import torchvision
import torchvision.transforms as transforms
import torch.nn.functional as F
import numpy as np
# from model import *
import cv2
import os
import json
import torch
from PIL import Image
from torchvision import transforms
# import matplotlib.pyplot as plt
from model import resnet34
import argparse
import time
from pathlib import Path
import cv2
import torch
import torch.backends.cudnn as cudnn
from numpy import random
from models.experimental import attempt_load
from utils.datasets import LoadStreams, LoadImages
from utils.general import check_img_size, check_requirements, check_imshow, non_max_suppression, apply_classifier, \
scale_coords, xyxy2xywh, strip_optimizer, set_logging, increment_path
from utils.plots import plot_one_box
from utils.torch_utils import select_device, load_classifier, time_synchronized
from docx import Document
from docx.shared import Cm
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT # 导入段落对齐包
from docx.enum.table import WD_TABLE_ALIGNMENT
from docx.enum.table import WD_ALIGN_VERTICAL
from docx.shared import RGBColor
from docx.shared import Pt
from docx.oxml.ns import qn
from docx.shared import Inches
from docx.enum.text import WD_ALIGN_PARAGRAPH,WD_LINE_SPACING
import datetime
from datetime import datetime
from docx2pdf import convert
res2 = "" #最终判定级别数
imgNamepath = "" # 选择的图片的路径
inputFile = "" # 生成的docx的路径
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
# 给MainWindow设置图标
# MainWindow.setWindowIcon(QIcon('D:\\download\\xj.ico')) # 路径错误找不到问题所在
# MainWindow.setWindowIcon(QIcon('D:\\Softwares\\Anaconda3\\Project\\pythonProject1\\sumiao\\shou.png'))
# 给MainWindow设置背景图片
# palette = QPalette()
# palette.setBrush(QPalette.Background, QBrush(QPixmap('D:\\python\\RRJ\\pycharmproject\\Practice\\chep2\\bdd'
# '\\background3.jpg')))
# MainWindow.setPalette(palette)
# 给MainWindow设置背景图片
# palette = QPalette()
# palette.setBrush(QPalette.Background, QBrush(QPixmap('"D:\\Softwares\\Anaconda3\\Project\\pythonProject1\\sumiao\\back.jpg"')))
# MainWindow.setPalette(palette)
MainWindow.resize(994, 900)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(10, 5, 975, 850))
self.label.setStyleSheet("font:28px;\n"
"border-style:solid;\n"
"border-width:1px;\n"
"border-color:rgb(0, 0, 0);\n"
"\n"
"")
self.label.setText("")
self.label.setObjectName("label")
self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_2.setGeometry(QtCore.QRect(50, 150, 121, 41))
self.pushButton_2.setStyleSheet("font:22px;")
self.pushButton_2.setObjectName("pushButton_2")
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(340, 30, 321, 81))
self.label_2.setStyleSheet("font: 75 26pt \"Segoe Print\";\n"
"color:rgb(255, 85, 0);\n"
"text-align:center;\n"
"letter-spacing:4pt;")
self.label_2.setObjectName("label_2")
self.line = QtWidgets.QFrame(self.centralwidget)
self.line.setGeometry(QtCore.QRect(10, 120, 972, 20))
self.line.setFrameShape(QtWidgets.QFrame.HLine)
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line.setObjectName("line")
self.line_2 = QtWidgets.QFrame(self.centralwidget)
self.line_2.setGeometry(QtCore.QRect(10, 270, 972, 16))
self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line_2.setObjectName("line_2")
self.lineEdit_3 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_3.setGeometry(QtCore.QRect(170, 150, 305, 41))
self.lineEdit_3.setObjectName("lineEdit_3")
#################################################################
self.lineEdit_4 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_4.setGeometry(QtCore.QRect(640, 150, 305, 41))
self.lineEdit_4.setObjectName("lineEdit_4")
#################################################################
self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_3.setGeometry(QtCore.QRect(50, 210, 895, 41))
self.pushButton_3.setStyleSheet("font: 22px;")
self.pushButton_3.setObjectName("pushButton_3")
self.pushButton_4 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_4.setGeometry(QtCore.QRect(520, 150, 121, 41))
self.pushButton_4.setStyleSheet("font:22px;")
self.pushButton_4.setObjectName("pushButton_4")
self.label_3 = QtWidgets.QLabel(self.centralwidget)
self.label_3.setGeometry(QtCore.QRect(50, 350, 411, 480))
self.label_3.setStyleSheet("font:28px;\n"
"border-style:solid;\n"
"border-width:1px;\n"
"border-color:rgb(45, 45, 45);\n"
"\n"
"")
self.label_3.setText("")
self.label_3.setObjectName("label_3")
self.label_4 = QtWidgets.QLabel(self.centralwidget)
self.label_4.setGeometry(QtCore.QRect(540, 350, 400, 480))
self.label_4.setStyleSheet("font:20px;\n"
"border-style:solid;\n"
"border-width:1px;\n"
"border-color:rgb(45, 45, 45);\n"
"\n"
"")
self.label_4.setText("")
self.label_4.setObjectName("label_4")
self.label_5 = QtWidgets.QLabel(self.centralwidget)
self.label_5.setGeometry(QtCore.QRect(220, 300, 91, 31))
self.label_5.setStyleSheet("font: 14pt \"Arial\";")
self.label_5.setObjectName("label_5")
self.label_6 = QtWidgets.QLabel(self.centralwidget)
self.label_6.setGeometry(QtCore.QRect(710, 300, 91, 31))
self.label_6.setStyleSheet("font: 14pt \"Arial\";")
self.label_6.setObjectName("label_6")
self.label.raise_()
self.pushButton_2.raise_()
self.line.raise_()
self.line_2.raise_()
self.label_2.raise_()
self.lineEdit_3.raise_()
self.lineEdit_4.raise_()
self.pushButton_3.raise_()
self.pushButton_4.raise_()
self.label_3.raise_()
self.label_4.raise_()
self.label_5.raise_()
self.label_6.raise_()
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 994, 26))
self.menubar.setObjectName("menubar")
self.menutest2 = QtWidgets.QMenu(self.menubar)
self.menutest2.setObjectName("menutest2")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.actiondemo1 = QtWidgets.QAction(MainWindow)
self.actiondemo1.setObjectName("actiondemo1")
self.actiondemo2 = QtWidgets.QAction(MainWindow)
self.actiondemo2.setObjectName("actiondemo2")
self.menutest2.addAction(self.actiondemo1)
self.menutest2.addAction(self.actiondemo2)
self.menubar.addAction(self.menutest2.menuAction())
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
# 按钮关联函数
self.pushButton_2.clicked.connect(self.openImage)
self.pushButton_3.clicked.connect(self.startAction)
##############################################################################
self.pushButton_4.clicked.connect(self.saveTextFile)
##############################################################################
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "痤疮检测"))
self.pushButton_2.setText(_translate("MainWindow", "选择图片"))
self.label_2.setText(_translate("MainWindow", "人脸痤疮检测系统"))
self.pushButton_3.setText(_translate("MainWindow", "开始"))
self.pushButton_4.setText(_translate("MainWindow", "保存报告"))
self.label_5.setText(_translate("MainWindow", "所选图像"))
self.label_6.setText(_translate("MainWindow", "检测结果"))
self.menutest2.setTitle(_translate("MainWindow", "test2"))
self.actiondemo1.setText(_translate("MainWindow", "demo1"))
self.actiondemo2.setText(_translate("MainWindow", "demo2"))
# 选择本地图片上传
def openImage(self):
global imgNamepath # 这里为了方便别的地方引用图片路径,将其设置为全局变量
# 弹出一个文件选择框,第一个返回值imgName记录选中的文件路径+文件名,第二个返回值imgType记录文件的类型
# QFileDialog就是系统对话框的那个类第一个参数是上下文,第二个参数是弹框的名字,第三个参数是默认打开的路径,第四个参数是需要的格式
# imgNamepath, imgType = QFileDialog.getOpenFileName(self.centralwidget, "选择图片",
# "D:\\python\\RRJ\\pycharmproject\\Practice\\chep2\\Image",
# "*.jpg;;*.png;;All Files(*)")
imgNamepath, imgType = QFileDialog.getOpenFileName(self.centralwidget, "选择图片",
"./data/images",
"*.jpg;;*.png;;All Files(*)")
# 通过文件路径获取图片文件,并设置图片长宽为label控件的长、宽
img = QtGui.QPixmap(imgNamepath).scaled(self.label_3.width(), self.label_3.height())
# 在label控件上显示选择的图片
self.label_3.setPixmap(img)
# 显示所选图片的路径
self.lineEdit_3.setText(imgNamepath)
'''以下为改动细节'''
# 保存图片到本地(第二种方式:首先提取相对应Qlabel中的图片,然后打开一个保存文件的弹出框,最后保存图片到选中的路径)
def saveTextFile(self): # 保存文本文件
fd,fp= QFileDialog.getSaveFileName(self.centralwidget, "保存PDF", "./report","PDF Files (*.pdf)")
f=open(fd,'w')
convert(inputFile, fd)
f.close()
self.lineEdit_4.setText(fd)
# 生成对应预测的数字
def startAction(self):
'''人脸显示'''
global res2
global imgNamepath
print(res2)
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
data_transform = transforms.Compose(
[transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])])
# load image
img_path = imgNamepath
assert os.path.exists(img_path), "file: '{}' dose not exist.".format(img_path)
img = Image.open(img_path)
# plt.imshow(img)
# [N, C, H, W]
img = data_transform(img)
# expand batch dimension
img = torch.unsqueeze(img, dim=0)
# read class_indict
json_path = './class_indices.json'
assert os.path.exists(json_path), "file: '{}' dose not exist.".format(json_path)
with open(json_path, "r") as f:
class_indict = json.load(f)
# create model
model = resnet34(num_classes=8).to(device)
# load model weights
weights_path = "./resNet34.pth"
assert os.path.exists(weights_path), "file: '{}' dose not exist.".format(weights_path)
model.load_state_dict(torch.load(weights_path, map_location=device))
# prediction
model.eval()
print_res = "" #痤疮分级打印内容
with torch.no_grad():
# predict class
output = torch.squeeze(model(img.to(device))).cpu()
predict = torch.softmax(output, dim=0)
predict_cla = torch.argmax(predict).numpy()
# print_res = "class: {} prob: {:.3}".format(class_indict[str(predict_cla)],
# predict[predict_cla].numpy())
# plt.title(print_res)
# for i in range(len(predict)):
# print("class: {:10} prob: {:.3}".format(class_indict[str(i)],
# predict[i].numpy()))
# plt.show()
# self.label_4.setText(print_res)
# print_res = "概率分布:"
# for i in range(len(predict)):
# print_res = print_res+"\n"
# print_res = print_res +str("class: {:1} prob: {:.3}".format(class_indict[str(i)],
# predict[i].numpy()))
# print_res = print_res+"\n"+"\n"
print_res = "痤疮分级结果:"
# print_res = print_res+"class: {} prob: {:.3}".format(class_indict[str(predict_cla)],
# predict[predict_cla].numpy())
print_res = print_res+" "+"{}级".format(class_indict[str(predict_cla)])+"\n"
res2 = class_indict[str(predict_cla)] # res2为字符串类型
res2 = int(res2) # 将res2转为int类型
# self.label_4.setScaledContents(True)
# self.label_4.setText(print_res)
###########################################痤疮分类################################################
img_path = imgNamepath
path = img_path
img_name = ""
index = path.rfind("/")
im0 = 0
path_pre = "" #文件生成的根目录
ill = [] # 痤疮个数,0到7分别对应八类痤疮的个数
if index != -1:
img_name = path[index+1:]
else:
img_name = path
# print_res2 = print_res + "\n"
print_res2 = print_res+"\n"+"\n"+"各类别皮损检测数量:" #print_res2为痤疮分类模块在控件中的打印结果
##############################################################
parser = argparse.ArgumentParser()
parser.add_argument('--weights', nargs='+', type=str, default='best.pt', help='model.pt path(s)')
parser.add_argument('--source', type=str, default=img_path, help='source') # file/folder, 0 for webcam
parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)')
parser.add_argument('--conf-thres', type=float, default=0.25, help='object confidence threshold')
parser.add_argument('--iou-thres', type=float, default=0.45, help='IOU threshold for NMS')
parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
parser.add_argument('--view-img', action='store_true', help='display results')
parser.add_argument('--save-txt', action='store_true', help='save results to *.txt')
parser.add_argument('--save-conf', action='store_true', help='save confidences in --save-txt labels')
parser.add_argument('--nosave', action='store_true', help='do not save images/videos')
parser.add_argument('--classes', nargs='+', type=int, help='filter by class: --class 0, or --class 0 2 3')
parser.add_argument('--agnostic-nms', action='store_true', help='class-agnostic NMS')
parser.add_argument('--augment', action='store_true', help='augmented inference')
parser.add_argument('--update', action='store_true', help='update all models')
parser.add_argument('--project', default='runs/detect', help='save results to project/name')
parser.add_argument('--name', default='exp', help='save results to project/name')
parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment')
opt = parser.parse_args()
print(opt)
check_requirements(exclude=('pycocotools', 'thop'))
with torch.no_grad():
if opt.update: # update all models (to fix SourceChangeWarning)
for opt.weights in ['yolov5s.pt', 'yolov5m.pt', 'yolov5l.pt', 'yolov5x.pt']:
detect()
strip_optimizer(opt.weights)
else:
save_img=False
source, weights, view_img, save_txt, imgsz = opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size
save_img = not opt.nosave and not source.endswith('.txt') # save inference images
webcam = source.isnumeric() or source.endswith('.txt') or source.lower().startswith(
('rtsp://', 'rtmp://', 'http://', 'https://'))
# Directories
save_dir = Path(increment_path(Path(opt.project) / opt.name, exist_ok=opt.exist_ok)) # increment run
(save_dir / 'labels' if save_txt else save_dir).mkdir(parents=True, exist_ok=True) # make dir
# Initialize
set_logging()
device = select_device(opt.device)
half = device.type != 'cpu' # half precision only supported on CUDA
# Load model
model = attempt_load(weights, map_location=device) # load FP32 model
stride = int(model.stride.max()) # model stride
imgsz = check_img_size(imgsz, s=stride) # check img_size
if half:
model.half() # to FP16
# Second-stage classifier
classify = False
if classify:
modelc = load_classifier(name='resnet101', n=2) # initialize
modelc.load_state_dict(torch.load('weights/resnet101.pt', map_location=device)['model']).to(device).eval()
# Set Dataloader
vid_path, vid_writer = None, None
if webcam:
view_img = check_imshow()
cudnn.benchmark = True # set True to speed up constant image size inference
dataset = LoadStreams(source, img_size=imgsz, stride=stride)
else:
dataset = LoadImages(source, img_size=imgsz, stride=stride)
# Get names and colors
names = model.module.names if hasattr(model, 'module') else model.names
# colors = [[random.randint(0, 255) for _ in range(3)] for _ in names]
colors = [[242,140,165],[157, 217, 165],[255, 240, 140],[161, 177, 235],[250, 192, 152],
[200, 142, 217],[160, 233, 249],[247, 152, 242],[223, 247, 162],[252, 222, 233]]
# Run inference
if device.type != 'cpu':
model(torch.zeros(1, 3, imgsz, imgsz).to(device).type_as(next(model.parameters()))) # run once
t0 = time.time()
for path, img, im0s, vid_cap in dataset:
img = torch.from_numpy(img).to(device)
img = img.half() if half else img.float() # uint8 to fp16/32
img /= 255.0 # 0 - 255 to 0.0 - 1.0
if img.ndimension() == 3:
img = img.unsqueeze(0)
# Inference
t1 = time_synchronized()
pred = model(img, augment=opt.augment)[0]
# Apply NMS
pred = non_max_suppression(pred, opt.conf_thres, opt.iou_thres, classes=opt.classes, agnostic=opt.agnostic_nms)
t2 = time_synchronized()
# Apply Classifier
if classify:
pred = apply_classifier(pred, modelc, img, im0s)
# Process detections
for i, det in enumerate(pred): # detections per image
if webcam: # batch_size >= 1
p, s, im0, frame = path[i], '%g: ' % i, im0s[i].copy(), dataset.count
else:
p, s, im0, frame = path, '', im0s, getattr(dataset, 'frame', 0)
p = Path(p) # to Path
save_path = str(save_dir / p.name) # img.jpg
txt_path = str(save_dir / 'labels' / p.stem) + ('' if dataset.mode == 'image' else f'_{frame}') # img.txt
s += '%gx%g ' % img.shape[2:] # print string
gn = torch.tensor(im0.shape)[[1, 0, 1, 0]] # normalization gain whwh
if len(det):
# Rescale boxes from img_size to im0 size
det[:, :4] = scale_coords(img.shape[2:], det[:, :4], im0.shape).round()
# Print results
for c in det[:, -1].unique():
n = (det[:, -1] == c).sum() # detections per class
s += f"{n} {names[int(c)]}{'s' * (n > 1)}, " # add to string
# Write results
# for *xyxy, conf, cls in reversed(det):
# if save_txt: # Write to file
# xywh = (xyxy2xywh(torch.tensor(xyxy).view(1, 4)) / gn).view(-1).tolist() # normalized xywh
# line = (cls, *xywh, conf) if opt.save_conf else (cls, *xywh) # label format
# with open(txt_path + '.txt', 'a') as f:
# f.write(('%g ' * len(line)).rstrip() % line + '\n')
# if save_img or view_img: # Add bbox to image
# label = f'{names[int(cls)]} {conf:.2f}'
# plot_one_box(xyxy, im0, label=label, color=colors[int(cls)], line_thickness=3)
############################################################################################
# Write results+计数
# count=0
# person_count = 0
# cup_count = 0
closed_comedo_count = 0
opend_comedo_count = 0
papule_count = 0
pustule_count = 0
nodule_count = 0
atrophic_scar_count = 0
hypertrophic_scar_count = 0
melasma_count = 0
nevus_count = 0
other_count = 0
for *xyxy, conf, cls in reversed(det):
if save_txt: # Write to file
xywh = (xyxy2xywh(torch.tensor(xyxy).view(1, 4)) / gn).view(-1).tolist() # normalized xywh
line = (cls, *xywh, conf) if opt.save_conf else (cls, *xywh) # label format
with open(txt_path + '.txt', 'a') as f:
f.write(('%g ' * len(line)).rstrip() % line + '\n')
if save_img or view_img: # Add bbox to image
#c = int(cls)# integer class分类数
#label = '%s %.2f num: %d' % (names[int(cls)], conf, person_count)
label = f'{names[int(cls)]} {conf:.2f}'
plot_one_box(xyxy, im0, label=label, color=colors[int(cls)], line_thickness=3)
##########################分类计数##########################
# if int(cls) == 0:
# person_count += 1
# if int(cls) == 41:
# cup_count += 1
if int(cls) == 0:
closed_comedo_count += 1
if int(cls) == 1:
opend_comedo_count += 1
if int(cls) == 2:
papule_count += 1
if int(cls) == 3:
pustule_count += 1
if int(cls) == 4:
nodule_count += 1
if int(cls) == 5:
atrophic_scar_count += 1
if int(cls) == 6:
hypertrophic_scar_count += 1
if int(cls) == 7:
melasma_count += 1
if int(cls) == 8:
nevus_count += 1
if int(cls) == 9:
other_count += 1
# count = count+1
############################################################################################
# Print time (inference + NMS)
print(f'{s}Done. ({t2 - t1:.3f}s)')
# Stream results
if view_img:
##############################视频识别显示计数内容####################################
text = 'person_num:%d ' % (person_count)
cv2.putText(im0, text, (180, 50), cv2.FONT_HERSHEY_SIMPLEX, 2, (0, 0, 255), 5)
text = 'cup_num:%d ' % (cup_count)
cv2.putText(im0, text, (180, 120), cv2.FONT_HERSHEY_SIMPLEX, 2, (255, 0, 0), 5)
####################################################################################
cv2.imshow(str(p), im0)
cv2.waitKey(1) # 1 millisecond
# Save results (image with detections)
if save_img:
##############################视频识别显示计数内容####################################
# text = 'person_num:%d ' % (person_count)
# cv2.putText(im0, text, (180, 50), cv2.FONT_HERSHEY_SIMPLEX, 0.2, (0, 0, 255), 2)
# print(text)
# text = 'cup_num:%d ' % (cup_count)
# cv2.putText(im0, text, (180, 120), cv2.FONT_HERSHEY_SIMPLEX, 0.2, (255, 0, 0), 2)
# print(text)
text = 'closed_comedo_count:%d ' % (closed_comedo_count)
# cv2.putText(im0, text, (180, 50), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (0, 0, 255), 2)
print_res2 = print_res2 + "\n"+"\n"+ '闭口粉刺:%d ' % (closed_comedo_count)
ill.append(closed_comedo_count)
print(text)
text = 'opend_comedo_count:%d ' % (opend_comedo_count)
# cv2.putText(im0, text, (180, 120), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (0, 0, 255), 2)
print_res2 = print_res2 + "\n"+ '开口粉刺:%d ' % (closed_comedo_count)
ill.append(opend_comedo_count)
print(text)
text = 'papule_count:%d ' % (papule_count)
# cv2.putText(im0, text, (180, 190), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (0, 0, 255), 2)
print_res2 = print_res2 + "\n"+ '丘疹:%d ' % (papule_count)
ill.append(papule_count)
print(text)
text = 'pustule_count:%d ' % (pustule_count)
# cv2.putText(im0, text, (180, 260), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (0, 0, 255), 2)
print_res2 = print_res2 + "\n"+ '脓疱:%d ' % (pustule_count)
ill.append(pustule_count)
print(text)
text = 'nodule_count:%d ' % (nodule_count)
# cv2.putText(im0, text, (180, 330), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (0, 0, 255), 2)
print_res2 = print_res2 + "\n"+ '结节:%d ' % (nodule_count)
ill.append(nodule_count)
print(text)
text = 'atrophic_scar_count:%d ' % (atrophic_scar_count)
# cv2.putText(im0, text, (180, 400), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (0, 0, 255), 2)
print_res2 = print_res2 + "\n"+ '萎缩性瘢痕:%d ' % (atrophic_scar_count)
ill.append(atrophic_scar_count)
print(text)
text = 'hypertrophic_scar_count:%d ' % (hypertrophic_scar_count)
# cv2.putText(im0, text, (180, 470), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (0, 0, 255), 2)
print_res2 = print_res2 + "\n"+ '增生性瘢痕:%d ' % (hypertrophic_scar_count)
ill.append(hypertrophic_scar_count)
print(text)
text = 'melasma_count:%d ' % (melasma_count)
# cv2.putText(im0, text, (180, 540), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (0, 0, 255), 2)
print_res2 = print_res2 + "\n"+ '斑:%d ' % (melasma_count)
ill.append(melasma_count)
print(text)
text = 'nevus_count:%d ' % (nevus_count)
# cv2.putText(im0, text, (180, 610), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (0, 0, 255), 2)
print_res2 = print_res2 + "\n"+ '色素痣:%d ' % (nevus_count)
ill.append(nevus_count)
print(text)
text = 'other_count:%d ' % (other_count)
# cv2.putText(im0, text, (180, 680), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (0, 0, 255), 2)
print_res2 = print_res2 + "\n"+ '其他:%d ' % (other_count)
ill.append(other_count)
print(text)
####################################################################################
if dataset.mode == 'image':
cv2.imwrite(save_path, im0)
else: # 'video' or 'stream'
if vid_path != save_path: # new video
vid_path = save_path
if isinstance(vid_writer, cv2.VideoWriter):
vid_writer.release() # release previous video writer
if vid_cap: # video
fps = vid_cap.get(cv2.CAP_PROP_FPS)
w = int(vid_cap.get(cv2.CAP_PROP_FRAME_WIDTH))
h = int(vid_cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
else: # stream
fps, w, h = 30, im0.shape[1], im0.shape[0]
save_path += '.mp4'
vid_writer = cv2.VideoWriter(save_path, cv2.VideoWriter_fourcc(*'mp4v'), fps, (w, h))
vid_writer.write(im0)
if save_txt or save_img:
s = f"\n{len(list(save_dir.glob('labels/*.txt')))} labels saved to {save_dir / 'labels'}" if save_txt else ''
print(f"Results saved to {save_dir}{s}")
path_pre = f"{save_dir}{s}"
result_path_pdf = path_pre + "\\" +"result.pdf"
result_path_pdf = result_path_pdf.replace("\\", "/")
result_path = path_pre + "/" +img_name
result_path = result_path.replace("\\", "/")
# result_path_img = path_pre + "/" + "result.pdf"
# result_path_img = result_path_img.replace("\\", "/")
print(result_path)
print(f'Done. ({time.time() - t0:.3f}s)')
##############################################################
# print_res2 = print_res2 + "\n" + "\n" + "检测报告路径:" +"\n"+result_path_pdf
self.label_4.setText(print_res2)
##############################################################
'''人脸显示'''
'''
这里的show()相当于直接跳转到当前文件夹目录的handwriting_detection。
至于为什么在这个区域疯狂打印,是因为我在debug这里的时候,在这个位置突然报错退出了,所以开始一个变量一个变量的打印
'''
##########################################生成报告#############################################
# document = Document('./test.docx') # 新建文档
document = Document() # 新建文档
section_0 = document.sections[0]
#页边距
section_0.top_margin = Cm(1.0)
section_0.bottom_margin = Cm(1.0)
section_0.left_margin = Cm(1.5)
section_0.right_margin = Cm(1.5)
# print("上边距:", section_0.top_margin.cm)
#设置标题
Head = document.add_paragraph()
Head.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
run = Head.add_run('皮肤痤疮检测结果')
Head.paragraph_format.space_after = Pt(0)
run.font.size = Pt(20)
run.font.color.rgb = RGBColor(0,0,0)
# run.bold = True
#设置横线
# Turn off autofit 固定列宽
table = document.add_table(rows=1, cols=1)
table.autofit = True
# Add image to cell (0, 1)
cell = table.cell(0, 0)
paragraph = cell.paragraphs[0]
table.cell(0,0).paragraphs[0].paragraph_format.alignment=WD_PARAGRAPH_ALIGNMENT.CENTER
table.cell(0,0).vertical_alignment=WD_ALIGN_VERTICAL.BOTTOM
table.rows[0].height = Cm(0.05)
run0 = paragraph.add_run()
run0.add_picture('./photos/line.jpg', width=Inches(8))
###################################################
#检测时间
# import time
timestamp = int(time.time()) # 必须10位
time_local = time.localtime(timestamp)
now_time = time.strftime("%Y-%m-%d %H:%M:%S",time_local)
print(now_time) # 2023-04-16 13:32:16
weekList = ["周一","周二","周三","周四","周五","周六","周天"]
week = weekList[datetime.now().weekday()]
now = ' 检测时间:'+' '+str(now_time)+" "+str(week)
print(now)
print(str(res2)+"级")
p1 = document.add_paragraph()
p1.paragraph_format.space_before = Pt(0)
run = p1.add_run(now)
run.font.size = Pt(10)
run.font.name = "Times New Roman" # 设置西文是新罗马字体
run.element.rPr.rFonts.set(qn('w:eastAsia'), '宋体') # 设置中文是宋体
# 展示人脸检测结果
# Turn off autofit 固定列宽
table = document.add_table(rows=1, cols=2)
table.autofit = False
table.columns[0].width = Inches(6)
table.columns[1].width = Inches(1.4)
# Add image to cell (0, 1)
cell0 = table.cell(0, 0)
img_path0 = result_path
paragraph0 = cell0.paragraphs[0]
table.cell(0,0).paragraphs[0].paragraph_format.alignment=WD_PARAGRAPH_ALIGNMENT.RIGHT
table.cell(0,0).vertical_alignment=WD_ALIGN_VERTICAL.BOTTOM
run0 = paragraph0.add_run()
run0.add_picture(img_path0, width=Inches(4.6))
cell = table.cell(0, 1)
img_path = './photos/inf.jpg'
paragraph = cell.paragraphs[0]
table.cell(0,1).paragraphs[0].paragraph_format.alignment=WD_PARAGRAPH_ALIGNMENT.RIGHT
table.cell(0,1).vertical_alignment=WD_ALIGN_VERTICAL.BOTTOM
run = paragraph.add_run()
run.add_picture(img_path, width=Inches(1.1))
# px = document.add_paragraph()
# #痤疮等级
# p4 = document.add_paragraph()
# run4 = p4.add_run('脸部痤疮等级:'+" ")
# run4.font.size = Pt(15)
# run4.font.name = "Times New Roman" # 设置西文是新罗马字体
# run4.element.rPr.rFonts.set(qn('w:eastAsia'), '宋体') # 设置中文是宋体
# run4.bold = True
# run4 = p4.add_run(str(test2.res2)+"级")
# run4.font.size = Pt(15)
# run4.font.name = "Times New Roman" # 设置西文是新罗马字体
# run4.element.rPr.rFonts.set(qn('w:eastAsia'), '宋体') # 设置中文是宋体
#各类别检测数量
p4 = document.add_paragraph()
run = p4.add_run('脸部各类别痤疮数量:')
p4.paragraph_format.space_after = Pt(5)
run.font.size = Pt(15)
run.font.name = "Times New Roman" # 设置西文是新罗马字体
run.element.rPr.rFonts.set(qn('w:eastAsia'), '宋体') # 设置中文是宋体
run.bold = True
#各类别检测数量
# p6 = document.add_paragraph()
# run6 = p6.add_run('表一:')
# run6.font.size = Pt(20)
# run6.font.name = "Times New Roman" # 设置西文是新罗马字体
# run6.element.rPr.rFonts.set(qn('w:eastAsia'), '宋体') # 设置中文是宋体
# run6.bold = True
#类别表格
table = document.add_table(2, 10, style="Table Grid")
table.alignment = WD_TABLE_ALIGNMENT.CENTER
table.cell(0,0).vertical_alignment=WD_ALIGN_VERTICAL.CENTER
table.cell(0,0).paragraphs[0].paragraph_format.alignment=WD_ALIGN_PARAGRAPH.CENTER
table.rows[0].height=Cm(0.8)
table.rows[1].height=Cm(0.8)
# ill = ["闭口粉刺","开口粉刺","丘疹","脓疱","结节","萎缩性瘢痕","增生性瘢痕","斑","色素痣","其他"]
cell00 = table.cell(0, 0)
# cell1.width = Cm(2.7)
run = table.cell(0,0).paragraphs[0].add_run("闭口粉刺")
run.font.size = Pt(8)
cell01 = table.cell(0, 1)
run = table.cell(0,1).paragraphs[0].add_run(str(ill[0]))
run.font.size = Pt(8)
# table.cell(0, 1).width = Cm(1.5)
# table.cell(1, 1).width = Cm(1.5)
cell02 = table.cell(0, 2)
# cell2.width = Cm(2.8)
run = table.cell(0,2).paragraphs[0].add_run("开口粉刺")
run.font.size = Pt(8)
# table.cell(0, 3).width = Cm(1.5)
# table.cell(1, 3).width = Cm(1.5)
cell03 = table.cell(0, 3)
run = table.cell(0,3).paragraphs[0].add_run(str(ill[1]))
run.font.size = Pt(8)
cell04 = table.cell(0, 4)
# cell3.width = Cm(2.8)
run = table.cell(0,4).paragraphs[0].add_run("丘疹")
run.font.size = Pt(8)
table.cell(0, 5).width = Cm(1.5)
table.cell(1, 5).width = Cm(1.5)
cell05 = table.cell(0, 5)
run = table.cell(0,5).paragraphs[0].add_run(str(ill[2]))
run.font.size = Pt(8)
cell06 = table.cell(0, 6)
# cell4.width = Cm(2.8)
run = table.cell(0,6).paragraphs[0].add_run("脓疱")
run.font.size = Pt(8)
table.cell(0, 7).width = Cm(1.5)
table.cell(1, 7).width = Cm(1.5)
cell07 = table.cell(0, 7)
run = table.cell(0,7).paragraphs[0].add_run(str(ill[3]))
run.font.size = Pt(8)
cell08 = table.cell(0, 8)
# cell5.width = Cm(2.8)
run = table.cell(0,8).paragraphs[0].add_run("结节")
run.font.size = Pt(8)
# table.cell(0, 9).width = Cm(1.5)
# table.cell(1, 9).width = Cm(1.5)
cell09 = table.cell(0, 9)
run = table.cell(0,9).paragraphs[0].add_run(str(ill[4]))
run.font.size = Pt(8)
cell10 = table.cell(1, 0)
# cell6.width = Cm(2.8)
run = table.cell(1,0).paragraphs[0].add_run("萎缩性瘢痕")
run.font.size = Pt(8)
cell11 = table.cell(1, 1)
run = table.cell(1,1).paragraphs[0].add_run(str(ill[5]))
run.font.size = Pt(8)
cell12 = table.cell(1, 2)
# cell7.width = Cm(2.8)
run = table.cell(1,2).paragraphs[0].add_run("增生性瘢痕")
run.font.size = Pt(8)
cell13 = table.cell(1, 3)
run = table.cell(1,3).paragraphs[0].add_run(str(ill[6]))
run.font.size = Pt(8)
cell14 = table.cell(1, 4)
# cell8.width = Cm(2.8)
run = table.cell(1,4).paragraphs[0].add_run("斑")
run.font.size = Pt(8)
cell15 = table.cell(1, 5)
run = table.cell(1,5).paragraphs[0].add_run(str(ill[7]))
run.font.size = Pt(8)
cell16 = table.cell(1, 6)
# cell9.width = Cm(2.8)
run = table.cell(1,6).paragraphs[0].add_run("色素痣")
run.font.size = Pt(8)
cell17 = table.cell(1, 7)
run = table.cell(1,7).paragraphs[0].add_run(str(ill[8]))
run.font.size = Pt(8)
cell18 = table.cell(1, 8)
# cell10.width = Cm(2.8)
run = table.cell(1,8).paragraphs[0].add_run("其他")
run.font.size = Pt(8)
cell19 = table.cell(1, 9)
run = table.cell(1,9).paragraphs[0].add_run(str(ill[9]))
run.font.size = Pt(8)
for r in range(2):#循环将每一行,每一列都设置为居中
for c in range(10):
# run=table.cell(r,c).paragraphs[0].add_run('')
# run.font.name = u'宋体'
# run._element.rPr.rFonts.set(qn('w:eastAsia'), u'宋体')
# run.font.size = Pt(3)
# run.font.bold=True
# cell = table.cell(r, c)
# run = table.cell(r,c).paragraphs[0].add_run("")
# run.font.size = Pt(10)
table.cell(r, c).paragraphs[0].paragraph_format.alignment = WD_TABLE_ALIGNMENT.CENTER
table.cell(r, c).vertical_alignment=WD_ALIGN_VERTICAL.CENTER
# px = document.add_paragraph()
#痤疮等级
severity = ["Clear","Almost","Mild","Mild to Moderate","Moderate","Moderate to Less Severe","Less Severe","Severe"]
drug = ["无需治疗","BPO或弱效维A酸类外用","BPO联合维A酸类外用","BPO联合维A酸,考虑口服抗生素","BPO联合维A酸,口服抗生素","BPO联合维A酸,口服抗生素,并开始考虑异维A酸","BPO联合维A酸,口服抗生素,推荐异维A酸","异维A酸"]
#痤疮等级表格
p5 = document.add_paragraph()
p5.paragraph_format.space_before = Pt(10)
p5.paragraph_format.space_after = Pt(1.5)
run = p5.add_run('脸部痤疮等级:'+" ")
run.font.size = Pt(15)
run.font.name = "Times New Roman" # 设置西文是新罗马字体
run.element.rPr.rFonts.set(qn('w:eastAsia'), '宋体') # 设置中文是宋体
run.bold = True
run = p5.add_run(str(res2)+"级"+" "+str(severity[res2-1]))
run.font.size = Pt(15)
run.font.name = "Times New Roman" # 设置西文是新罗马字体
run.element.rPr.rFonts.set(qn('w:eastAsia'), '宋体') # 设置中文是宋体
#################################################################################
# 痤疮等级progress
# Turn off autofit 固定列宽
table = document.add_table(rows=1, cols=1)
table.autofit = True
# Add image to cell (0, 1)
cell0 = table.cell(0, 0)
paragraph0 = cell0.paragraphs[0]
table.cell(0,0).paragraphs[0].paragraph_format.alignment=WD_PARAGRAPH_ALIGNMENT.CENTER
table.cell(0,0).vertical_alignment=WD_ALIGN_VERTICAL.BOTTOM
table.rows[0].height = Cm(0.2)
run0 = paragraph0.add_run()
run0.add_picture('./photos/{}.jpg'.format(severity[res2-1]), width=Inches(6))
#################################################################################
#推荐治疗方案
p6 = document.add_paragraph()
p6.paragraph_format.space_before = Pt(0)
p6.paragraph_format.space_after = Pt(0)
run = p6.add_run('推荐治疗方案:'+" ")
run.font.size = Pt(15)
run.font.name = "Times New Roman" # 设置西文是新罗马字体
run.element.rPr.rFonts.set(qn('w:eastAsia'), '宋体') # 设置中文是宋体
run.bold = True
run = p6.add_run(drug[res2-1])
run.font.size = Pt(15)
run.font.name = "Times New Roman" # 设置西文是新罗马字体
run.element.rPr.rFonts.set(qn('w:eastAsia'), '宋体') # 设置中文是宋体
#保存文件
global inputFile
inputFile =path_pre+"/result.docx"
document.save(inputFile)
# global inputFile
# from docx2pdf import convert
# inputFile =path_pre+"/result.docx"
# outputFile =path_pre+"/result.pdf"
# file = open(outputFile,'w')
# file.close()
# convert(inputFile, outputFile)
2154

被折叠的 条评论
为什么被折叠?



