使用神经网络做机器视觉,如图像识别和分类,点云的融合,分类和分割。经常要画自己work的架构图,当然有很多可以用的工具,如visio等。但是我们大多时候会使用latex或者cTex来编辑我们的论文。如果架构图作为图片包含在文档,显得有点格格不入。其次网络图重做也要借助其他工具,这里我们尝试使用latex的tikz画一个网络架构图。如下
需要 \usepackage{tikz}
\begin{figure}[H]
\begin{center}
\begin{tikzpicture}[scale=0.75]
\node [rectangle,fill=red!0,rotate=90] (in) at (0.0,3) {\scriptsize{Input PointCloud}};
\node [rectangle,fill=green!50,rotate=90] (input) at (0.5,3) {\footnotesize{N$\times$3}};
\node [rectangle,fill=orange!40,minimum width=2.25cm, minimum height=3cm] (ATM) at (2.75,3) {};
\coordinate (conect1) at (1.1,3);
\node [rectangle,fill=cyan!50,minimum width=1.5cm, minimum height=0.5cm] (ATM1) at (2.75,4.5) {\footnotesize{SRFGAT$_1$}};
\node [rectangle,fill=cyan!50,minimum width=1.5cm, minimum height=0.5cm] (ATM2) at (2.75,3.5) {\footnotesize{SRFGAT$_2$}};
\node [rectangle,fill=cyan!50,minimum width=1.5cm, minimum height=0.5cm] (ATM3) at (2.75,2.5) {$\cdots$};
\node [rectangle,fill=cyan!50,minimum width=1.5cm, minimum height=0.5cm] (ATM4) at (2.75,1.5) {\footnotesize{SRFGAT$_M$}};
\draw [-,color=black,line width=0.8pt] (input)-- (conect1);
\draw [->,color=black,line width=0.8pt] (conect1)|- (ATM1);
\draw [->,color=black,line width=0.8pt] (conect1)|- (ATM2);
\draw [->,color=black,line width=0.8pt] (conect1)|- (ATM3);
\draw [->,color=black,line width=0.8pt] (conect1)|- (ATM4);
\coordinate (connect2) at (4.35,5.5);
\draw [-,color=magenta,line width=0.8pt] (ATM1)-| (connect2);
\draw [-,color=magenta,line width=0.8pt] (ATM2)-| (connect2);
\draw [-,color=magenta,line width=0.8pt] (ATM3)-| (connect2);
\draw [-,color=magenta,line width=0.8pt] (ATM4)-| (connect2);
\node[circle, fill=blue!40, inner sep=0.5pt,label=above:\footnotesize{Concat}] (otimes1) at (9.0,5.5) {$\|$};
\draw [->,color=magenta,line width=0.8pt] (connect2)--node [above, color=black] {\tiny{edge-features}} (otimes1);
\node [rectangle,fill=blue!40,minimum width=2.5cm, minimum height=0.2cm,rotate=90] (concat) at (5.21,3) {\footnotesize{$\|$~~Concat}};
\coordinate (pc1) at (4.9,4.5);
\coordinate (pc2) at (4.9,3.5);
\coordinate (pc3) at (4.9,2.5);
\coordinate (pc4) at (4.9,1.5);
\draw [->,color=black,line width=0.75pt] (ATM1)-- (pc1);
\draw [->,color=black,line width=0.75pt] (ATM2)-- (pc2);
\draw [->,color=black,line width=0.75pt] (ATM3)-- (pc3);
\draw [->,color=black,line width=0.75pt] (ATM4)-- (pc4);
\node [rectangle,fill=cyan!50,minimum width=0.75cm, minimum height=0.25cm] (MLP1) at (6.6,3) {\footnotesize{MLP}};
\node [rectangle,fill=cyan!50,minimum width=0.75cm, minimum height=0.25cm] (MLP2) at (8.25,3) {\footnotesize{MLP}};
\node [rectangle,fill=cyan!50,minimum width=0.75cm, minimum height=0.25cm] (MLP3) at (10.05,3) {\footnotesize{MLP}};
\node [rectangle,fill=cyan!50,minimum width=0.75cm, minimum height=0.25cm] (MLP4) at (11.85,3) {\footnotesize{MLP}};
\draw [->,color=black,line width=0.75pt] (concat)-- (MLP1);
\draw [->,color=black,line width=0.75pt] (MLP1)-- (MLP2);
\draw [->,color=black,line width=0.75pt] (MLP2)-- (MLP3);
\draw [->,color=black,line width=0.75pt] (MLP3)-- (MLP4);
\node[circle, fill=blue!40, inner sep=0.5pt,label=below:\footnotesize{Concat}] (otimes2) at (13.25,3) {$\|$};
\draw [->,color=black,line width=0.75pt] (MLP4)-- (otimes2);
\draw [->,color=magenta,line width=0.8pt] (otimes1)-| (otimes2);
\draw[line width=0.8pt,,color=black, ->] (MLP1) ..controls(8.75,5.2) and (11.0,4.5).. (otimes2);
\draw[line width=0.8pt,,color=black, ->] (MLP2) ..controls(9.75,4.75) and (11.0,4.5).. (otimes2);
\draw[line width=0.8pt,,color=black, ->] (MLP3) ..controls(10.5,4.5) and (11.5,4.2).. (otimes2);
\node [rectangle,fill=cyan!50,minimum width=0.75cm, minimum height=0.25cm] (MLP5) at (14.5,3) {\footnotesize {MLP}};
\draw [->,color=black,line width=0.75pt] (otimes2)-- (MLP5);
\node [rectangle,fill=cyan!50,minimum width=3cm, minimum height=0.2cm,rotate=90] (o1) at (15.85,3) {\footnotesize{N$\times$1024}};
\draw [->,color=black,line width=0.75pt] (MLP5) -- (o1);
\node [rectangle,fill=cyan!50,minimum width=3cm, minimum height=0.2cm,rotate=90] (1024) at (17.55,3) {\footnotesize{1024}};
\coordinate (po2-1) at (17.8,4.5);
\coordinate (po2-2) at (17.8,3.8);
\coordinate (po2-3) at (17.8,3.3);
\coordinate (po2-4) at (17.8,2.6);
\coordinate (po2-5) at (17.8,1.9);
\coordinate (po2-6) at (17.8,1.4);
\draw [->,color=black,line width=0.8pt] (o1)--node [above] {\tiny{$\begin{matrix} \text{Max}\\\text{pooling} \end{matrix}$}} (1024);
\node [rectangle,fill=orange!40,minimum width=2.0cm, minimum height=3cm] (MLP-union) at (19.5,3) {};
\node [rectangle,rounded corners=1mm,fill=cyan!0,minimum width=1.5cm, minimum height=0.25cm] (mlp1) at (19.5,4.5) {\footnotesize{MLP}};
\node [rectangle,rounded corners=1mm, fill=cyan!50,minimum width=1.5cm, minimum height=0.25cm] (mlp2) at (19.5,3.8) {};
\node [rectangle,rounded corners=1mm,fill=cyan!50,minimum width=1.5cm, minimum height=0.25cm] (mlp3) at (19.5,3.3) {};
\node [rectangle,rounded corners=1mm,fill=cyan!0,minimum width=1.5cm, minimum height=0.25cm] (mlp4) at (19.5,2.6) {\footnotesize{shared}};
\node [rectangle,rounded corners=1mm,fill=cyan!50,minimum width=1.5cm, minimum height=0.25cm] (mlp5) at (19.5,1.9) {};
\node [rectangle,rounded corners=1mm,fill=cyan!50,minimum width=1.5cm, minimum height=0.25cm] (mlp6) at (19.5,1.4) {};
\draw [->,color=black,line width=0.75pt] (po2-2)-- (mlp2);
\draw [->,color=black,line width=0.75pt] (po2-3)-- (mlp3);
\draw [->,color=black,line width=0.75pt] (po2-5)-- (mlp5);
\draw [->,color=black,line width=0.75pt] (po2-6)-- (mlp6);
\draw [dotted,color=black,line width=0.75pt] (mlp3)-- (mlp4);
\draw [dotted,color=black,line width=0.75pt] (mlp4)-- (mlp5);
\node [rectangle,fill=red!50,minimum width=3cm, minimum height=0.2cm,rotate=90] (o3) at (21.5,3) {\footnotesize{Classification}};
\coordinate (po3-1) at (21.25,4.5);
\coordinate (po3-2) at (21.25,3.8);
\coordinate (po3-3) at (21.25,3.3);
\coordinate (po3-4) at (21.25,2.6);
\coordinate (po3-5) at (21.25,1.9);
\coordinate (po3-6) at (21.25,1.4);
\draw [] (pi4) --node[right, xshift=-1mm, yshift=-1mm]{$e_{i4}$} (pi);
\draw[line width=0.9pt,color=magenta,->] (pi5) --node[below, xshift=1mm]{$e_{i5}$} (pi);
\draw[line width=0.9pt,color=magenta,->] (pi6) --node[below, xshift=-1mm, yshift=1mm]{$e_{i6}$} (pi);
\node[circle, fill=red!50,inner sep=0.1pt] (new-edge1) at (3.25,4.75){\scriptsize$e'_{i1}$};
\node[circle, fill=red!50,inner sep=0.1pt] (new-edge2) at (3.25,4.0){\scriptsize$e'_{i2}$};
\node[circle, fill=red!50,inner sep=0.1pt] (new-edge3) at (3.25,3.25){\scriptsize$e'_{i3}$};
\node[circle, fill=red!50,inner sep=0.1pt] (new-edge4) at (3.25,2.5){\scriptsize$e'_{i4}$};
\node[circle, fill=red!50,inner sep=0.1pt] (new-edge5) at (3.25,1.75){\scriptsize$e'_{i5}$};
\node[circle, fill=red!50,inner sep=0.1pt] (new-edge6) at (3.25,1.0){\scriptsize$e'_{i6}$};
\node[circle, fill=red!50,inner sep=0.5pt] (edge1) at (3.25,-0.25){\scriptsize$e_{i1}$};
\node[circle, fill=red!50,inner sep=0.5pt] (edge2) at (3.25,-1.0){\scriptsize$e_{i2}$};
\node[circle, fill=red!50,inner sep=0.5pt] (edge3) at (3.25,-1.75){\scriptsize$e_{i3}$};
\node[circle, fill=red!50,inner sep=0.5pt] (edge4) at (3.25,-2.5){\scriptsize$e_{i4}$};
\node[circle, fill=red!50,inner sep=0.5pt] (edge5) at (3.25,-3.25){\scriptsize$e_{i5}$};
\node[circle, fill=red!50,inner sep=0.5pt] (edge6) at (3.25,-4.0){\scriptsize$e_{i6}$};
\coordinate (point0) at (1.25, 0.25);
\coordinate (point1) at (2.75, 2.75);
\coordinate (point2) at (1.25, 0.0);
\coordinate (point3) at (2.75, -2.25);
\coordinate (resnet1) at (3.75, 2.75);
\coordinate (resnet2) at (5.75, 2.75);
\coordinate (resnet3) at (3.75, -2.25);
\coordinate (resnet4) at (5.75, -2.25);
\path[-stealth, line width=1.5pt] (point0) edge [double] (point1);
\path[-stealth, line width=1.5pt] (point2) edge [double] (point3);
\path[-stealth, line width=1.5pt] (resnet1) edge [double] node [above, rotate=0] {\small $\begin{matrix} \text{edges}\\ \text{attention} \end{matrix}$} (resnet2);
\path[-stealth, line width=1.5pt] (resnet3) edge [double] node [below, rotate=0] {\small $\begin{matrix} \text{neighbors}\\ \text{attention} \end{matrix}$} (resnet4);
% \path[decorate,decoration={text along path,text={edge atten}}] (resnet1) -- (resnet2);
% \path[-stealth, line width=1.5pt] (resnet1) edge [double] (resnet2);
% \path[-stealth, line width=1.5pt] (resnet3) edge [double] node [below, yshift=-3mm] {neighbor-attention} (resnet4);
% ---------------------------------------------------------------------------------------------------------------------
\node[circle, fill=green!60,inner sep=3pt] (x0) at (6, 4) {};
\node[circle, fill=green!60,inner sep=3pt] (x1) at (6, 3.5) {};
\node[circle, inner sep=1pt] (x2) at (6, 3) {$\vdots$};
\node[circle, fill=green!60,inner sep=3pt] (x3) at (6, 2.25) {};
\node[circle, fill=green!60,inner sep=3pt] (x4) at (6, 1.75) {};
\node[circle, fill=cyan!70,inner sep=3pt] (h10) at (7.5, 4.25) {};
\node[circle, fill=cyan!70,inner sep=3pt] (h11) at (7.5, 3.75) {};
\node[circle, fill=cyan!70,inner sep=3pt] (h12) at (7.5, 3.25) {};
\node[circle, fill=cyan!70,inner sep=3pt] (h13) at (7.5, 2.75) {};
\node[circle, fill=cyan!70,inner sep=3pt] (h14) at (7.5, 2.25) {};
\node[circle, fill=cyan!70,inner sep=3pt] (h15) at (7.5, 1.75) {};
\node[circle, fill=cyan!70,inner sep=3pt] (h16) at (7.5, 1.25) {};
\draw[line width=0.8pt,-] (x0) -- (h10);
\draw[line width=0.8pt,-] (x0) -- (h11);
\draw[line width=0.8pt,-] (x0) -- (h12);
\draw[line width=0.8pt,-] (x0) -- (h13);
\draw[line width=0.8pt,-] (x0) -- (h14);
\draw[line width=0.8pt,-] (x0) -- (h15);
\draw[line width=0.8pt,-] (x0) -- (h16);
\draw[line width=0.8pt,-] (x1) -- (h10);
\draw[line width=0.8pt,-] (x1) -- (h11);
\draw[line width=0.8pt,-] (x1) -- (h13);
\draw[line width=0.8pt,-] (x1) -- (h14);
\draw[line width=0.8pt,-] (x1) -- (h15);
\draw[line width=0.8pt,-] (x1) -- (h16);
\draw[line width=0.8pt,-] (x3) -- (h10);
\draw[line width=0.8pt,-] (x3) -- (h11);
\draw[line width=0.8pt,-] (x3) -- (h13);
\draw[line width=0.8pt,-] (x3) -- (h14);
\draw[line width=0.8pt,-] (x3) -- (h15);
\draw[line width=0.8pt,-] (x3) -- (h16);
\draw[line width=0.8pt,-] (x4) -- (h10);
\draw[line width=0.8pt,-] (x4) -- (h11);
\draw[line width=0.8pt,-] (x4) -- (h13);
\draw[line width=0.8pt,-] (x4) -- (h14);
\draw[line width=0.8pt,-] (x4) -- (h15);
\draw[line width=0.8pt,-] (x4) -- (h16);
\node[circle, fill=green!60,inner sep=3pt] (y0) at (9, 4) {};
\node[circle, fill=green!60,inner sep=3pt] (y1) at (9, 3.5) {};
\node[circle, inner sep=1pt] (y2) at (9, 3) {$\vdots$};
\node[circle, fill=green!60,inner sep=3pt] (y3) at (9, 2.25) {};
\node[circle, fill=green!60,inner sep=3pt] (y4) at (9, 1.75) {};
\draw[line width=0.8pt,-] (h10) -- (y0);
\draw[line width=0.8pt,-] (h10) -- (y1);
\draw[line width=0.8pt,-] (h10) -- (y3);
\draw[line width=0.8pt,-] (h10) -- (y4);
\draw[line width=0.8pt,-] (h11) -- (y0);
\draw[line width=0.8pt,-] (h11) -- (y1);
\draw[line width=0.8pt,-] (h11) -- (y3);
\draw[line width=0.8pt,-] (h11) -- (y4);
\draw[line width=0.8pt,-] (h12) -- (y0);
\draw[line width=0.8pt,-] (h12) -- (y1);
\draw[line width=0.8pt,-] (h12) -- (y3);
\draw[line width=0.8pt,-] (h12) -- (y4);
\draw[line width=0.8pt,-] (h13) -- (y0);
\draw[line width=0.8pt,-] (h13) -- (y1);
\draw[line width=0.8pt,-] (h13) -- (y3);
\draw[line width=0.8pt,-] (h13) -- (y4);
\draw[line width=0.8pt,-] (h14) -- (y0);
\draw[line width=0.8pt,-] (h14) -- (y1);
\draw[line width=0.8pt,-] (h14) -- (y3);
\draw[line width=0.8pt,-] (h14) -- (y4);
\draw[line width=0.8pt,-] (h15) -- (y0);
\draw[line width=0.8pt,-] (h15) -- (y1);
\draw[line width=0.8pt,-] (h15) -- (y3);
\draw[line width=0.8pt,-] (h15) -- (y4);
\draw[line width=0.8pt,-] (h16) -- (y0);
\draw[line width=0.8pt,-] (h16) -- (y1);
\draw[line width=0.8pt,-] (h16) -- (y3);
\draw[line width=0.8pt,-] (h16) -- (y4);
\node[circle,fill=magenta!60, inner sep=2.5pt] (edgecoef) at (10.5, 3) {};
\node at (10.5,3)[right]{edges-coef};
\draw[line width=0.8pt,-] (y0) -- (edgecoef);
\draw[line width=0.8pt,-] (y1) -- (edgecoef);
\draw[line width=0.8pt,-] (y3) -- (edgecoef);
\draw[line width=0.8pt,-] (y4) -- (edgecoef);
% ----------------------------------------------------------------------------------------
\node[circle, fill=green!60,inner sep=3pt] (x00) at (6, -1) {};
\node[circle, fill=green!60,inner sep=3pt] (x10) at (6, -1.5) {};
\node[circle, inner sep=1pt] (x20) at (6, -2) {$\vdots$};
\node[circle, fill=green!60,inner sep=3pt] (x30) at (6, -2.75) {};
\node[circle, fill=green!60,inner sep=3pt] (x40) at (6, -3.25) {};
\node[circle, fill=cyan!70,inner sep=3pt] (h20) at (7.5, -0.5) {};
\node[circle, fill=cyan!70,inner sep=3pt] (h21) at (7.5, -1) {};
\node[circle, fill=cyan!70,inner sep=3pt] (h22) at (7.5, -1.5) {};
\node[circle, fill=cyan!70,inner sep=3pt] (h23) at (7.5, -2) {};
\node[circle, fill=cyan!70,inner sep=3pt] (h24) at (7.5, -2.5) {};
\node[circle, fill=cyan!70,inner sep=3pt] (h25) at (7.5, -3) {};
\node[circle, fill=cyan!70,inner sep=3pt] (h26) at (7.5, -3.5) {};
\draw[line width=0.8pt,-] (x00) -- (h20);
\draw[line width=0.8pt,-] (x00) -- (h21);
\draw[line width=0.8pt,-] (x00) -- (h22);
\draw[line width=0.8pt,-] (x00) -- (h23);
\draw[line width=0.8pt,-] (x00) -- (h24);
\draw[line width=0.8pt,-] (x00) -- (h25);
\draw[line width=0.8pt,-] (x00) -- (h26);
\draw[line width=0.8pt,-] (x10) -- (h20);
\draw[line width=0.8pt,-] (x10) -- (h21);
\draw[line width=0.8pt,-] (x10) -- (h23);
\draw[line width=0.8pt,-] (x10) -- (h24);
\draw[line width=0.8pt,-] (x10) -- (h25);
\draw[line width=0.8pt,-] (x10) -- (h26);
\draw[line width=0.8pt,-] (x30) -- (h20);
\draw[line width=0.8pt,-] (x30) -- (h21);
\draw[line width=0.8pt,-] (x30) -- (h23);
\draw[line width=0.8pt,-] (x30) -- (h24);
\draw[line width=0.8pt,-] (x30) -- (h25);
\draw[line width=0.8pt,-] (x30) -- (h26);
\draw[line width=0.8pt,-] (x40) -- (h20);
\draw[line width=0.8pt,-] (x40) -- (h21);
\draw[line width=0.8pt,-] (x40) -- (h23);
\draw[line width=0.8pt,-] (x40) -- (h24);
\draw[line width=0.8pt,-] (x40) -- (h25);
\draw[line width=0.8pt,-] (x40) -- (h26);
\node[circle, fill=green!60,inner sep=3pt] (y00) at (9, -1) {};
\node[circle, fill=green!60,inner sep=3pt] (y10) at (9, -1.5) {};
\node[circle, inner sep=1pt] (y20) at (9, -2) {$\vdots$};
\node[circle, fill=green!60,inner sep=3pt] (y30) at (9, -2.75) {};
\node[circle, fill=green!60,inner sep=3pt] (y40) at (9, -3.25) {};
\draw[line width=0.8pt,-] (h20) -- (y00);
\draw[line width=0.8pt,-] (h20) -- (y10);
\draw[line width=0.8pt,-] (h20) -- (y30);
\draw[line width=0.8pt,-] (h20) -- (y40);
\draw[line width=0.8pt,-] (h21) -- (y00);
\draw[line width=0.8pt,-] (h21) -- (y10);
\draw[line width=0.8pt,-] (h21) -- (y30);
\draw[line width=0.8pt,-] (h21) -- (y40);
\draw[line width=0.8pt,-] (h22) -- (y00);
\draw[line width=0.8pt,-] (h22) -- (y10);
\draw[line width=0.8pt,-] (h22) -- (y30);
\draw[line width=0.8pt,-] (h22) -- (y40);
\draw[line width=0.8pt,-] (h23) -- (y00);
\draw[line width=0.8pt,-] (h23) -- (y10);
\draw[line width=0.8pt,-] (h23) -- (y30);
\draw[line width=0.8pt,-] (h23) -- (y40);
\draw[line width=0.8pt,-] (h24) -- (y00);
\draw[line width=0.8pt,-] (h24) -- (y10);
\draw[line width=0.8pt,-] (h24) -- (y30);
\draw[line width=0.8pt,-] (h24) -- (y40);
\draw[line width=0.8pt,-] (h25) -- (y00);
\draw[line width=0.8pt,-] (h25) -- (y10);
\draw[line width=0.8pt,-] (h25) -- (y30);
\draw[line width=0.8pt,-] (h25) -- (y40);
\draw[line width=0.8pt,-] (h26) -- (y00);
\draw[line width=0.8pt,-] (h26) -- (y10);
\draw[line width=0.8pt,-] (h26) -- (y30);
\draw[line width=0.8pt,-] (h26) -- (y40);
\node[circle,fill=magenta!60, inner sep=2.5pt] (neighcoef) at (10.5, -2.0) {};
\node at (10.5,-2.0)[right]{neighors-coef};
\draw[line width=0.8pt,-] (y00) -- (neighcoef);
\draw[line width=0.8pt,-] (y10) -- (neighcoef);
\draw[line width=0.8pt,-] (y30) -- (neighcoef);
\draw[line width=0.8pt,-] (y40) -- (neighcoef);
\end{tikzpicture}
\end{center}
\caption{An illustration of attention coefficients generation. The edge feature not only server as local information to center point, but also response the effect of neighbors and centroid. Edge-attention and neighbor-attention reflect the important of edge features and neighbor features to centroid, respectively.}
\end{figure}
结果如下:
![](https://img-blog.csdnimg.cn/20200924175552943.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2treGkxMjM0NTY=,size_16,color_FFFFFF,t_70)
|