算法编号不正确

算法编号不正确

我正在尝试在 IEEE 论文中包含一些算法,但这些算法的编号不正确。我是 Latex 的新手,以前从未使用过它。我想将其编号为算法 1 和算法 2 等等。而不是算法 .1 和算法 .2

\begin{algorithm}[H]
\SetAlgoLined
    \KwIn{ Image}
    \KwOut{Detected object (Wave/Spiral)} 
\begin{enumerate}
\item Detect all possible contours in the image
\item Calculate the total area of the uploaded image
\item For each contour:
\begin{itemize}
    \item Calculate the area of the contour
    \item If the area of the contour is more than 80\% of the total area of the image, then discard it and move to the next contour
    \item If the area of the contour is less than 80\% of the total area of the image, then check if the center of the contour is in the center of the image
    \begin{itemize}
    \item If not, discard the contour and move to the next contour
    \item If yes, calculate the aspect ratio of the contour
            \begin{itemize}
            \item If the aspect ratio is more than 1.7, feed the object detected within the contour into the wave classifier model
            \item If the aspect ratio is less than or equal to 1.7, feed the object detected within the contour into the spiral classifier model
            \end{itemize}
    \end{itemize}
\end{itemize}
\item Return the detected object
\end{enumerate}
\caption{Spiral or Wave Algorithm}
 \label{c3:algosow}
\end{algorithm}

正如您所见,它被描绘错了。

答案1

请勿使用algosection选项。

\documentclass{IEEEtran}
\usepackage[ruled,vlined,algosection]{algorithm2e}
\begin{document}
\begin{algorithm}
\caption{Spiral or Wave Algorithm}
\end{algorithm}
\end{document}

在此处输入图片描述

\documentclass{IEEEtran}
\usepackage[ruled,vlined]{algorithm2e}
\begin{document}
\begin{algorithm}
\caption{Spiral or Wave Algorithm}
\end{algorithm}
\end{document}

在此处输入图片描述

相关内容