LaTeX 随缘记录
CSDN不大喜欢用了,最近都在微信公众号上发东西,不大容易被白嫖,随缘看,就是用 TikZ 绘制 Inception 的网络,今天突发奇想能不能用 TikZ 画图,毕业论文的时候矢量图就不用 visio 或者 胖胖特(PPT) 画了,就随便学着玩了一下,主要是 GPU 时间又要到了,明天应该就能把 Yolov4-Darknet 版本跑完了。那么就可以开始肝论文了!
Inception 基础模块绘制
\documentclass{ctexart}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{shapes.arrows}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{arrows.meta,decorations.pathmorphing,backgrounds,positioning,fit,petri}
\begin{document}
\begin{figure}
\begin{tikzpicture} [every node/.style={draw, rectangle,minimum size=6mm,inner sep=1pt,node distance=0.5cm}]
\node(bf) at (0,0) {上一层}; %上一层
\node(conv5) [above right = 0.8cm and 0.5cm of bf]{5$\times$5 卷积}; % 5x5卷积
\node(pooling3)[right=0.8cm of conv5 ]{3$\times$3最大值池化层}; %3x3 池化层
\node(conv3)[above left = 0.8cm and 0.5cm of bf]{3$\times$3卷积}; %3x3卷积
\node(conv1)[left=0.8cm of conv3]{1 $\times$ 1 卷积}; %1 x 1卷积
\node(acesslink)[above = 2.2cm of bf,,minimum width=1.7cm]{通道拼接}; %通道拼接
\node(output)[above = 0.6cm of acesslink,inner sep=0.1cm,minimum width=1.5cm]{输出};
\node(temp)[above = 1.1cm of conv3,draw=none]{}; %临时定义结点
\node(temp1)[above=1.1cm of conv5,draw=none]{}; %临时定义结点还不大会
\draw [-Stealth] (bf.west) -| (conv3);
\draw[-Stealth](bf.west) -| (conv1);
\draw[-Stealth](bf.east) -| (conv5) ;
\draw[-Stealth](bf.east) -| (pooling3);
\draw[-Stealth](conv1.north) |- (acesslink.west);
\draw[-Stealth](pooling3.north) |- (acesslink.east);
\draw[-Stealth](acesslink.north) -- (output.south);
\draw[-Stealth](conv3.north) -- (temp);
\draw[-Stealth](conv5.north) -- (temp1);
% \node(oconv) at(-1,1){1$\times $1 卷积};
\end{tikzpicture}
\caption{Inception 基础模块结构}
\end{figure}
\end{document}
改进的 Inception 模块绘制
\documentclass{ctexart}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{shapes.arrows}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{arrows.meta,decorations.pathmorphing,backgrounds,positioning,fit,petri}
\begin{figure}
\begin{tikzpicture}[every node/.style={draw, rectangle,minimum size=6mm,inner sep=1pt,node distance=0.7cm}]
\node(bf) at (0,0) {上一层}; %上一层
\node(conv1)[above left=1cm and 0.3cm of bf]{1 $\times$1 卷积} ;
\node(conv10)[above right=1cm and 0.3cm of bf]{1$\times$1 卷积};
\node(pooling3)[right = of conv10]{3$\times$3 最大值池化};
\node(conv3)[above = of conv1]{ 3$\times$3 卷积};
\node(conv5)[above = of conv10]{ 5$\times$5 卷积};
\node(conv11)[above = of pooling3]{1$\times$1 卷积};
\node(conv12)[left= of conv3]{1$\times$1 卷积};
\node(acesslink) at (0,4){通道拼接};
\node(output) [above= of acesslink,minimum width=1.5cm]{输出};
%做个临时节点
\node(temp) [above = 0.75cm of conv3,draw=none]{};
\node(temp1)[above=0.75cm of conv5,draw=none]{};
\draw[-Stealth](conv3.north) -- (temp.south);
\draw[-Stealth](conv5.north) -- (temp1.south);
\draw[-Stealth](bf.west) -| (conv1.south);
\draw[-Stealth](bf.east) -| (conv10.south);
\draw[-Stealth](bf.east) -| (pooling3.south);
\draw[-Stealth](pooling3.north) -- (conv11.south);
\draw[-Stealth](bf.west) -| (conv12.south);
\draw[-Stealth](conv1.north) -- (conv3.south);
\draw[-Stealth](conv10.north) -- (conv5.south);
\draw[-Stealth](conv11.north) |- (acesslink.east);
\draw[-Stealth](conv12.north) |- (acesslink.west);
\draw[-Stealth](acesslink.north)--(output.south);
\end{tikzpicture}
\caption{改进的 Inception 模块结构}
\end{figure}
\end{document}