first commit

This commit is contained in:
赵敬皓 2022-08-01 09:50:09 +08:00
commit 5265ec5ec9
51 changed files with 3034 additions and 0 deletions

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
.texpadtmp/chapter/c3.aux
*.aux
*.log
*.gz
.DS_Store
*.toc

36
CJK_xe_font.sty Normal file
View File

@ -0,0 +1,36 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{CJK_xe_font}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\usepackage[BoldFont, SlantFont, CJKnumber, CJKchecksingle]{xeCJK}
%---------------------------- 英文字体 ----------------------------------%
% 衬线字体,是文档的默认字体
%\setmainfont{DejaVu Serif}
% 同setmainfont由fontspec宠包提供
%\setromanfont{DejaVu Serif}
% 无衬线字体,比衬线字体更醒目,常用作标题
%\setsansfont{DejaVu Sans}
% 等宽字体
%\setmonofont{DejaVu Sans Mono}
%\setmonofont{Consolas}
%---------------------------- 中文字体 ----------------------------------%
\setCJKmainfont[BoldFont={黑体}]{宋体}
\setCJKsansfont[BoldFont={黑体}]{楷体}
\setCJKfamilyfont{zhsong}{宋体}
\setCJKfamilyfont{zhhei}{黑体}
\setCJKfamilyfont{zhkai}{楷体}
\setCJKfamilyfont{zhfs}{仿宋}
\setCJKfamilyfont{zhli}{隶书}
\setCJKfamilyfont{zhyou}{幼圆}
\setCJKfamilyfont{yahei}{微软雅黑}
\newcommand*{\yahei}{\CJKfamily{yahei}} % 微软雅黑
\newcommand*{\songti}{\CJKfamily{zhsong}} % 宋体
\newcommand*{\heiti}{\CJKfamily{zhhei}} % 黑体
\newcommand*{\kaishu}{\CJKfamily{zhkai}} % 楷书
\newcommand*{\fangsong}{\CJKfamily{zhfs}} % 仿宋
\newcommand*{\lishu}{\CJKfamily{zhli}} % 隶书
\newcommand*{\youyuan}{\CJKfamily{zhyou}} % 幼圆
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# hpcl_document_latex_template
高性能计算实验室文档模板

2
chapter/appendix.tex Normal file
View File

@ -0,0 +1,2 @@
\appendix
\section{各模块模型服务接口文档}

26
chapter/c1.tex Normal file
View File

@ -0,0 +1,26 @@
\chapter{开源机器学习平台概述}
\section{平台介绍}
随着人工智能artificial intelligentAI技术的不断发展各种AI产品已经逐步进入了我们的生活。但是局限专业知识非AI开发人士无法快速、简单地了解AI知识、使用AI产品。
AI平台以深度学习技术研究和业务应用为基础集深度学习核心框架、基础模型库、端到端开发套件、工具组件和服务平台于一体 是全面开源开放、技术领先、功能完备的产业级深度学习平台。AI平台源于产业实践始终致力于与产业深入融合。
\section{功能介绍}
本平台主要包含\textbf{开发平台}\textbf{开放能力}\textbf{知识学习}三个模块。其中开发平台集成了主流深度学习工具的开发接口,开放能力集成了多领域的端到端的模型训练和预测服务,知识学习模块包含了当下主流的机器学习算法的介绍,例如:算法描述、优点、缺点、适用范围、实现方法、应用场景等。
\subsection{开发平台}
集成了主流工具的API介绍包括TensorFlow、PyTorch、Sklearn等用户通过点击查阅即可了解相关API的知识。
\subsection{开放能力}
平台开放的能力包含了当下主流的可供学习使用的机器学习任务涉及智能图像处理、自然语言处理、智能语音等多领域多方面的服务可以让用户根据自身需要依据自己的数据获得端到端的AI模型服务。\\
\indent 用户可以依据当前的进行该任务所选择的机器学习算法进行自主调节参数,用户在选择完参数之后可以自主决定是否选择上传本地的训练数据文件,如果选择上传,则会依据上传的数据文件训练模型,如果不选择上传,则会使用平台默认的数据文件进行训练。在参数和文件全部输入完毕后,用户点击“训练开始”即可开始训练模型。在模型训练完毕后,则会给出模型相应的性能指标。
各模块集成的模型如下:
\subsubsection{回归预测模块}
回归预测模块包含海浪高度预测、波士顿房价预测、碳排放预测和股票预测四个基础功能,并提供端到端的训练功能。
\subsubsection{智能图像模块}
智能图像模块包含MNIST手写体分类、汽车目标检测、智能图像分割、人体关键点检测、智能图像生成、图片文字识别等基础模型用户可以在相应模块下上传图片获得预测结果。
\subsubsection{自然语言处理模块}
自然语言处理模块(Natural Language ProcessNLP)深度整合了顶级的NLP技术包括文本情感分类、机器翻译、智能阅读理解、语义匹配、对话系统、文本生成、句法分析等模块主要利用Transformer模型建模提供端到端的预测服务。
\subsubsection{智能语音模块}
智能语音模块包含智能语音合成(Text To Speech, TTS)和智能语音识别(Automatic Speech RecognitionASR)功能,智能语音合成将用户输入的文本合成成音频,智能语音识别则可以将用户上传的语音中的文字识别出来。
\subsubsection{其他模块}
本模块包括了鸢尾花识别等基础分类任务的训练和预测功能。
\subsection{知识学习}
知识学习模块主要包含了对主流的监督学习、无监督学习、半监督学习、强化学习等不同机器学习、深度学习方法的讲解。用户可以在该模块了解传统机器学习和前沿模型的建模思路和特点,以便于在自己建模时选择合适的模型。

10
chapter/c2.tex Normal file
View File

@ -0,0 +1,10 @@
\chapter{开发平台}
%%%%%% 目录结构
%%%这里的用处不明,建议后期把这一模块砍去,或者改成带有代码的教程
\section{Tensorflow}
\section{PyTorch}
\section{Sklearn}
\section{其他经典开源模型}

387
chapter/c3.tex Normal file
View File

@ -0,0 +1,387 @@
\chapter{开放能力}
本章节将详细讲述每个模块模型实现方法以及用户自主训练、预测的方法。
\section{回归预测}
回归是一种通过建模和分析变量之间关系的的方法,其目的是通过模型来计算得出一个具体的值。\\
\indent 回归预测在很多的方面得到应用,例如:天气预测、机械寿命预测、商品价格预测、股价预测等都有广泛的应用。本平台的回归预测模块选取了海浪高度预测、波士顿房价预测、碳排放预测和股票价格预测等四个典型预测问题,并提供多种不同类型的建模方法,方便使用者充分利用本平台构建自己的模型。
\subsection{海浪高度预测}
\subsubsection{模型构建}
海浪高度预测属于简单的回归预测,其样本的结构如表\ref{ocean_wave_data}所示:
\begin{table}[htb]
\centering
\resizebox{\textwidth}{15mm}{
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline\hline
\textbf{列名} & \textbf{WVHT\_1} & \textbf{WDIR\_1} & \textbf{WSPD\_1} & \textbf{WDIR\_2} &\textbf{WSPD\_2} & \textbf{WDIR} & \textbf{WSPD} \\
\hline
\textbf{含义}&\textbf{t-1时刻高度}&\textbf{t-1时刻风向}&\textbf{t-1时刻风速}&
\textbf{t-2时刻风向}&\textbf{t-2时刻风速}&\textbf{当前风向}&\textbf{当前风速} \\
\hline
\textbf{数据类型}&\textbf{float}&\textbf{float}&\textbf{float}&\textbf{float}&\textbf{float}&\textbf{float}&\textbf{float}\\
\hline\hline
\end{tabular}}
\caption{海浪高度预测模型的数据特征及说明}
\label{ocean_wave_data}
\end{table}
因此,建模时采用简单的多层感知机(Multi-Layer Perceptron, MLP)即可快速完成任务,模型构造如图\ref{MLP}所示输入数据通过z-score(式\ref{z_score})进行归一化,然后输入到感知机中,最后输出得到预测值,并与真实值进行比较,计算损失值进行迭代。
\begin{equation}
z(x) = \frac{x-\mu}{\sigma}
\label{z_score}
\end{equation}
\begin{figure}[htb]
\centering
\includegraphics[width=0.75\textwidth]{images/ch03/regression/MLP.png}
\caption{支持用户自定义的多层感知机}
\label{MLP}
\end{figure}
\indent 用户可以将自己的数据输入进模型,根据自定义的超参数进行训练,得到符合自己数据的专有模型;也可以直接输入特征数据进行预测。
\subsubsection{模型训练}
训练界面如图\ref{oceantrain}所示,该模型支持自定义神经元数量、学习率、训练轮数、激活函数、损失函数等超参数。
\begin{figure}[!htb]
\centering
\includegraphics[width=0.6\textwidth]{images/ch03/regression/oceanwave_train.png}
\caption{海浪高度模型训练界面}
\label{oceantrain}
\end{figure}
用户通过输入上述超参数,可以选择上传本地数据进行训练,若不上传,则默认使用线上数据。等待训练完成后,系统将返回该模型在验证集数据上的指标,如图\ref{ocean_train_result}所示。此时,用户就得到了一个基于自设超参数和本地数据的模型。
\begin{figure}[htb]
\centering
\includegraphics[width=0.8\textwidth]{images/ch03/regression/ocean_train_result.png}
\caption{海浪高度模型训练指标}
\label{ocean_train_result}
\end{figure}
\subsubsection{模型预测}
平台支持使用用户自定义和模型进行预测和使用平台预先训练好的模型进行训练,以用户自训练模型预测(图\ref{ocean_prediction})为例
\begin{figure}[htb]
\centering
\includegraphics[width=0.55\textwidth]{images/ch03/regression/ocean_prediction.png}
\caption{使用自训练模型预测}
\label{ocean_prediction}
\end{figure}
用户输入一条特征数据,点击\textbf{预测浪高}按钮,等待模型预测完成后,即可获得海浪高度的预测值。
\newpage
\subsection{波士顿房价预测}
波士顿房价预测属于经典的机器学习回归问题之一该任务需要对79个与房价有关的特征进行处理和建模最终得到能够预测房价的回归模型。该任务的评价指标是均方根误差(Root Mean Square Error, RMSE)
\begin{equation}
RMSE(y) = \sqrt{\sum_{i=1}^{n}(y_i-\hat{y_i})^2}
\label{rmse}
\end{equation}
\subsubsection{模型构建}
由于特征维度较多,而且有很多的缺失值、部分特征存在异常值,因此首先进行特征分析和数据预处理。包括异常点检测、缺失值处理和数据填充、特征独热编码等。
\begin{enumerate}
\item \textbf{异常点检测}。异常点的分析以特征"GrLivArea"为例,打印其与房屋售价"SalePrice"的分布如图\ref{annopoint}所示,
\begin{figure}[H]
\centering
\includegraphics[width=0.75\textwidth]{images/ch03/regression/annopoint.png}
\caption{GrLivArea与SalePrice分布图}
\label{annopoint}
\end{figure}
清晰可见右上角有两个离群点,在训练时,可以考虑将这两条样本删除。同理,其他特征上包含异常值的样本,在数据预处理阶段也同时予以删除。
\item \textbf{缺失值处理}。对训练数据的缺失值进行分析,得到较高缺失比例的特征如图\ref{miss_rate}所示,高缺失率的特征将影响模型的泛化能力,因此将缺失率>30\%的特征(PoolQC, MiscFeature, Alley, Fence, FireplaceQu)删去,不参与后续训练。
\begin{figure}[H]
\centering
\includegraphics[width=0.5\textwidth]{images/ch03/regression/boston_miss_rate.png}
\caption{特征缺失比例}
\label{miss_rate}
\end{figure}
\item \textbf{缺失值填充}。对于剩余包含较少缺失值的特征列分别采取填充None值、填充众数、填充平均数等方式将缺失的部分填充上。
\item \textbf{正态性分析}。对于目标值SalePrice构建其直方图和正态概率分布图\ref{non_normal_house_price},可见其呈明显正偏态分布,不利于回归建模。
\begin{figure}[H]
\centering
\includegraphics[scale=0.4]{images/ch03/regression/non_normal_dist.png}
\includegraphics[scale=0.4]{images/ch03/regression/non_normal_prob.png}
\caption{SalePrice的直方图和正态概率分布图}
\label{non_normal_house_price}
\end{figure}
因此,对价格列进行对数化处理,处理后的数据分布如图\ref{normal_house_price},可见其基本符合正态分布。
\begin{figure}[H]
\centering
\includegraphics[scale=0.4]{images/ch03/regression/normal_dist.png}
\includegraphics[scale=0.4]{images/ch03/regression/normal_prob.png}
\caption{对数化后SalePrice的直方图和正态概率分布图}
\label{normal_house_price}
\end{figure}
\item \textbf{特征独热编码} 对于离散型的特征,需要将其进行独热编码(one-hot),才能转变为机器可以识别的特征。
\end{enumerate}
经过数据预处理后平台采用xgboost模型进行回归建模。xgboost(eXtreme Gradient Boosting)是一种基于GBDT的算法具有高效、灵活和轻便的特点在数据挖掘、推荐系统等领域得到广泛的应用。通过预设的超参数集合将训练样本输入xgboost模型中经过数轮迭代后得到训练好的模型。
\subsubsection{模型训练}
平台提供了用户上传数据和自定义超参数训练模型的功能。用户可定义的超参数如表\ref{hyperparams_xgb}所示
\begin{table}[htb]
\centering
\begin{tabular}{|c|c|c|}
\hline\hline
\textbf{名称} & \textbf{含义} & \textbf{默认值} \\
\hline
\textbf{eta}&\textbf{学习率}&\textbf{0.05} \\
\hline
\textbf{max\_depth}&\textbf{树的最大深度}&\textbf{10}\\
\hline
\textbf{subsample}&\textbf{随机采样比例}&\textbf{0.7}\\
\hline
\textbf{colsample\_bytree}&\textbf{随机采样列数}&\textbf{0.8}\\
\hline
\textbf{num\_boost\_round}&\textbf{迭代轮数}&\textbf{1000}\\
\hline
\textbf{early\_stopping\_rounds}&\textbf{提前终止训练}&\textbf{200}\\
\hline\hline
\end{tabular}
\caption{海浪高度预测模型的数据特征及说明}
\label{hyperparams_xgb}
\end{table}
\subsubsection{模型预测}
用户可以选择使用自训练模型进行预测,也可以选择使用平台已经训练好的模型进行预测。预测时需要按照波士顿房价预测问题官方给出的数据集格式准备好自己的数据,并将数据在指定界面上传,平台将返回符合官方要求的数据格式的文件。
\subsection{碳排放预测}
\subsection{股票预测}
\section{智能图像}
机器视觉Machine Vision是人工智能领域中发展迅速的一个重要分支目前正处于不断突破、走向成熟的阶段。智能图像处理是指一类基于计算机的自适应于各种应用场合的图像处理和分析技术本身是一个独立的理论和技术领域但同时又是机器视觉中的一项十分重要的技术支撑。\\
\indent 智能图像处理的主要技术包括图像预处理、图像分割、目标识别和分类、目标检测和跟踪等主要研究方向。近年来,随着深度学习技术的不断发展,利用深度神经网络完成相关任务成为智能图像处理领域的主流方法。\\
\indent 在本模块中,平台基于深度神经网络技术,实现了综合性的图像智能处理功能。包括基础问题建模(MNIST手写体分类、图片文字识别),智能目标检测、智能图像分割、人体关键点检测、智能图像生成(通过文字描述生成图像)等应用,可以快速根据需求生成所需的结果。
\subsection{MNIST手写体分类}
MNIST手写体数据集来自美国国家标准与技术研究所(National Institute of Standards and Technology, NIST). 训练集有60000个样本测试集有10000个样本。样本经过归一化后每张图片的大小是相同的。该数据集由Yann LeCun等人维护。其中部分数据如图\ref{MNIST_sample}所示
\begin{figure}[H]
\centering
\includegraphics[width=0.2\textwidth]{images/ch03/vision/1.jpg}
\includegraphics[width=0.2\textwidth]{images/ch03/vision/2.jpg}
\includegraphics[width=0.2\textwidth]{images/ch03/vision/7.jpg}
\caption{MNIST数据集示例}
\label{MNIST_sample}
\end{figure}
\subsubsection{模型构建}
由于任务相对简单我们以经典的LeNet-5来完成MNIST手写体识别任务。LeNet-5网络结构如图\ref{LeNet}所示
\begin{figure}[htb]
\centering
\includegraphics[width=0.8\textwidth]{images/ch03/vision/LeNet-5.png}
\caption{LeNet-5网络结构}
\label{LeNet}
\end{figure}
\subsubsection{模型训练}
用户可以上传数据并自设学习率和迭代轮数进行模型自训练。
\subsubsection{模型预测}
用户可以使用自训练的模型进行预测,也可以上传数据,使用平台预先训练好的模型进行预测。预测界面如图\ref{mnist_pred}所示
\begin{figure}[H]
\centering
\includegraphics[width=0.9\textwidth]{images/ch03/vision/mnist_predict.png}
\caption{MNIST预测界面}
\label{mnist_pred}
\end{figure}
\subsection{图片文字识别}
光学字符识别Optical Character Recognition, OCR是指对文本资料的图像文件进行分析识别处理获取文字及版面信息的过程。亦即将图像中的文字进行识别并以文本的形式返回。
\subsubsection{模型构建}
平台集成了开源离线OCR工具tr用户只需要上传图片就可以得到图片中的文字。
\subsubsection{模型训练}
暂不支持自训练。
\subsubsection{模型预测}
用户上传带有文字的图片,平台经过计算后,返回图片中的文字,效果如图\ref{ocr_pred}所示
\begin{figure}[H]
\centering
\includegraphics[width=0.9\textwidth]{images/ch03/vision/ocr_result.png}
\caption{OCR识别效果}
\label{ocr_pred}
\end{figure}
\subsection{目标检测}
YOLO(You Only Look Once)系列算法采用单个神经网络直接预测物品边界和类别概率实现端到端的物品检测。该方法的特点是将目标检测任务看作目标区域预测和类别预测的回归问题实现快速检测的同时还达到较高的准确率。平台采用YOLOv5框架作为目标检测模型的基础框架。
\subsubsection{模型构建}
YOLOv5的网络结构如图\ref{yolov5}所示,
\begin{figure}[H]
\centering
\includegraphics[width=0.9\textwidth]{images/ch03/vision/yolov5.png}
\caption{YOLOv5网络结构图}
\label{yolov5}
\end{figure}
由于模型代码已经开源(\href{https://github.com/ultralytics/yolov5}{https://github.com/ultralytics/yolov5}),平台直接利用了其开源代码搭建模型。
\subsubsection{模型训练}
通过YOLOv5的开源代码我们可以利用预训练好的代码和权重进行训练。通过以下指令就完成了基于yolov5n的网络结构和COCO数据集BATCH大小为128的模型的训练。
\begin{Verbatim}[h]
python train.py --data coco.yaml --cfg yolov5n.yaml --weights '' --batch-size 128
\end{Verbatim}
该模型训练耗时和算力消耗都比较大,因此平台不提供自主数据训练。
\subsubsection{模型预测}
平台支持使用不同参数量的YOLOv5模型进行预测用户通过上传本地的图片选择YOLOv5模型的版本进行目标检测模型的预测。具体版本类型如表\ref{yolov5_version}所示:\\
\begin{table}[H]
\centering
\begin{tabular}{|c|c|c|c|c|}
\hline\hline
\textbf{Model} & \textbf{size(pixels)} & \textbf{Speed(ms)}&\textbf{params(M)} & \textbf{FLOPs@640 (B)} \\
\hline
\textbf{YOLOv5n}&640&45&1.9&4.5 \\
\hline
\textbf{YOLOv5s}&640&98&7.2&16.5 \\
\hline
\textbf{YOLOv5m}&640&224&21.2&49.0 \\
\hline
\textbf{YOLOv5l}&640&430&46.5&109.1 \\
\hline
\textbf{YOLOv5x}&640&766&86.7&205.7\\
\hline\hline
\end{tabular}
\caption{YOLOv5可选版本及其部分参数}
\label{yolov5_version}
\end{table}
\newpage
\indent 使用YOLOv5x对图片进行分割的结果如图\ref{yolov5x_rst}所示
\begin{figure}[H]
\centering
\includegraphics[width=0.45\textwidth]{images/ch03/vision/yolov5x_in.jpg}
\hspace{3mm}
\includegraphics[width=0.45\textwidth]{images/ch03/vision/yolov5x_out.jpg}
\caption{YOLOv5x检测结果}
\label{yolov5x_rst}
\end{figure}
\subsection{智能图像分割}
图像分割技术是目前计算机视觉领域最热门的技术之一,许多应用了计算机视觉的场景都需要对图像进行智能分割,以充分理解图像中的内容,以便于机器分析图像中各个部分之间的关系。图像分割技术主要分为语义分割和实例分割等。\\
\indent 光伏发电站,是指一种特殊材料电子元件(诸如晶硅板、逆变器等)组成的利用太阳能发电的体系,与电网相连并向电网输送电力。利用遥感图像和图像分割技术,可以对光伏发电站的空间分布进行精准确定。因此,本平台以光伏发电站的遥感图像为例,提供了光伏板智能图像分割服务。
\subsubsection{模型构建}
U-Net是一种U型的类Encoder-Decoder卷积神经网络最初被应用于医疗图像分割后来实验证明其在其他领域的图像分割也有较好的效果是实现语义分割或实例分割的较为基础的模型其网络结构如图\ref{unet}所示:\\
\begin{figure}[H]
\centering
\includegraphics[scale=0.53]{images/ch03/vision/unet.png}
\caption{U-Net的网络结构图}
\label{unet}
\end{figure}
\indent 模型首先通过卷积操作进行特征融合,通过池化层进行降维,然后再通过卷积层进行上采样,最后通过$1\times 1$的卷积进行结果的输出。
\subsubsection{模型训练}
\begin{enumerate}
\item \textbf{数据准备}。 U-Net模型训练需要同时准备原图像和标注图像其示例如图\ref{unet-data}所示,标注图像需标注出光伏板的位置
\begin{figure}[H]
\centering
\includegraphics[scale=0.4]{images/ch03/vision/unet-ori.jpg}
\hspace{5mm}
\includegraphics[scale=0.43]{images/ch03/vision/unet-label.jpg}
\caption{U-Net数据集示例}
\label{unet-data}
\end{figure}
\item \textbf{模型训练}。首先将原始图像进行数据增强例如随机限制对比度、随机增加白噪声、随机锐化和模糊等然后调整分表了使得图像像素长宽能被32整除最后将图像规范化成为神经网络模型可接受的输入。训练时以DiceLoss作为损失函数使用交并比作为训练时更新模型的指标。
\end{enumerate}
\subsubsection{模型预测}
模型预测支持单张图片预测,也支持批量预测,用户通过平台上传本地图片,模型运行完成后会返回分割后的结果。最终分割的效果如图\ref{unet-out}所示
\begin{figure}[H]
\centering
\includegraphics[scale=0.4]{images/ch03/vision/unet_photovoltaic.png}
\caption{U-Net分割光伏图像}
\label{unet-out}
\end{figure}
\subsection{人体关键点检测}
人体关键点检测Human Pose Estimation指通过识别一些人体关键点如头部、肩膀、关节等描述人体骨骼信息。人体关键点检测是计算机视觉的重要应用之一以人体关键点检测为基础可以进行行为识别、人物跟踪、步态识别等相关研究。按照检测目标的维度人体关键点检测一般可以分为二维关键点检测和三维关键点检测。
\begin{figure}[H]
\centering
\includegraphics[scale=0.6]{images/ch03/vision/pose_esti.jpg}
\caption{二维人体关键点检测}
\label{pose_esti}
\end{figure}
\subsubsection{模型构建}
MMPose是一个基于PyTorch的开源姿态估计工具箱。基于MMPose的开源框架我们可以简单的搭建一个人体关键点检测的建模、训练和预测服务。
\subsubsection{模型训练}
平台选择了MMPose自带的预训练模型搭建服务MMPose框架也支持使用者基于自有数据进行模型微调或者重新训练指令如下
\begin{Verbatim}[H]
python tools/train.py ${CONFIG_FILE}$ [optional arguments]
\end{Verbatim}
\subsubsection{模型预测}
用户可以直接上传本地图片进行预测,模型预测的效果如图\ref{pose_out}所示
\begin{figure}[H]
\centering
\includegraphics[width=0.4\textwidth]{images/ch03/vision/pose_in.jpg}
\hspace{5mm}
\includegraphics[width=0.4\textwidth]{images/ch03/vision/pose_out.jpg}
\caption{预测结果示例}
\label{pose_out}
\end{figure}
\subsection{图像生成}
根据文本生成对应的图像是多模态任务之一。解决这一问题的主流方法有VAE(Variational Auto-Encoder)DRAWDeep Recurrent Attention Writer以及生成对抗网络(Generative Adversarial Networks, GAN)等。
\subsubsection{模型构建}
FuseDream是一个结合CLIP(Connecting Text and Images)和GAN的开源文本生成图像模型
\begin{enumerate}
\item \textbf{生成对抗网络模块}。GAN模块的结构如下图\ref{gan}所示
\begin{figure}[H]
\centering
\includegraphics[width=0.8\textwidth]{images/ch03/vision/GAN.jpg}
\caption{生成对抗网络结构图}
\label{gan}
\end{figure}
生成对抗网络模型由两部分组成,一个是生成模型(Generator),一个是判别模型(Discriminator Network)。生成模型的任务是尽力模仿输入的数据生成类似的数据。判别模型的任务是判断给定的实例是否是由生成器伪造的。
\item \textbf{CLIP}。CLIP的英文全称是Contrastive Language-Image Pre-training即一种基于对比学习的文本-图像对的预训练模型。如下图\ref{clip}所示CLIP包括两个模型Text Encoder和Image Encoder其中Text Encoder用来提取文本的特征可以采用transformer模型而Image Encoder用来提取图像的特征可采用CNN模型。
\begin{figure}[H]
\centering
\includegraphics[width=0.6\textwidth]{images/ch03/vision/CLIP.jpg}
\caption{CLIP结构图}
\label{clip}
\end{figure}
\end{enumerate}
\subsubsection{模型训练}
训练时按照如下步骤进行
\begin{enumerate}
\item 通过对数据集随机扰动,进行数据增强。
\item 使用CLIP模型计算文本与图像的相似度依靠增强的数据增加CLIP的鲁棒性。
\item 将CLIP模型计算得分较高的一部分数据送入GAN模型进行训练。
该模型利用了预训练的BIG-GAN权重在使用时无需重复训练根据用户输入的文本进行微调即可。
\end{enumerate}
\subsubsection{模型预测}
用户输入文字,模型经过生成后,输出对应的图片。示例如下
\begin{figure}[H]
\centering
\subfigure[A photo of a blue dog.]{\includegraphics[width=0.3\textwidth]{images/ch03/vision/blue_dog.png}}
\hfill
\subfigure[Sun rises from sea.]{\includegraphics[width=0.3\textwidth]{images/ch03/vision/sunrise.png}}
\hfill
\subfigure[A small flower blooms on the cliff.]{\includegraphics[width=0.3\textwidth]{images/ch03/vision/flower_blooms.png}}
\caption{生成图像示例}
\label{text2gan}
\end{figure}
\section{自然语言处理}
自然语言处理(Natural Language Processing, NLP)是计算机科学与人工智能领域中的一个重要研究方向。它是关于如何使计算机理解人所使用的自然语言的研究,是融合计算机科学、语言学、数学等学科于一体的科学。
自然语言处理任务通常包括句法分析、文本分类、机器翻译、阅读理解、人机对话等多种任务,在舆情分析、智能机器人等研究上扮演了重要的角色。平台以将这些任务为例,结合最新预训练模型技术进行建模。
\subsection{文本情感分类}
文本分类任务是NLP任务中较为基础的应用。文本情感分类一般是指按照文本内容将文本情感分为两类(积极、消极)或三类(积极、中性、消极)。\\
\indent 传统文本情感分类任务一般是基于中文分词、词向量结合TextCNN等神经网络模型实现的近年来随着各种Transformer预训练模型的出现基于预训练模型进行微调(Fine-Tune)的文本分类模型逐渐成为主流。本平台的文本分类模型即采用了这种方式。
\subsubsection{模型构建}
使用Bert等Transformer模型进行微调预测的网络结构如下图\ref{bert_cls}所示中文文本一般不再需要分词而是经过在词表中的位置映射转换为机器能够理解的编码。对于文本分类任务BERT模型在文本前插入一个[CLS]符号,经过训练和,该符号可以学习到整段文本的语义表示,并将该符号对应的向量输出得到最后的分类结果。
\begin{figure}[H]
\centering
\includegraphics[scale=0.6]{images/ch03/nlp/bert_classify.png}
\caption{Bert文本分类}
\label{bert_cls}
\end{figure}
构建模型时,采用 RoBERTa 作为基础的预训练模型相比于BertRoBERTa基于更大的训练数据和更长的预训练时间进行预训练。
\subsubsection{模型训练}
平台支持文本分类任务的自主训练,用户同时上传训练数据集和测试数据集,平台建模完成后,会提供预测的结果文件,可供用户下载。
\subsubsection{模型预测}
用户也可以只提交测试文件,平台基于线上模型进行预测,同时返回预测结果。
%\subsection{机器翻译}
%\subsubsection{模型构建}
%\subsubsection{模型训练}
%\subsubsection{模型预测}
%\subsection{阅读理解}
%\subsubsection{模型构建}
%\subsubsection{模型训练}
%\subsubsection{模型预测}
%\subsection{语义匹配}
%\subsubsection{模型构建}
%\subsubsection{模型训练}
%\subsubsection{模型预测}
%\subsection{对话系统}
%\subsubsection{模型构建}
%\subsubsection{模型训练}
%\subsubsection{模型预测}
%\subsection{文本生成}
%\subsubsection{模型构建}
%\subsubsection{模型训练}
%\subsubsection{模型预测}
%\subsection{词法分析}
%\subsubsection{模型构建}
%\subsubsection{模型训练}
%\subsubsection{模型预测}
%\section{智能语音}
%\subsection{语音识别}
%\subsubsection{模型构建}
%\subsubsection{模型训练}
%\subsubsection{模型预测}
%\subsection{语音生成}
%\subsubsection{模型构建}
%\subsubsection{模型训练}
%\subsubsection{模型预测}
%\section{其他任务}
\begin{subappendices}%%!!!!!!!
\section{各模块模型服务接口文档}
\subsection{回归预测}
\subsubsection{海浪高度预测}
\end{subappendices}

View File

@ -0,0 +1,159 @@
\chapter{通用样式}
%%%%%% 目录结构
\section{目录结构}
本文档支持到三级目录chapter、节section、子节subsection、子子节subsubsection。使用方法如下
\begin{Verbatim}[]
章:
\chapter{此处输入章的标题}
节:
\section{此处输入节标题}
子节:
\section{此处输入子节标题}
子子节:
\section{此处输入子子节标题}
\end{Verbatim}
%%%%%% 文字类
\section{文字类}
\subsection{字体}
本文档提供多种字体以供选择。使用方法如下:
\begin{Verbatim}[]
\kaishu{这是楷体}\songti{这是宋体}\yahei{这是微软雅黑}\heiti{这是黑体}\fangsong{这是仿宋}\lishu{这是隶书}\youyuan{这是幼圆}
\end{Verbatim}
所有字体在windows系统中均可用但仅\textbf{楷体、宋体和仿宋}在mac系统和linux系统可用。
\subsection{文字下划线}
通过uline命令为指定的文字添加下划线
\begin{Verbatim}[]
这是一段文字,\uline{现在这几个字要加下划线,而且这个下划线是可以跨行显示的,可以通过该命令来实现在文档中标注重要的内容}
\end{Verbatim}
效果如下:
这是一段文字,\uline{现在这几个字要加下划线,而且这个下划线是可以跨行显示的,可以通过该命令来实现在文档中标注重要的内容}
\section{注解}
可通过以下方法添加注解:
\begin{Verbatim}[]
\begin{quote}
\kaishu
\textbf{注意:}此处可以输入注解,注解可以用来进一步描述图像、图表等文档对象。
\end{quote}
\end{Verbatim}
该注解的效果如下所示:
\begin{quote}
\kaishu
\textbf{注意:}此处可以输入注解,注解可以用来进一步描述图像、图表等文档对象。
\end{quote}
\section{图表}
\subsection{插入图片}
在文档中使用到的所有的图片均放置在pic目录下图片的插入方法如下
\begin{Verbatim}[]
\begin{figure}[h]
\centering
\label{structure}
\includegraphics[width=0.8\textwidth]{pic/example.png}
\caption{此处输入插入图片的描述文字}
\end{figure}
\end{Verbatim}
效果如下图\ref{example}所示。
\begin{figure}[h]
\centering
\label{example}
\includegraphics[width=0.8\textwidth]{pic/example.png}
\caption{此处输入插入图片的描述文}
\end{figure}
\begin{quote}
\kaishu
\textbf{注意:}hhere表示图片的插入位置即在当前处插入图片可选的参数包括bbottom、ttop。0.8定义了图片的宽度即图片宽度为当前文档宽度的80\%图片通过label定义的标签名进行引用。
\end{quote}
\subsection{表格}
插入表格的代码如下所示:
\begin{Verbatim}[]
\begin{table}[htb]
\centering
\label{tableExample}
\begin{tabular}{p{3cm}|p{9cm}}
\hline\hline
\textbf{硬件} & \textbf{配置要求} \\
\hline\hline
硬盘 & 所有节点至少包含2块SATA硬盘每块硬盘大小为1TB单个节点硬盘之间通过RAID1组成磁盘阵列 \\
\hline
内存 & 每个节点每个CPU建议配置至少2GB内存 \\
\hline
网卡 & 每个节点至少拥有2个前兆网卡 \\
\hline
\hline\hline
\end{tabular}
\caption{各节点硬件配置要求}
\end{table}
\end{Verbatim}
各节点的硬件配置如表\ref{tableExample}所示。
\begin{table}[htb]
\centering
\label{tableExample}
\begin{tabular}{p{3cm}|p{9cm}}
\hline\hline
\textbf{硬件} & \textbf{配置要求} \\
\hline\hline
硬盘 & 所有节点至少包含2块SATA硬盘每块硬盘大小为1TB单个节点硬盘之间通过RAID1组成磁盘阵列 \\
\hline
内存 & 每个节点每个CPU建议配置至少2GB内存 \\
\hline
网卡 & 每个节点至少拥有2个前兆网卡 \\
\hline
\hline\hline
\end{tabular}
\caption{各节点硬件配置要求}
\end{table}
\section{源码}
在文档中输入源码、shell操作等效果如下所示
\begin{Verbatim}[]
\kaishu shell操作
export JAVA_HOME=/usr/java/jdk1.8.0_112
export HBASE_MANAGES_ZK=false
export HBASE_LOG_DIR=/home/hadoop/hbase-1.2.4/logs
export HBASE_PID_DIR=/home/hadoop/hbase-1.2.4/pids
\kaishu 源码
#include <stdio.h>
int main(){
printf("Hello Wolrd.\n");
return 0;
}
\end{Verbatim}

31
chapter/titlepage.tex Normal file
View File

@ -0,0 +1,31 @@
\thispagestyle{empty}
\vspace*{\stretch{1}}
\noindent\begin{minipage}{\textwidth}
\raggedleft
{\huge \bfseries AI学习与算法集成平台技术报告}
\noindent\rule[-1ex]{\textwidth}{5pt}\\[2.5ex]
\hfill\emph{\Large 泛能源大数据与战略研究中心}
\end{minipage}
\vspace{\stretch{1}}
%\noindent\rlap{%
% \begin{minipage}{\textwidth}
% \linespread{1.67}\selectfont\raggedleft
% {\bfseries 文件编号:} 此处输入文档编号\\
% {\bfseries 当前版本:} 此处输入版本号\\
% {\bfseries 编 制:} 此处输入文档作者姓名 \\
% {\bfseries 审 核:} 此处输入文档审核人姓名 \\
% {\bfseries 批 准:} 此处输入文档批准人姓名 \\
% {\bfseries 完成日期:} \today
% \end{minipage}%
%}
\vspace{\stretch{2}}
%\newpage\thispagestyle{empty}
\begin{quote}\footnotesize
% \textbf{(内部文档,未得许可,禁止外传)}\\
本文档版权归中国科学院青岛生物能源与过程研究所泛能源大数据与战略研究中心所有。\\
Copyright \copyright{} 2022 Extended Energy Big Data and Strategy Research Center, Qingdao Institute of Bioenergy and Bioprocess Technology, Chinese Academy of Sciences. \\
\end{quote}

26
chapter/version.tex Normal file
View File

@ -0,0 +1,26 @@
\chapter*{文件修改控制}
本章记录文档修改历史。
\begin{quote}
\kaishu
\textbf{版本号说明:}本文档采用的版本号格式为a.b.c其中a代表重大的版本变迁b代表在a版本下的重要内容更新c代表关键性的bug修复。
\end{quote}
\begin{table}[ht]
\centering
\begin{tabular}{p{1cm}|p{1.5cm}|p{1.0cm}|p{1.2cm}|p{1.2cm}|p{1.2cm}|p{1.5cm}|p{3cm}}
\hline\hline
编号 & 文件状态 & 版本 & 修改人 & 审核人 & 批准人 & 修改日期 & 备注 \\
\hline
1 & 新建 & 1.0 & 张三 & & & 2017.6.15 & 创建文档架构、更新文档初稿\\
\hline\hline
\end{tabular}
\end{table}

28
document.out Normal file
View File

@ -0,0 +1,28 @@
\BOOKMARK [0][-]{chapter.1}{\376\377\137\000\156\220\147\072\126\150\133\146\116\140\136\163\123\360\151\202\217\360}{}% 1
\BOOKMARK [1][-]{section.1.1}{\376\377\136\163\123\360\116\313\176\315}{chapter.1}% 2
\BOOKMARK [1][-]{section.1.2}{\376\377\122\237\200\375\116\313\176\315}{chapter.1}% 3
\BOOKMARK [2][-]{subsection.1.2.1}{\376\377\137\000\123\321\136\163\123\360}{section.1.2}% 4
\BOOKMARK [2][-]{subsection.1.2.2}{\376\377\137\000\145\076\200\375\122\233}{section.1.2}% 5
\BOOKMARK [2][-]{subsection.1.2.3}{\376\377\167\345\213\306\133\146\116\140}{section.1.2}% 6
\BOOKMARK [0][-]{chapter.2}{\376\377\137\000\123\321\136\163\123\360}{}% 7
\BOOKMARK [1][-]{section.2.1}{\376\377\000T\000e\000n\000s\000o\000r\000f\000l\000o\000w}{chapter.2}% 8
\BOOKMARK [1][-]{section.2.2}{\376\377\000P\000y\000T\000o\000r\000c\000h}{chapter.2}% 9
\BOOKMARK [1][-]{section.2.3}{\376\377\000S\000k\000l\000e\000a\000r\000n}{chapter.2}% 10
\BOOKMARK [1][-]{section.2.4}{\376\377\121\166\116\326\176\317\121\170\137\000\156\220\152\041\127\213}{chapter.2}% 11
\BOOKMARK [0][-]{chapter.3}{\376\377\137\000\145\076\200\375\122\233}{}% 12
\BOOKMARK [1][-]{section.3.1}{\376\377\126\336\137\122\230\204\155\113}{chapter.3}% 13
\BOOKMARK [2][-]{subsection.3.1.1}{\376\377\155\167\155\152\232\330\136\246\230\204\155\113}{section.3.1}% 14
\BOOKMARK [2][-]{subsection.3.1.2}{\376\377\154\342\130\353\230\177\142\077\116\367\230\204\155\113}{section.3.1}% 15
\BOOKMARK [2][-]{subsection.3.1.3}{\376\377\170\263\143\222\145\076\230\204\155\113}{section.3.1}% 16
\BOOKMARK [2][-]{subsection.3.1.4}{\376\377\200\241\171\150\230\204\155\113}{section.3.1}% 17
\BOOKMARK [1][-]{section.3.2}{\376\377\146\172\200\375\126\376\120\317}{chapter.3}% 18
\BOOKMARK [2][-]{subsection.3.2.1}{\376\377\000M\000N\000I\000S\000T\142\113\121\231\117\123\122\006\174\173}{section.3.2}% 19
\BOOKMARK [2][-]{subsection.3.2.2}{\376\377\126\376\162\107\145\207\133\127\213\306\122\053}{section.3.2}% 20
\BOOKMARK [2][-]{subsection.3.2.3}{\376\377\166\356\150\007\150\300\155\113}{section.3.2}% 21
\BOOKMARK [2][-]{subsection.3.2.4}{\376\377\146\172\200\375\126\376\120\317\122\006\122\162}{section.3.2}% 22
\BOOKMARK [2][-]{subsection.3.2.5}{\376\377\116\272\117\123\121\163\225\056\160\271\150\300\155\113}{section.3.2}% 23
\BOOKMARK [2][-]{subsection.3.2.6}{\376\377\126\376\120\317\165\037\142\020}{section.3.2}% 24
\BOOKMARK [1][-]{section.3.3}{\376\377\201\352\161\066\213\355\212\000\131\004\164\006}{chapter.3}% 25
\BOOKMARK [2][-]{subsection.3.3.1}{\376\377\145\207\147\054\140\305\141\037\122\006\174\173}{section.3.3}% 26
\BOOKMARK [1][-]{section.1.3.A}{\376\377\124\004\152\041\127\127\152\041\127\213\147\015\122\241\143\245\123\343\145\207\150\143}{chapter.3}% 27
\BOOKMARK [2][-]{subsection.1.3.A.1}{\376\377\126\336\137\122\230\204\155\113}{section.1.3.A}% 28

BIN
document.pdf Normal file

Binary file not shown.

48
document.tex Normal file
View File

@ -0,0 +1,48 @@
% !Mode:: "TeX:UT\left( F-8"
%\documentclass[a4paper, 12pt]{article}
\documentclass[twoside]{linux_thesis}
\usepackage{latexsym,bm}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{setspace}
\usepackage{fontspec}
\usepackage{supertabular}
\usepackage{multirow}
\usepackage{ulem}
\usepackage{float}
\usepackage{hyperref}
\usepackage{appendix} %%!!!!!!!!
\usepackage{subfigure}
%\linespread{1.3}
\definecolor{VerbatimColor}{rgb}{0.9,0.9,0.9}
\begin{document}
\newcommand{\shell}[1]{\noindent\texttt{\$: #1}}
%\begin{titlepage}
%\titleLY
%\end{titlepage}
\include{chapter/titlepage}
%\include{chapter/version}
\tableofcontents
% 文档介绍
\include{chapter/c1}
% 通用样式
\include{chapter/c2}
% 通用样式
\include{chapter/c3}
%\include{chapter/appendix}
\end{document}

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
images/ch03/vision/1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

BIN
images/ch03/vision/2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

BIN
images/ch03/vision/7.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

BIN
images/ch03/vision/CLIP.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
images/ch03/vision/GAN.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 507 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

BIN
images/ch03/vision/unet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

214
linux_thesis.cls Normal file
View File

@ -0,0 +1,214 @@
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesClass{linux_thesis}[]
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}}
\ProcessOptions
%Minimum xeCJK version:3.2.10, date:2014/03/01
\PassOptionsToPackage{CJKchecksingle}{xeCJK}
%5
\LoadClass[c5size,a4paper,fancyhdr,fntef]{ctexbook}
%Chinese font size
\newcommand{\chuhao} {\fontsize{42pt} {\baselineskip}\selectfont}
\newcommand{\xiaochu} {\fontsize{36pt} {\baselineskip}\selectfont}
\newcommand{\xiaochuhao}{\fontsize{36pt} {\baselineskip}\selectfont}
\newcommand{\yihao} {\fontsize{28pt} {\baselineskip}\selectfont}
\newcommand{\erhao} {\fontsize{21pt} {\baselineskip}\selectfont}
\newcommand{\xiaoer} {\fontsize{18pt} {\baselineskip}\selectfont}
\newcommand{\xiaoerhao} {\fontsize{18pt} {\baselineskip}\selectfont}
\newcommand{\sanhao} {\fontsize{15.75pt}{\baselineskip}\selectfont}
\newcommand{\xiaosan} {\fontsize{15pt} {\baselineskip}\selectfont}
\newcommand{\xiaosanhao}{\fontsize{15pt} {\baselineskip}\selectfont}
\newcommand{\sihao} {\fontsize{14pt} {\baselineskip}\selectfont}
\newcommand{\xiaosi} {\fontsize{12pt} {\baselineskip}\selectfont}
\newcommand{\xiaosihao} {\fontsize{12pt} {\baselineskip}\selectfont}
\newcommand{\wuhao} {\fontsize{10.5pt} {\baselineskip}\selectfont}
\newcommand{\xiaowu} {\fontsize{9pt} {\baselineskip}\selectfont}
\newcommand{\xiaowuhao} {\fontsize{9pt} {\baselineskip}\selectfont}
\newcommand{\liuhao} {\fontsize{7.875pt}{\baselineskip}\selectfont}
\newcommand{\qihao} {\fontsize{5.25pt} {\baselineskip}\selectfont}
%===================================================================
%
%===================================================================
\RequirePackage{geometry} %
\geometry{left=25.4mm, right=25.4mm, top=25.4mm, bottom=25.4mm}
%
%\setlength{\parskip}{1.5ex plus0.5ex minus 0.5ex}
\setlength{\parskip}{0ex}
%
\pagestyle{fancy}
\fancyhf{}
\fancyhead[EL,OR]{\thepage}
\fancyhead[OC]{\nouppercase{\fangsong\rightmark}}
\fancyhead[EC]{\nouppercase{\fangsong\leftmark}}
%===================================================================
%===================================================================
%(ps:ctex使)
%===================================================================
\RequirePackage{titletoc}
\RequirePackage{titlesec}
\CTEXsetup[number={\arabic{chapter}}]{chapter}
\titleformat{\chapter}[display]
{\bfseries\Large}
{\filleft \Huge {\thechapter} }
{4ex}
{\titlerule
\vspace{2ex}%
\filright}
[\vspace{2ex}%
\titlerule]
\CTEXsetup[name={\S\,,}]{section}
\CTEXsetup[name={\S\,,}]{subsection}% \S
%\CTEXsetup[name={\S\,,}]{subsubsection}% \S
\CTEXsetup[format={\large\bfseries\flushleft}]{section}
\CTEXsetup[format={\bfseries\flushleft}]{subsection}
%===================================================================
%===================================================================
%
%===================================================================
\CTEXoptions[contentsname={\hfill \rule{\ccwd}{0pt} \hfill}] %
\titlecontents{chapter}[0em]
{\vspace{6bp}\sihao\bfseries}%14pt\bfseries
{\thecontentslabel\hspace*{0.5em}}
{}
{\titlerule*[0.5pc]{$\cdot$}\contentspage}
\titlecontents{section}[1.1\ccwd]
{\vspace{1bp} \xiaosi}
{\thecontentslabel\hspace*{0.5em}}
{}
{\titlerule*[0.5pc]{$\cdot$}\contentspage}
\titlecontents{subsection}[2.5\ccwd]%2.3
{\vspace{1bp} \wuhao}%10.5pt
{\thecontentslabel\hspace*{0.5em}}
{}
{\titlerule*[0.5pc]{$\cdot$}\contentspage}
%================================================================
%
\RequirePackage[oneline]{caption2}
\renewcommand{\captionlabeldelim}{\rule{\ccwd}{0pt}} %, :
\captionsetup{labelfont+={bf}} %
%\DeclareCaptionFont{cs4size}{\xiaosi}
%\captionsetup{labelfont={cs4size,bf}}
%\captionsetup{textfont=cs4size}
\makeatletter
\renewcommand{\thefigure}{\thesection-\@arabic\c@figure}
\renewcommand{\thetable}{\thesection-\@arabic\c@table}
\makeatother
\RequirePackage{enumitem} %
\setitemize{topsep=0pt} % itemize
\RequirePackage{mdwlist} %
%===================================================================
%
%===================================================================
\RequirePackage{longtable} %
%\setlength{\LTpre}{0pt} % longtable
%\setlength{\LTpost}{0pt} % longtable
\renewcommand{\arraystretch}{1.3} % longtable
\RequirePackage{booktabs} %线
%===================================================================
%\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\RequirePackage{fancyvrb}
\fvset{listparameters=\setlength\topsep{0pt}}
%===================================================================
%
%===================================================================
\RequirePackage{fancybox}
\RequirePackage{framed}
\usepackage{color}
% Redefine these colors to your liking in the preamble.
\definecolor{TitleColor}{rgb}{0.126,0.263,0.361}
\definecolor{InnerLinkColor}{rgb}{0.208,0.374,0.486}
\definecolor{OuterLinkColor}{rgb}{0.216,0.439,0.388}
% Redefine these colors to something if you want to have colored
% background and border for code examples.
\definecolor{VerbatimColor}{rgb}{0.933,0.933,0.933}
\definecolor{VerbatimBorderColor}{rgb}{1,1,1}
% Redefine the Verbatim environment to allow border and background colors.
% The original environment is still used for verbatims within tables.
\let\OriginalVerbatim=\Verbatim
\let\endOriginalVerbatim=\endVerbatim
\makeatletter
% Play with vspace to be able to keep the indentation.
\newlength\distancetoright
\def\mycolorbox#1{%
\setlength\distancetoright{\linewidth}%
\advance\distancetoright -\@totalleftmargin %
\fcolorbox{VerbatimBorderColor}{VerbatimColor}{%
\begin{minipage}{\distancetoright}%
#1
\end{minipage}%
}%
}
\def\FrameCommand{\mycolorbox}
\makeatother
\renewcommand{\Verbatim}[1][1]{%
\vspace{-1ex} %
% list starts new par, but we don't want it to be set apart vertically
\bgroup\parskip=0pt%
%\smallskip%
% The list environement is needed to control perfectly the vertical
% space.
\list{}{%
\setlength\parskip{0pt}%
\setlength\itemsep{0ex}%
\setlength\topsep{0ex}%
\setlength\partopsep{0pt}%
\setlength\leftmargin{0pt}%
}%
\item\MakeFramed {\FrameRestore}%
\small%
\OriginalVerbatim[#1]%
}
\renewcommand{\endVerbatim}{%
\endOriginalVerbatim%
\endMakeFramed%
\endlist%
% close group to restore \parskip
\egroup%
}
%===================================================================
\RequirePackage{wrapfig}
\RequirePackage{makecell}
%
\newcommand\mgape[1]{\gape{$\vcenter{\hbox{#1}}$}}
%
%\tabincell{c}{haha// heihei//zeze}
%\newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}}
%\makecell[c]{haha \\ hehe}
\renewcommand\cellalign{tc}
%
\RequirePackage{titlepage/ManyTitlePage}
\RequirePackage{metalogo}
\endinput

BIN
pic/example.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

File diff suppressed because it is too large Load Diff

1043
titlepage/ManyTitlePage.sty Normal file

File diff suppressed because it is too large Load Diff

BIN
titlepage/titlepages.pdf Normal file

Binary file not shown.