\documentclass{article}
\usepackage[ruled,vlined,linesnumbered]{algorithm2e}
\usepackage{xepersian}
\settextfont{XB Niloofar}
\renewcommand*{\listalgorithmcfname}{فهرست الگوریتم‌ها} % used for list of algorithms
\renewcommand*{\algorithmcfname}{الگوریتم}      % used for title
\renewcommand*{\algorithmautorefname}{الگوریتم} % used for autoref
\begin{document}
\begin{algorithm}
	\begin{latin}	
		\SetAlgoVlined
		\SetKwInOut{Input}{input}
		\SetKwInOut{Output}{output}
		\Input{Video frames\; } 
		\Output {Detection and tracking while handling occlusion\; } 	
		Catch bounding boxes via YOLO detector\;
		Tracking list $\leftarrow$ Catched bounding boxes\;
		\While{Video is available}{			
			\For{n}{
				\For {Elements $\in$ Tracking list}{
					\eIf{Failure flag had set}{
						Update bounding box location by predictor\;
					}{
						Update bounding box via Median-flow tracker\;
					}
				}	
				Catching bounding boxes via YOLO detector\;
				Updating tracking\; list 		 		
			} 
		}
	\end{latin}
	\caption{{بلوک اصلی}}
	\label{alg:main}
\end{algorithm}
\end{document}
