%Version 2.1 April 2023
% See section 11 of the User Manual for version history
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                                 %%
%% Please do not use \input{...} to include other tex files.       %%
%% Submit your LaTeX manuscript as one .tex document.              %%
%%                                                                 %%
%% All additional figures and files should be attached             %%
%% separately and not embedded in the \TeX\ document itself.       %%
%%                                                                 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%\documentclass[referee,sn-basic]{sn-jnl}% referee option is meant for double line spacing

%%=======================================================%%
%% to print line numbers in the margin use lineno option %%
%%=======================================================%%

%%\documentclass[lineno,sn-basic]{sn-jnl}% Basic Springer Nature Reference Style/Chemistry Reference Style

%%======================================================%%
%% to compile with pdflatex/xelatex use pdflatex option %%
%%======================================================%%

%%\documentclass[pdflatex,sn-basic]{sn-jnl}% Basic Springer Nature Reference Style/Chemistry Reference Style


%%Note: the following reference styles support Namedate and Numbered referencing. By default the style follows the most common style. To switch between the options you can add or remove “Numbered” in the optional parenthesis. 
%%The option is available for: sn-basic.bst, sn-vancouver.bst, sn-chicago.bst, sn-mathphys.bst. %  
 
%%\documentclass[sn-nature]{sn-jnl}% Style for submissions to Nature Portfolio journals
%%\documentclass[sn-basic]{sn-jnl}% Basic Springer Nature Reference Style/Chemistry Reference Style
%\documentclass[sn-mathphys,Numbered]{sn-jnl}% Math and Physical Sciences Reference Style
%%\documentclass[sn-aps]{sn-jnl}% American Physical Society (APS) Reference Style
%%\documentclass[sn-vancouver,Numbered]{sn-jnl}% Vancouver Reference Style
%%\documentclass[sn-apa]{sn-jnl}% APA Reference Style 
%%\documentclass[sn-chicago]{sn-jnl}% Chicago-based Humanities Reference Style
%%\documentclass[default]{sn-jnl}% Default
\documentclass[iicol,sn-basic,Numbered]{sn-jnl}% Default with double column layout
%\usepackage{natbib}
%\usepackage[numbers,sort&compress]{natbib}
%%%% Standard Packages
%%<additional latex packages if required can be included here>
\usepackage{graphicx}%
\usepackage{multirow}%
\usepackage{amsmath,amssymb,amsfonts}%
\usepackage{amsthm}%
\usepackage{mathrsfs}%
\usepackage[title]{appendix}%
\usepackage{xcolor}%
\usepackage{textcomp}%
\usepackage{manyfoot}%
\usepackage{booktabs}%
\usepackage{algorithm}%
\usepackage{algorithmicx}%
\usepackage{algpseudocode}%
\usepackage{listings}%
%%%%
%\usepackage{cite}

\usepackage{booktabs}
\usepackage{diagbox}
\usepackage{bm}
\usepackage{multirow}
\usepackage{float}
%\usepackage{subfloat}
\usepackage{amsmath,amsfonts}
\usepackage{amsmath,amsfonts}
%\usepackage{algorithmic}
%\usepackage{algorithm}
\usepackage{array}
\usepackage[caption=false,font=normalsize,labelfont=sf,textfont=sf]{subfig}
\usepackage{textcomp}
\usepackage{stfloats}
\usepackage{url}
\usepackage{verbatim}
\usepackage{graphicx}
\usepackage{array}
\usepackage[caption=false,font=normalsize,labelfont=sf,textfont=sf]{subfig}
\usepackage{textcomp}
\usepackage{stfloats}
\usepackage{url}
\usepackage{verbatim}
\usepackage{graphicx}

\usepackage{booktabs}
\usepackage{bm}
\usepackage{multirow}
\usepackage{multirow}
\usepackage{amssymb}
\usepackage{arydshln}
%\usepackage{subfigure}
%%%%%=============================================================================%%%%
%%%%  Remarks: This template is provided to aid authors with the preparation
%%%%  of original research articles intended for submission to journals published 
%%%%  by Springer Nature. The guidance has been prepared in partnership with 
%%%%  production teams to conform to Springer Nature technical requirements. 
%%%%  Editorial and presentation requirements differ among journal portfolios and 
%%%%  research disciplines. You may find sections in this template are irrelevant 
%%%%  to your work and are empowered to omit any such section if allowed by the 
%%%%  journal you intend to submit to. The submission guidelines and policies 
%%%%  of the journal take precedence. A detailed User Manual is available in the 
%%%%  template package for technical guidance.
%%%%%=============================================================================%%%%

%\jyear{2021}%

%% as per the requirement new theorem styles can be included as shown below
\theoremstyle{thmstyleone}%
\newtheorem{theorem}{Theorem}%  meant for continuous numbers
%%\newtheorem{theorem}{Theorem}[section]% meant for sectionwise numbers
%% optional argument [theorem] produces theorem numbering sequence instead of independent numbers for Proposition
\newtheorem{proposition}[theorem]{Proposition}% 
%%\newtheorem{proposition}{Proposition}% to get separate numbers for theorem and proposition etc.

\theoremstyle{thmstyletwo}%
\newtheorem{example}{Example}%
\newtheorem{remark}{Remark}%

\theoremstyle{thmstylethree}%
\newtheorem{definition}{Definition}%

\raggedbottom
%%\unnumbered% uncomment this for unnumbered level heads

\begin{document}

\title[Article Title]{Shape-Guided Detection: A joint network combining object detection and underwater image enhancement together}

%%=============================================================%%
%% Prefix	-> \pfx{Dr}
%% GivenName	-> \fnm{Joergen W.}
%% Particle	-> \spfx{van der} -> surname prefix
%% FamilyName	-> \sur{Ploeg}
%% Suffix	-> \sfx{IV}
%% NatureName	-> \tanm{Poet Laureate} -> Title after name
%% Degrees	-> \dgr{MSc, PhD}
%% \author*[1,2]{\pfx{Dr} \fnm{Joergen W.} \spfx{van der} \sur{Ploeg} \sfx{IV} \tanm{Poet Laureate} 
%%                 \dgr{MSc, PhD}}\email{iauthor@gmail.com}
%%=============================================================%%

\author[1]{ \sur{Chao Yang}}\email{chuckyang@seu.edu.cn}


%\equalcont{These authors contributed equally to this work.}

\author*[1]{ \sur{Longyu Jiang}}\email{JLY@seu.edu.cn}
%\equalcont{These authors contributed equally to this work.}

\author[1]{ \sur{Zhicheng Li}}\email{230219182@seu.edu.cn}

\author[1]{ \sur{Xinwen Zhang}}\email{220212110@seu.edu.cn}
%\equalcont{These authors contributed equally to this work.}

\affil*[1]{\orgdiv{School of Computer Science and Engineering}, \orgname{Southeast University}, \orgaddress{\street{No.2 Sipailou}, \city{NanJing}, \postcode{210096}, \state{Jiangsu}, \country{China}}}

%\affil[3]{\orgdiv{Department}, \orgname{Organization}, \orgaddress{\street{Street}, \city{City}, \postcode{610101}, \state{State}, \country{Country}}}

%%==================================%%
%% sample for unstructured abstract %%
%%==================================%%

\abstract{Due to the poor quality of underwater images, they are usually not accurate when used for object detection. Most of the currently available solutions involve pre-processing, such as underwater image enhancement, to improve object detection accuracy. However, the pre-processing approach is to improve the subjective perception of the human eye, which does not necessarily improve the object detection performance and also consumes a lot of computational resources. Therefore, in this paper, we innovatively combine these two tasks and propose Shape-Guided Detection Network (SG Detection). We fuse underwater image enhancement and object detection into one network, where object detection can share clean features through joint learning, thus facilitating underwater object detection, and the object detection results will also guide the direction of underwater image enhancement.  Meanwhile, in the SG Detection network, we embed the object shape  prior features as a learnable module, and design the Shape Priori Enhancement module to achieve the full fusion and interaction between the prior features and local features. In addition, we innovatively adopt a combination of explicit and implicit constraint approach, which ultimately achieves high object detection accuracy. We have conducted extensive experiments on public available datasets, and we find that our approach achieves up to $10 \%$ mAP improvement in object detection performance and significantly increases the processing speed.}

%%================================%%
%% Sample for structured abstract %%
%%================================%%

% \abstract{\textbf{Purpose:} The abstract serves both as a general introduction to the topic and as a brief, non-technical summary of the main results and their implications. The abstract must not include subheadings (unless expressly permitted in the journal's Instructions to Authors), equations or citations. As a guide the abstract should not exceed 200 words. Most journals do not set a hard limit however authors are advised to check the author instructions for the journal they are submitting to.
% 
% \textbf{Methods:} The abstract serves both as a general introduction to the topic and as a brief, non-technical summary of the main results and their implications. The abstract must not include subheadings (unless expressly permitted in the journal's Instructions to Authors), equations or citations. As a guide the abstract should not exceed 200 words. Most journals do not set a hard limit however authors are advised to check the author instructions for the journal they are submitting to.
% 
% \textbf{Results:} The abstract serves both as a general introduction to the topic and as a brief, non-technical summary of the main results and their implications. The abstract must not include subheadings (unless expressly permitted in the journal's Instructions to Authors), equations or citations. As a guide the abstract should not exceed 200 words. Most journals do not set a hard limit however authors are advised to check the author instructions for the journal they are submitting to.
% 
% \textbf{Conclusion:} The abstract serves both as a general introduction to the topic and as a brief, non-technical summary of the main results and their implications. The abstract must not include subheadings (unless expressly permitted in the journal's Instructions to Authors), equations or citations. As a guide the abstract should not exceed 200 words. Most journals do not set a hard limit however authors are advised to check the author instructions for the journal they are submitting to.}

\keywords{underwater image enhancement, GAN-based model, feature fusion, domain adaptation}

%%\pacs[JEL Classification]{D8, H51}

%%\pacs[MSC Classification]{35A01, 65L10, 65L12, 65L20, 65L70}

\maketitle

\section{Introduction}\label{sec1}

%The Introduction section, of referenced text \cite{bib1} expands on the background of the work (some overlap with the Abstract is acceptable). The introduction should not include subheadings.
%
%Springer Nature does not impose a strict layout as standard however authors are advised to check the individual requirements for the journal they are planning to submit to as there may be journal-level preferences. When preparing your text please also be aware that some stylistic choices are not supported in full text XML (publication version), including coloured font. These will not be replicated in the typeset article if it is accepted. 

Over the past few years, the detection of underwater objects has significantly improved with successful applications of deep learning techniques (\cite{lu2023learning}, \cite{ren2022ps}, \cite{yuan2023multi} ) in the field of Generalised Object Detection (GOD). However, due to its unique imaging technology, underwater images tend to suffer from low contrast and blurry information on object edges, which ultimately results in low accuracy of underwater object detection. Currently, underwater image object detection faces three main challenges: (i) Images captured by underwater vision systems suffer from light imbalance and low contrast, which makes it difficult to distinguish object boundaries from the background. (ii) Aquatic organisms tend to live in close proximity to each other, which can cause significant occlusion. (iii) Aquatic organisms are good at hiding themselves and are similar in colour to the background, making it difficult for people to recognise them. Examples of the original underwater image and the ideally enhanced underwater image are shown in Fig.\ref{underwater enhance }.

\begin{figure}[tp]
	\begin{minipage}{\linewidth}
		%		\vspace{1pt}
		\centerline{\includegraphics[width=\textwidth]{underwater-enhance.jpg}}
		\vspace{3pt}
		%		\centerline{UWFAN    UGAN     MLFcGAN     DAGAN}
		%		\vspace{3pt}		
	\end{minipage}
	%     \vspace{3pt}
	\begin{minipage}{0.49\linewidth}
		\centerline{RAW}
	\end{minipage}
	\begin{minipage}{0.49\linewidth}
		\centerline{Enhanced}
	\end{minipage}
	
	%	\end{minipage}
	\caption{ An ideal example of underwater image enhancement algorithms. The underwater image enhancement algorithm is not only able to effectively correct colours and remove noise, fog and other disturbances, but more importantly, it can also reconstruct the information about the object's shape, colour and texture very well, which are the keys to improve the performance of high level vision tasks. }
	\label{underwater enhance }
\end{figure}
There are two main research directions that can be taken to increase the accuracy of underwater image object detection: (1) designing underwater image enhancement algorithms, which can improve the quality of underwater image object detection by enhancing the quality of underwater images; and (2) designing object detection algorithms for underwater object features, which are primarily used to address issues with blurred edges and dense distribution of underwater object.

The first type of methods, based on preprocessing, improve detection accuracy mainly through underwater image enhancement algorithms, which are mainly \cite{liu2021new}, \cite{yeh2021lightweight}, \cite{jiang2021underwater},\cite{li2022beyond}. Although these techniques increase the accuracy of underwater object detection to some level, there are still significant issues: 1) The underwater environment is unpredictable, there is a certain domain bias between the data of the training enhancement algorithm and the object detection data, and the underwater image enhancement algorithm sometimes does not significantly improve the image quality of the underwater object detection dataset; 2) These algorithms, which usually need to apply the underwater image enhancement algorithm first and then run the object detection algorithm, consume a lot of time and resources.



The second type of research approaches, which mostly rely on detection algorithms existing in use, focuses on the deliberate design of modules to address the issue of underwater object detection. For example, Chen \cite{chen2020underwater} used high-resolution and semantically rich feature maps to build a network to significantly improve the accuracy of underwater small object detection; Wang\cite{wang2023self} proposed a weighted plus ghost-CSPDarknet and a simplified PANet to improve the underwater object detection performance; Liu\cite{liu2020towards} proposed domain invariant modules and invariant risk minimization penalties  to improve the generalization performance of underwater object detection. Fu\cite{fu2023learning} searches for transferable prior knowledge from detector-friendly images and uses prior knowledge that can guide the detector to eliminate interfering factors.
Overall, although these algorithms do improve underwater object detection to some extent, the overall underwater image detection accuracy is still at a low level, and these algorithms are dependent on image quality and may be ineffective in cases of poor image quality.

Based on the above analyses, our proposed method combines the advantages of the above two types of methods, and fuses underwater image enhancement and object detection into one network. Meanwhile, we find that in underwater object detection, the objects are mostly rigid bodies, whose shape and structure information remain unchanged in most cases, and other information such as colour and texture can lead to huge differences due to underwater image colour bias. Therefore, in our method, we introduce a shape prior to better consider and utilise the shape information of the target object in the recognition and localisation process, so as to improve the performance of object detection in underwater images. Our contribution can be summarised as follows:
\begin{enumerate}
	\item First, we propose a combined network called Shape-Guided detection (SG Detection), which combines the tasks of object detection and underwater image enhancement and significantly speeds up the preprocessing of data and inference time.
	\item Next, we propose a shape prior enhancement module. Using the interaction between the prior information and the original skip features, we effectively fuse the global and local shape information, which leads to a significant improvement in object detection and underwater image enhancement performance.
	\item Then, we use a combination of explicit and implicit prior constraints in the model to force the model to focus more on the utilization of shape prior information, which will guide the network for better object detection and image enhancement.
	\item Finally, we perform extensive comparison experiments and ablation experiments on the public dataset. Compared with the state-of-the-art algorithms, our proposed method achieves good performance improvement in both object detection performance and underwater image enhancement. Meanwhile, our proposed method significantly improves the pre-processing speed of underwater images.
\end{enumerate}	





\section{Related Work}
\subsection{Underwater Image Enhancement}
The existing underwater image enhancement algorithms are mainly divided into two categories. One type is pixel processing to improve the visual experience of human eyes, and typical methods include histogram equalization, white balance, multi-scale retinex algorithm, contrast-limited adaptive histogram equalization, and so on. Due to the complexity of the underwater environment, it is difficult for such methods to recover high-quality underwater images relying only on observational information. In addition, these methods are only evaluated according to people's subjective preferences and lack clear objective evaluation metrics.

The other category mainly focuses on underwater image recovery algorithms. Pairs of underwater images are trained to achieve the recovery of degraded underwater images to natural images. For example, \cite{li2017watergan} designed WaterGAN network to train degraded underwater images end-to-end, which consists of a depth estimation module and a color correction module. Based on the original image imaging process, \cite{hou2018joint} builds the basic degradation model and then introduces CNN or lightweight residual learning framework to estimate the degradation parameters. These classes of methods have shown some improvement in underwater image quality and some correction for chromatic aberration, but in practice, many algorithms do not adapt well to different scenes. Moreover, many algorithms do not provide much improvement for higher-order vision tasks (e.g., object detection, segmentation, etc.).

\subsection{Underwater Image Object Detection}
Existing methods for underwater object detection are mainly derived from General Object Detection (GOD) and Underwater Image Enhancement (UIE) methods. The former aims to better localize and identify targets, while the latter aims to improve underwater object detection performance by improving the quality of degraded underwater images.

To address the problem of poor localization and recognition accuracy, \cite{mandal2018assessing} combined Faster R-CNN with three classification networks to achieve automatic detection and recognition of fish species in underwater videos. \cite{lin2020roimix} proposed a data enhancement method based on candidate region fusion to generate simulated overlapping, occluded, and blurred training samples, thus improving the accuracy and robustness of the model. \cite{qi2022underwater} proposed a two-stage network of underwater small object detection methods using a deformable convolutional pyramid structure to solve the object deformation problem. \cite{hu2020marine} proposed a sea urchin detection network based on the SSD algorithm. A multi-directional edge detection algorithm was proposed to enhance the spiky edge feature of sea urchins. \cite{chen2020underwater} proposed a neural network structure for underwater small object detection based on DSSD, which was called SWIPENet. These methods mentioned above have improved the efficiency of underwater object detection to some extent, but due to the low contrast of underwater images, color bias, and difficulty in extracting rich details, these problems pose a great challenge to the task of underwater object detection.

\begin{figure*}[htp]
	\begin{center}
		%\fbox{\rule{0pt}{2in} \rule{0.9\linewidth}{0pt}}
		\includegraphics[width=\textwidth]{structure.jpg}
	\end{center}
	\caption{Architecture of Shape-guided Detection Network. Our network is trained directly from underwater images, after a common feature extraction layer, to obtain the original features at different layers. Then, the shape prior information is embedded in the network in a learnable feature ground manner, which is then enhanced for each layer of features after a shape enhancement module. The enhanced feature maps are connected to two different decoders for image decoding and detection decoding, respectively, to obtain clean underwater images and target detection results.}
	%\label{fig:long}
	\label{Network}
\end{figure*}


In addition, researchers have tried to combine underwater image enhancement with object detection. \cite{katayama2019gan} proposed a Cycle-GAN  based underwater image color correction method to improve underwater object detection. \cite{guo2021research}proposed an improved MSRCP and YOLOv3 based underwater target detection method to solve the underwater blurring and low contrast problems of images. \cite{yeh2021lightweight} proposed a depth model for joint learning of color conversion and object detection of underwater images. The image color conversion module aims to convert color images to corresponding grayscale images to solve the problem of underwater color absorption, thus improving object detection performance with lower computational complexity. Most of these methods mentioned above are still based on natural image enhancement methods when it comes to image enhancement with the goal of improving visual quality. However, according to the available literature comparison results, there is no strict positive correlation between detection accuracy and visual quality, and the problems of noise and domain bias caused by such methods are still serious.In conclusion, the optimization goal of underwater image enhancement algorithms should consider the optimization goal of object detection rather than simply improving the visual quality to satisfy the human eye. 

Therefore, the motivation for this paper comes from the fact that we combine the two tasks into a combined network where clean features produced by the enhancement network can be shared in the detection network for better object detection rather than using underwater image enhancement as a pre-processing method for object detection. At the same time, the results of object detection can be used to guide the direction of image enhancement, allowing our image enhancement to focus on improving the performance of object detection. To further improve the network performance, this paper proposes a Shape Prior Enhancement module that embeds shape prior information as a learnable module and constrains it using a combination of explicit and implicit methods. This allows the model to focus on object regions in the image and obtain richer information about object features to improve the performance of object detection and image enhancement.






\section{Methods}
The SG Detection network proposed in this paper is a joint network that incorporates the object detection and underwater image enhancement tasks. In this section, we firstly describe the overall network structure. Then we give a detailed description for the designed shape enhancement module. Finally a specific procedure is given for our proposed combined explicit and implicit edge constraint method.

\subsection{Overall  network structure}
The SG Detection is shown in Fig.\ref{Network}. Our propsed SG Detection consists of three components, feature encoder network (backbone), feature processing network (Shape Enhancement) and decoder network (restoration Decoder and Detection Decoder). Specifically, we first use ResNet-50\cite{he2016deep} as the feature extraction network (backbone) to obtain features at different stages.

Then, in the feature processing stage, we embed the shape information as a learnable feature map into the SG detection network and interact with the different stages feature maps through the Shape Prior Enhancement module. We embed these prior features from the highest level, updating them layer by layer and passing them down. This allows each layer features to fully interact with the shape prior features to capture richer information about the object area.

Finally, the different stage  features processed by the shape prior enhancement module are up-sampled layer by layer and constructed with lateral connections. The bottom layer features is used for image decoding to achieve clean underwater images, while the middle four layers  features are connected to the  detection head for object category and location.

\begin{figure*}[htp]
	\begin{center}
		%\fbox{\rule{0pt}{2in} \rule{0.9\linewidth}{0pt}}
		\includegraphics[width=\textwidth]{shape-enhancement.jpg}
	\end{center}
	\caption{The structure of Shape Prior Enhancement module. After the self-attention mechanism, the global shape prior is obtained and the better local features are acquired by interacting with the original skip features at each level. The full fusion of global and local features allows the network to get more accurate object detection results.}
	%\label{fig:long}
	\label{shape enhancement}
\end{figure*}


\subsection{Shape Prior Enhancement}
\paragraph{Overview} Shape information refers to information such as edges, contours and sizes of objects. When we perform underwater object detection, these specific classes of objects usually have specific shapes and structures, and this shape and structure information can help us distinguish objects significantly; similarly, for underwater image enhancement, our mission is to better detect objects, and these shapes in turn provide a priori knowledge for image enhancement, which allows us to focus our enhancement on object regions. For this reason, we propose the Shape Prior Enhancement module to help our model better account for and exploit shape information for more accurate object detection.

The proposed Shape Prior Enhancement module in our model architecture that focuses on improving the shape edge features of the object region in the image, as shown in Fig.\ref{shape enhancement}. Global Shape Enhancement and Local Shape Enhancement are the two components of our Shape Prior Enhancement module. Global Shape Prior Enhancement (GSPE) is used to model long-range contextual dependencies to capture rich texture information associated with global regions, while Local Shape Prior Enhancement (LSPE) is used to capture local visual structural elements at multiple scales and to localise objects at different scales.

\paragraph{Global Shape Prior Enhancement} 

To explicitly introduce image shape prior information into our SG detection network, we define an $ N \times H \times W $ shape prior feature $S_{o}$, where N is the number of categories, with the same resolution as the top-level feature map. Since a fixed receptive field of the convolution will lead to an asymmetry in spatial information, we propose a Global Shape Prior Enhancement module that aims to capture the long-range dependency of the shape prior. Inspired by the VIT structure, we first generate a global shape prior with N channel interactions by using self-attention \cite{shaw2018self}, and then perform a residual connection with the original shape prior features. The global shape prior between the N categories is constructed by the following formula, which describes the similarity and dependence between the different shape prior channels.

\begin{align}
	S_{g}=Softmax(\frac{Q_{s}( S_{o})\times K_{s}( S_{o} )^{T}  }{\sqrt{N} } )  \times V_{s}( S_{o})+S_{o}
\end{align}

Where, $ Softmax $ represents the normalization operator, $ Q_{s} $ and $K_{s} $ denote the convolutional transform that projects $S_{o}$ into the query and key vectors, T is the transpose operator, $V_{s} $ denotes the convolutional transform that projects $S_{o}$ into the value vector, $\times $ denotes the process of matrix multiplication, and $S_{g} $ is the final enhanced global shape prior feature.

After the above operations, the $S_{g} $ can establish long-term dependencies within $S_{o}$, including rough shape and position representations,  as well as sufficient texture information of the global regions.

\begin{figure}[tp]
	\begin{center}
		%\fbox{\rule{0pt}{2in} \rule{0.9\linewidth}{0pt}}
		\includegraphics[width=0.49\textwidth]{cross-scale align.jpg}
	\end{center}
	\caption{The detail of Cross-Scale Alignment  module.}
	%\label{fig:long}
	\label{cross-scale align}
\end{figure}

\paragraph{Local Shape prior Enhancement}The shape prior $S_{o} $, after GSPE processing, contains rich contextual information, but lacks local visual structure features and does not have accurate shape and contour information. Therefore, we design the Local Shape Prior Enhancement module to interact the original skip feature $F_{o} $ with the enhanced shape prior feature $S_{g} $ so to obtain more detailed local shape information.

First, we perform a convblock operation on the extended shape prior to expand the channel dimension to be consistent with Fo. Then, the Cross-Scale Feature Alignment (CSFA) module is designed to achieve deep interaction between local features and the shape prior, as shown in Fig.\ref{cross-scale align}. Finally, the SE Net\cite{hu2018squeeze} structure is used to assign different channel weights, which allows some features to be highlighted to achieve a better representation of the object region. 

\paragraph{Cross-Scale Feature Alignment.} Among them, the CSFA is the core of the interaction between local and global features, and its design is motivated by the fact that there is a semantic gap between features of different levels, which can lead to inefficient feature fusion. Therefore, in our cross-scale feature alignment module, we calculate the correlation between pixels in different feature maps by matrix multiplication, and then use this correlation as the weight vector of the feature maps at each level to bridge the semantic gap and achieve the effective fusion of features at different scales. The specific computational process is as follows.

First, the local feature $F_{o} $  is operated by maxpooling and the convolution block module to obtain a feature map F of the size $H \times W \times C $. Similarly, we use a convolutional block operation on  $S_{g} $ to obtain the same size feature P.  P and F are expressed as follows:
\begin{equation}
	\begin{aligned}
		&	F=SeqConv_{3\times 3}^{2D}(Maxpooling(F_{0}) \\
		&   P=SeqConv_{3\times 3}^{2D}(S_{g} ) 
	\end{aligned}
\end{equation}
Where, $SeqConv$ refers to sequentially performs the 2D 3$\times$3 convolution with Leaky ReLU activation. 
%\begin{equation}
%	\begin{aligned}
%		P=SeqConv_{3\times 3}^{2D}(S_{g} ) 
%	\end{aligned}
%\end{equation}

Then, reshaping operations are performed at the same time on F and P in order to scale their dimensions to G and L of $C\times HW$. Based on G and L, we define the similarity matrix $\mathrm{S}_{j i}$ . The similarity matrix $\mathrm{S}_{j i}$   is defined as follows:
\begin{equation}
	\begin{aligned}
		\mathrm{s}_{j i}  = \frac{\exp \left(L_{i} \cdot G_{j}\right)}{\sum_{i= 1}^{M} \exp \left(L_{i} \cdot G_{j}\right)},
	\end{aligned}
\end{equation}
where $ \mathrm{s}_{j i}$ measures the correlation between the ith position in the lower feature map and the jth position in the higher feature map. M denotes the number of pixels. The greater the similarity between the feature representations of pixels at two locations, the higher the correlation between them. 

We transpose G for matrix multiplication and apply a softmax layer to compute the spatial attention map $S\in HW\times HW$.

\begin{equation}
	\begin{aligned}
		S=softmax(\frac{G^{T}\times L }{\sqrt{N} } )
	\end{aligned}
\end{equation}
Finally, we perform matrix multiplication with G and L,  based on S. The results of the two are channel concat to obtain the enhanced feature $ F_{l}^{'}$.
\begin{equation}
	\begin{aligned}
		F_{l}^{'}=U\cdot Concat(reshape(G\times S)+reshape(L\times S))
	\end{aligned}
\end{equation}
Where $ U\cdot$ refers to the transpose convolution  following  by a 1 $\times$ 1 convolution.   $F'\in H\times W \times 2C$. The concat features contain local and global information, and the importance of the features of each channel is not the same, so it is necessary to refine their features and highlight the important ones.
\begin{equation}
	\begin{aligned}
		F_{L}=Resconv_{3\times 3}^{2D}(\sigma (W_{2}\delta (W_{1}(  GAP(F_{l}^{'})  ))  \times F_{l}^{'})\\+ F_{o})
	\end{aligned}
\end{equation}


Where, $ \sigma $ represents for sigmoid function, $ W_{1}, W_{2}$ refers to two Full Connections, $ Resconv$ means sequentially conducts the 2D 3 $\times$ 3 convolution with Resblock and Leaky ReLU activation function. $\delta $ represents the Relu function, and $ F_{l}^{'}$ represents the feature after CSA. 

After global and local enhancement, we also update the shape prior features. We denote the output shape prior feature as $S_{g}^{'}$ , which is updated by follows:

\begin{equation}
	\begin{aligned}
		S_{g}^{'}=SeqConv_{3\times 3}^{2D}(D\cdot (SeqConv(F_{L}))+S_{g}) 
	\end{aligned}
\end{equation}
Where, $D\cdot$  means Maxpooling operation. Finally, we add local information to the global shape prior features. This provides us with more detailed local information.


In summary, our proposed shape prior enhancement module first performs a global shape prior module to obtain a coarse shape prior with adequate global texture information. It is also enhanced by local shape prior to obtain more refined shape information. In addition, the original skipped features are further enhanced by interacting with the global shape prior, which will facilitate the generation of features with a discriminative shape representation and global context, and ultimately obtain more accurate object detection performance.

\subsection{Shape Prior Constraints}
\label{shape constraints}

Currently, there are different ways to integrate prior information with models, such as atlas-based models \cite{cabezas2011review}, statistical-based models \cite{reynolds2009gaussian}, and U-NET-based models \cite{you2023learning}. The first two approaches have poor generalization performance, while U-NET based models have better generalization performance.

In addition, based on the embedding method, it can be divided into explicit constraints and implicit constraints. Explicit constraints refer to the direct combination of interpretable information, such as shape and structure, with the model. It has the advantage of strong interpretability, but is not easy to obtain. Implicit constraints, on the other hand, are achieved by adding specific prior information, such as a loss function or regularisation term, to the model. For example, in the U-Net image segmentation model, the DICE \cite{soomro2018strided} loss function is often used to force the model to focus on contour information. The disadvantage of implicit constraints is poor interpretability.

Therefore, we propose a joint explicit and implicit shape a priori constraint method based on the SG detection network structure, Shape Prior Constraint (SPC), which can help us to better consider and exploit the shape information for more accurate object detection. It explicitly takes shape prior information as input and uses this information to guide the model to better detect objects. However, this constraint is not entirely explicit, as the prior information is not obtained directly from the image object, but from training through the design of a loss function.

In our model, as shown in Fig.\ref{shape enhancement}, we add a new sigmoid output after each layer of the feature map to classify each pixel point in the image into two categories (edge or non-edge), and then calculate the edge pixel cross-entropy loss to make our model pay more attention to pixels at the edge of the object. The calculation process is as follows:
\begin{equation}
	\begin{aligned}
		\ell = -\sum _{i,j}(Y_{i,j}\alpha log(E_{i,j} )  ) +\\
		(1- Y_{i,j})(1-\alpha )log(1-E_{i,j} )
	\end{aligned}
\end{equation}



Where E,Y is the generated shape map and the corresponding ground-truth, $E_{i,j},  Y_{i,j} $are the element of E, Y; $ \alpha = | Y^{-} |/  | Y^{-} |+  | Y^{+} |$ indicates the percentage of negative pixel samples (i.e., non-edge points). In addition, we obtain multiple shape map outputs$ S_{g}^{1}, S_{g}^{2}...S_{g}^{4}$, obtained by feeding the original skip features at different scales into the shape prior enhancement module. The overall Shape loss function is as follows:
\begin{align}
	L_{s}= \frac{1}{4}\sum_{k=1}^{4}   \ell (S_{g}^{k} ,Y)
\end{align}
When explicit and implicit constraints are used jointly, our proposed SG Detection Net can focus more on the processing of object shape information, and thus to achieve better object detection results.

\subsection{The Overall Loss Function}

Our model implements two tasks, object detection and underwater image enhancement, so the overall loss of the model is as follows:
\begin{equation}
	\begin{aligned}
		L_{\text {Total }} & = L_{\text {de}}+L_{\text {re}}+L_{s},
	\end{aligned}
\end{equation}
Where, $L_{\text{de}}$ represents the detection loss,  $L_{\text{re}}$ refers to the image reconstruct loss and $L_{s}$ stands for the Shape loss which is detailed introduced in Section.\ref{shape constraints}.

The $L_{\text{de}}$ is expressed as follows:

\begin{equation}
	\begin{aligned}
		L_{\text {de }} & = L_{\text {Cls}}+\lambda L_{\text {IoU}}+L_{FOCAL},
	\end{aligned}
\end{equation}
Where $\lambda$ is the hyperparameter, which is usually set to 5 in object detection training stages. $L_{\text {Cls}}$ is the classification loss, $L_{\text {IoU}}$ is the regression loss, and $L_{\text {FOCAL}}$ stands for Focal loss\cite{lin2017focal}.

The  $L_{\text{re}}$ loss is used to eveluate the similarity between the restored image and the Ground-Truth. It is formulated as follows:
\begin{equation}
	\begin{aligned}
		L_{re} & = \frac{1}{n} \sum_{i= 1}^{n}\left(\hat{\mathbf{X}}_{i}-\mathbf{X}_{i}\right)^{2}
	\end{aligned}
\end{equation}
Where, $\hat{\mathbf{X}}_{i}$ represents the enhanced image, $\mathbf{X}_{i}$ refers to the Ground-truth image, n stands for the batch size. We train the image enhancement network by computing the MSE loss.

In order to make our model finally obtain the best object detection performance, we weight the three losses in $ L_{\text {Total }}$ by assigning different weights $\lambda_{1}$, $\lambda_{2}$ and $\lambda_{3}$, respectively. So, the overall loss function is formulaed as follows:

\begin{equation}
	\begin{aligned}
		L_{\text {Total }} & = \lambda_{1}L_{\text {de}}+\lambda_{2}L_{\text {re}}+\lambda_{3}L_{s},
	\end{aligned}
\end{equation}
Eventually, we are surprised to find that when the three weights are configured as 0.2, 0.8 and 0.2, the enhancing effect on object detection is most obvious. The detailed experimental validation process is shown in Section.\ref{Ablation}.


\section{Expriments}
\subsection{Datasets and Evaluation Metrics}
We have conducted a large number of experiments to verify the effectiveness of our method. For the dataset, we used the URPC2021 dataset. This is an underwater optical image data for underwater object detection. The dataset has a total of 7600 underwater object images divided into four categories: scallop, echinus, holothurian, and starfish. UTDAC2020 is an underwater dataset, which stands for Underwater Target Detection Algorithm Competition 2020. There are 5168 training images and 1293 validation images. It has the same categories as the URPC dataset. The image data are collected through the field and some of the objects are similar to the environment, which makes the overall object detection difficult. The samples of URPC are shown in Fig.\ref{underwater samples}, and the dataset division strategy is shown in Table \ref{tab:Datasets}.

\begin{figure}[tp]
	\begin{center}
		%\fbox{\rule{0pt}{2in} \rule{0.9\linewidth}{0pt}}
		\includegraphics[width=\linewidth]{samples.jpg}
	\end{center}
	\caption{The sample of dataset we used, along with the corresponding shape mask and shape edge Ground-Truth.}
	%\label{fig:long}
	\label{underwater samples}
\end{figure}


\begin{table}[t]
	\centering
	\caption{Summary of datasets used in our expriment}
	\begin{tabular}{lcc}
		\toprule
		Dataset & Train &   Test  \\
		\midrule
		
		UTDAC &      5168  & 1293   \\
		URPC2021 &      5320   & 2813 \\
		\midrule	
		Total & 10488 & 4106\\	
		
		%In total  & 16800  & 7780     \\
		\bottomrule
	\end{tabular}      	
	\label{tab:Datasets}
\end{table}





Since our model is ultimately to achieve high accuracy underwater target detection, we mainly use mAP as as the main model evaluation metric. The mAP we use is mainly computed as COCO. In the evaluation process, COCO evaluates the access points under a total of 10 IoUs with different IoU ratios (IoU) [0.5:0.05:0.95], and finally takes the average of the access points under these thresholds as the result, denoted as mAP@[.5, .95].

To further validate the enhancement performance of our model for underwater images, we use three non-reference metrics, UCIQE\cite{yang2015underwater}, UIQM\cite{panetta2015human} and FDUM\cite{yang2021reference}. UCIQE is a linear combination of chroma, saturation and contrast, designed to quantify non-uniform colour cast, blur and contrast. UIQM and FDUM measure colourimetry, sharpness and contrast from different perspectives.

\begin{table*}[tp]
	\renewcommand{\arraystretch}{1.5}
	\centering
	\caption{Comparison of mAP metrics for underwater image data object detection. The best results are shown in bold. The experimental results show that the SG Detection network designed in this paper combined with different detectors can achieve improved detection performance and inference speed with significant improvement compared to existing underwater object detectors and pre-processing object detection methods.}	
	\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}llllc@{\extracolsep{\fill}}}
		\hline
		\specialrule{0em}{1pt}{1pt} 
		method       & backbone    & mAP (URPC/UTDAC)   & Parameters(M)   &FPS \\
		\hline
		\specialrule{0em}{1pt}{1pt}
		\textbf{SOTA Detectors:}&&&&               \\ 
		YOLO\_V5    & DarkNet   & 0.356/0.384  & \textbf{54.2} &    58.4       \\
		YOLOX   & CSPDarkNet   & 0.371/0.432  & 60.3 &     54.8      \\
		Faster R-CNN    & ResNet-50   & 0.401/0.428  & 122.14 &       29.4   \\
		Faster R-CNN   & ResNet-101   & 0.414/0.445  & 131.6  &      28.5    \\
		Libra R-CNN      & ResNet-50    & 0.420/0.458  & 146.60      &     24.4   \\
		Libra R-CNN & ResNet-101    & 0.435/0.454  & 164.9        &22.5  \\
		Sparse R-CNN   & ResNet-50     & 0.425/0.443  & 212.5   &  18.6      \\
		DiffusionDet  & ResNet-50    & 0.428/0.433  & 314.4        &   12.2\\
		FCOS    &  ResNet-50    & 0.394/0.428  & 117.4  &       27.8  \\
		VFNet   &  ResNet-101    & 0.416/0.440  & 141.4      & 23.1    \\
		\hline
		\specialrule{0em}{1pt}{1pt}
		\textbf{Underwater Object Detector:} &&&  &\\
		Boosting R-CNN    &  ResNet-50    & 0.433/0.462  & 143.55 &    23.0        \\
		Boosting R-CNN  &  ResNet-101    & 0.443/0.456  & 160.55 &       20.3     \\
		RoiAtt & ResNet-50   & 0.462/0.460  & 183.45            &  18.1 \\
		RoiAtt  & ResNet-101   & 0.473/0.467  & 192.45       &    17.8  \\
		SWIPENet      & ResNet-50    &0.451/0.471  &  166.7     &      19.3 \\
		SWIPENet        & ResNet-101    &0.466/0.478  & 179.4   &     18.9     \\
		\hline
		\specialrule{0em}{1pt}{1pt}  
		\textbf{Ours:} &&& &\\
		\textbf{SG Detection(YOLOX )} & CSPDarknet   &0.471/0.483 & 124.4 &  \textbf{31.8}  \\
		SG Detection(Faster R-CNN ) & ResNet-50   &0.476/0.488 & 227.7 & 17.4 \\
		\textbf{SG Detection(Faster R-CNN) } & ResNet-101        & \textbf{0.482/0.491}  & 244.6  &  14.1         \\		
		
		\hline
	\end{tabular*}
	\label{compAll}	
	
\end{table*}

\subsection{Implement Details}
Our approach requires paired underwater images (original underwater image and corresponding clear image) and precise information about the shape of the object.  To obtain "clean" image pairs, our paper applies the latest algorithms such as CWR\cite{han2022underwater}, UGAN\cite{fabbri2018enhancing} and other subjective image enhancement methods such as white balance, contrast enhancement, smoothing and denoising to the URPC and UTDAC datasets. Then, we manually select the image with the most improved visual quality from various enhancement methods as the corresponding "clean" ground truth image for each image in the datasets.

In order to obtain the prior information about the shape of the object more accurately, the object region is first extracted based on the annotated file, and then the canny operator is run to obtain the shape contour of the object. After completing the above steps, the paired underwater images and the shape  prior information are obtained and fed into our  proposed SG Detection network for training. The data used for our training and the corresponding clean and shape images are shown in Fig.\ref{underwater samples}.



As for the experimental network part, our SG Detection network is mainly combined with YOLOX and Faster R-CNN to share the backbone network. And all the backbone networks are pre-trained on the ImageNet dataset. Specifically, our network was trained with stochastic gradient descent (SGD) for 50k iterations with an initial learning rate of 0.0001 and mini-batches of 4 images. At 20k and 40k iterations, the learning rate decreases by a factor of 10, respectively. And the weight decay and momentum were set to 0.0001 and 0.9, respectively. all models were trained based on NVIDIA RTX 3090 with 24GB memory.

\begin{figure*}[tp]
	\begin{minipage}{0.994\linewidth}
		%		\vspace{1pt}
		\centerline{\includegraphics[width=\textwidth,height=0.5\linewidth]{RESULTS-1.pdf}}
		\vspace{3pt}
	\end{minipage}
	\begin{minipage}{0.19\linewidth}
		\centerline{UGAN}
	\end{minipage}
	\begin{minipage}{0.19\linewidth}
		\centerline{UWGAN}
	\end{minipage}
	\begin{minipage}{0.19\linewidth}
		\centerline{CWR}
	\end{minipage}
	\begin{minipage}{0.19\linewidth}
		\centerline{U-Transformer}
	\end{minipage}
	\begin{minipage}{0.19\linewidth}
		\centerline{Clean}
	\end{minipage}
	
	\begin{minipage}{\linewidth}
		%		\vspace{1pt}
		\centerline{\includegraphics[width=\textwidth,height=0.5\linewidth]{RESULTS-2.pdf}}
		\vspace{3pt}
		%		\centerline{UWFAN    UGAN     MLFcGAN     DAGAN}
		%		\vspace{3pt}		
	\end{minipage}
	
	\begin{minipage}{0.19\linewidth}
		%		\vspace{1pt}
		\centerline{RAW}
	\end{minipage}
	\begin{minipage}{0.19\linewidth}
		%		\vspace{1pt}
		\centerline{Boosting R-CNN}
	\end{minipage}
	\begin{minipage}{0.19\linewidth}
		%		\vspace{1pt}
		\centerline{RoiAtt}
	\end{minipage}
	\begin{minipage}{0.19\linewidth}
		%		\vspace{1pt}
		\centerline{SWIPTNet}
	\end{minipage}
	\begin{minipage}{0.18\linewidth}
		%		\vspace{1pt}
		\centerline{SG Detetction}
	\end{minipage}
	
	%	\begin{minipage}{0.1\linewidth}
	%		%		\vspace{1pt}
	%		\centerline{B R-CNN}
	%	\end{minipage}
	%	\begin{minipage}{0.19\linewidth}
	%		\centerline{RoiAtt}
	%	\end{minipage}
	%	\begin{minipage}{0.19\linewidth}
	%		\centerline{SWIPENet}
	%	\end{minipage}
	%	\begin{minipage}{0.19\linewidth}
	%		\centerline{Ours(SG Detection)}
	%	\end{minipage}
	%	%	\end{minipage}
	\caption{ Test samples of different methods, and the red circles represent missed targets. In terms of visual results, our proposed method has the most accurate object detection results and a good visual experience. For the other methods, although the visual experience is improved, the accuracy of object detection is not improved. }
	\label{Testing results}
\end{figure*}

\subsection{Comparsion Study}
\subsubsection{ Comparison of Underwater Image Object Detection}
We carry out experiments comparing our own model, with various  state of the art(SOTA) object detector : Faster R-CNN\cite{ren2015faster} , YOLOX\cite{ge2021yolox}, Libra R-CNN\cite{pang2019libra}, Spares R-CNN\cite{sun2021sparse}, FCOS \cite{tian2019fcos}, DiffusionDet\cite{chen2022diffusiondet}, VF\cite{ahmed2019vfnet}, pre-processing object detection algorithm like MRSCR\cite{jobson1997multiscale}, GUDCP \cite{liang2021gudcp}, UWGAN\cite{li2017watergan}, UGAN\cite{fabbri2018enhancing}, CWR\cite{han2022underwater}, U-Transformer\cite{peng2023u} and underwater object detector: RoiAtt\cite{liang2022excavating}, Boosting R-CNN \cite{song2023boosting}, SWIPENet \cite{chen2020underwater}, and we use mAP as an evaluation metric for object detection performance.



The comparison results of mAP are shown in Table.\ref{compAll}. From the results we can conclude that:

(a) Our method has significant performance advantages. Both with the state-of-the-art object detectors and underwater object detectors, our method has a performance gain.

(b) Our method also shows generality. When our method is combined with different detectors such as YOLOX, Faster R-CNN, etc., the mAP performance metrics can be improved by up to 10$\%$, which proves that our proposed structure is applicable to a wide range of detectors.

The visual results of object detection between our method and various methods are shown in Fig.\ref{Testing results}. It can also be seen from the figure that the miss and false detection rates of our method are significantly reduced, and its object detection performance is greatly improved.






\begin{figure*}[tp]
	\begin{minipage}{\linewidth}
		%		\vspace{1pt}
		\centerline{\includegraphics[width=\textwidth,height=0.4\linewidth]{enhance results.pdf}}
		\vspace{3pt}
	\end{minipage}
	\begin{minipage}{0.13\linewidth}
		\centerline{RAW}
	\end{minipage}
	\begin{minipage}{0.13\linewidth}
		\centerline{UGAN}
	\end{minipage}
	\begin{minipage}{0.15\linewidth}
		\centerline{UWGAN}
	\end{minipage}
	\begin{minipage}{0.15\linewidth}
		\centerline{U-Transformer}
	\end{minipage}
	\begin{minipage}{0.13\linewidth}
		\centerline{CWR}
	\end{minipage}
	\begin{minipage}{0.13\linewidth}
		\centerline{Clean}
	\end{minipage}
	\begin{minipage}{0.13\linewidth}
		\centerline{OURS}
	\end{minipage}
	%	\end{minipage}
	\caption{ The visual comparison results  of several deep learning based image enhancement algorithms. Compared to several state-of-the-art underwater image enhancement algorithms, our approach demonstrates notable performance in terms of visual effects. }
	\label{Enhancing results}
\end{figure*}

\begin{table*}[tp]
	\renewcommand{\arraystretch}{1.5}
	\centering
	\caption{The comparison results of image enhancement performance on URPC and UTDAC dataset.}	
	\resizebox{\linewidth}{!}{
		\begin{tabular}{l|ccc|ccc}
			\hline
			%		\specialrule{0em}{1pt}{1pt} 
			Datasets      & \multicolumn{3}{c|}{URPC}   & \multicolumn{3}{c}{UTDAC}      \\
			\hline
			Methods/Metrics      & UCIQE$\uparrow$ &UIQM$\uparrow$ &FDUM$\uparrow$   &UCIQE$\uparrow$ &UIQM$\uparrow$  & FDUM$\uparrow$       \\
			\hline
			%		\specialrule{0em}{1pt}{1pt} 
			RAW  &  0.41 & 0.43 & 0.33 & 0.42 & 0.47 &0.35       \\
			Clean &0.64&0.86&\textbf{0.59} &0.64&0.79&\textbf{0.59}\\
			MRSCR\cite{jobson1997multiscale} &  0.37 & 0.42 & 0.29 & 0.45 & 0.49 &0.40       \\
			GUDCP\cite{liang2021gudcp}  & 0.43  & 0.44  & 0.29  & 0.54  & 0.47 & 0.36    \\
			\hdashline
			UGAN\cite{fabbri2018enhancing} & 0.49    &0.59&0.41 &0.56   & 0.67&0.46      \\
			UWGAN\cite{li2017watergan} &  0.53   &0.63  &0.47   & 0.55  &0.74& 0.41     \\
			CWR\cite{han2022underwater} &  0.66  & 0.79 &0.51   & 0.66& 0.78& 0.56     \\
			U-Transformer\cite{peng2023u} &  \textbf{0.68}  & 0.84 &0.54   & 0.66& \textbf{0.79}& \textbf{0.59}     \\
			Ours &   0.65 & \textbf{0.88}  & 0.57  &\textbf{0.71} &0.75& 0.56       \\
			\hline
		\end{tabular}}
	\label{enhance compare}	
\end{table*}%

\subsubsection{Comparision of Underwater Image Enhancement}

Our SG detection network implements object detection and underwater image enhancement simultaneously, so we also compare it with various SOTA underwater image enhancement methods to validate the underwater image enhancement performance of our method. 
Since the URPC and UTDAC datasets we use do not have corresponding reference images, we use UCIQE, UIQM and FDUM as evaluation metrics to evaluate the enhancement effect from a subjective perspective.

The results of the comparison experiments are shown in the Table.\ref{enhance compare}. From the comparison results, we can conclude that our method still shows competitive performance compared to the SOTA underwater image enhancement algorithms, like CWR and U-Transformer, even though our method focuses more on the object detection performance.

The visual comparison results are shown in Fig.\ref{Enhancing results}. From the figure, it can be observed  that our method is still better in terms of visual results, both in terms of colour saturation, brightness and sharpness, compared to the most advanced deep learning based methods such as UGAN, UWGAN, U-Transformer and CWR. More importantly, in the object regions, our method recovers better, with more detail and texture in the object.




\subsubsection{Analysis of Underwater Image Enhancement and Object Detection}

We compare the object detection and underwater image enhancement performance separately. On this basis, we compare the object detection performance of images processed by different underwater image enhancement algorithms, so as to further explore the connection between underwater object detection and underwater image enhancement. The comparison results are shown in Table.\ref{enhance detection compare}.

\begin{table*}[tp]
	\renewcommand{\arraystretch}{1.5}
	\centering
	\caption{The mAP comparison of pre-processing based methods.}	
	\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lllc@{\extracolsep{\fill}}}
		\hline
		\specialrule{0em}{1pt}{1pt} 
		method          & mAP (URPC/UTDAC)   & Parameters(M)   &FPS \\
		\hline
		\specialrule{0em}{1pt}{1pt} 
		RAW &0.401/0.428& 122.4 &  29.4 \\
		Clean &0.465/0.478 &122.4 & 29.4  \\
		\hdashline
		MSCR & 0.375/0.389  & 122.4 &    11.6     \\
		GUDCP     & 0.376/0.401  & 122.4   &   18.1  \\
		UGAN      & 0.428/0.441  & 146.6+122.4 &      11.2  \\
		UWGAN   &  0.431/0.450 & 186.2+122.4  &     9.8    \\
		CWR   &  0.461/0.475 & 221.4 + 122.4  &     8.1   \\
		U-Transformer   &  0.467/0.477 & 383.4 + 122.4  &     5.1   \\
		SG Detection &0.482/0.491&244.6 &14.1\\
		\hline
	\end{tabular*}
	\label{enhance detection compare}	
	
\end{table*}


From this we can analyse that, firstly, there is no strict positive correlation between underwater image enhancement and object detection. For example, the original image has a better object detection performance compared to methods such as MRSCR and GUDCP.

Another point is that our proposed method is significantly improved in terms of both model size and inference speed. Existing preprocessing-based methods consume a lot of computational time and resources, while our method significantly improves the inference time while improving the performance.



\begin{table*}[htp]
	\renewcommand{\arraystretch}{1.5}
	
	\centering
	\caption{Detection results of ablation study. UNET stands for detection network base with another image generation decoder; SPE stands for shape prior enhancement module; SPC stands for shape prior constraint.}
	\label{ablation}	
	\resizebox{\linewidth}{!}{	
		\begin{tabular}{llccc}
			\hline
			method     & backbone  &     mAP(URPC/UTDAC)    &         Parameters     &       FPS        \\ \hline
			\specialrule{0em}{1pt}{1pt}
			Faster R-CNN       & ResNet-101 &     0.414/0.445 &  131.6  &     24.5     \\ 			
			Faster R-CNN +UNET    & ResNet-101 &   0.431/0.450   &    146.6      &        22.5 \\ 
			Faster R-CNN +SPE    & ResNet-101 &     0.461/0.464 &    144.6      &  22.8  \\ 
			Faster R-CNN +SPC    & ResNet-101 &     0.443/0.459 &      148.6   0 &   22.3  \\ 
			Faster R-CNN +SG Detection & ResNet-101 &     \textbf{0.482/0.491} & \textbf{164.6}&    \textbf{20.1} \\ \hline
			\specialrule{0em}{1pt}{1pt}
			YOLOX       & CSPDarknet &     0.371/0432 &    60.3 &         54.8  \\ 			
			YOLOX +UNET    & CSPDarknet &     0.422/0.446 &   70.4 &        51.1 \\ 
			YOLOX +SPE    & CSPDarknet &     0.451/0.469 &     71.6     &   50.4  \\ 
			YOLOX +SPC    & CSPDarknet &     0.432/0.440 &  64.6        &   52.4  \\ 
			YOLOX +SG Detection & CSPDarknet &   \textbf{0.471/0483} & \textbf{84.4}&    \textbf{46.8} \\ \hline
		\end{tabular}
		
	}
\end{table*}

\subsection{Ablation Study}
\label{Ablation}
\textbf{Effect on Underwater image object detection.} We also performed detailed ablation experiments to validate the effectiveness of our proposed method. First, the object detection performance is compared. We used YOLOX and Faster R-CNN as the detection head, combined with our proposed SG Detection network, and gradually added various improvements to evaluate the effectiveness of our method, the results of which are shown in Table.\ref{ablation}.




From the results, we can conclude that our model can achieve up to 10$\%$ performance improvement in mAP values (with YOLOX as the detector) and significant improvement on different frameworks, demonstrating the effectiveness and generality of our model.
Furthermore, we can conclude that each of our proposed modules provides different levels of performance improvement for object detection. The two object detection networks, YOLOX and Faster R-CNN, show the greatest performance improvement after adding the shape prior enhancement module proposed in this paper. This may also indicate that for the object detection task, the performance improvement is greater when more a priori information can be added. The visual ablation results of object detection are shown in Fig.\ref{ablation results}.

\begin{figure*}[tp]
	\begin{minipage}{\linewidth}
		%		\vspace{1pt}
		\centerline{\includegraphics[width=\textwidth]{ablation-results.pdf}}
		\vspace{3pt}
		%		\centerline{UWFAN    UGAN     MLFcGAN     DAGAN}
		%		\vspace{3pt}		
	\end{minipage}
	%     \vspace{3pt}
	\begin{minipage}{0.22\linewidth}
		\centerline{U-NET}
	\end{minipage}
	\begin{minipage}{0.25\linewidth}
		\centerline{U-NET+SPE}
	\end{minipage}
	\begin{minipage}{0.25\linewidth}
		\centerline{U-NET+SPC}
	\end{minipage}
	\begin{minipage}{0.25\linewidth}
		\centerline{SG Detection}
	\end{minipage}
	%	\end{minipage}
	\caption{ Some examples of our object detection ablation experiments. }
	\label{ablation results}
\end{figure*}



\begin{figure*}[tp]
	\begin{minipage}{\linewidth}
		%		\vspace{1pt}
		\centerline{\includegraphics[width=\textwidth]{feature.pdf}}
		\vspace{3pt}
		%		\centerline{UWFAN    UGAN     MLFcGAN     DAGAN}
		%		\vspace{3pt}		
	\end{minipage}
	%     \vspace{3pt}
	\begin{minipage}{0.24\linewidth}
		\centerline{U-NET}
	\end{minipage}
	\begin{minipage}{0.24\linewidth}
		\centerline{U-NET+SPE}
	\end{minipage}
	\begin{minipage}{0.24\linewidth}
		\centerline{U-NET+SPC}
	\end{minipage}
	\begin{minipage}{0.24\linewidth}
		\centerline{SG Detection}
	\end{minipage}
	%	\end{minipage}
	\caption{ Feature map visualisation results. Brighter colours indicate higher feature correspondence. The red circle represents the location of the missed target. }
	\label{feature visual }
\end{figure*}


\textbf{Effect on Underwater image Enhancement}. In addition, we also perform ablation experiments on the underwater image enhancement performance to progressively validate the effect of each module on performance enhancement. The results are presented in Table.\ref{enhance Ablation}. 


\begin{table*}[tp]
	\renewcommand{\arraystretch}{1.5}
	\centering
	\caption{Ablation experiments results on image enhancement.}	
	\resizebox{\linewidth}{!}{
		\begin{tabular}{|c|ccc|ccc|}
			\hline
			%		\specialrule{0em}{1pt}{1pt} 
			Datasets      & \multicolumn{3}{c|}{URPC}   & \multicolumn{3}{c|}{UTDAC}      \\
			\hline
			Methods/Metrics      & UCIQE$\uparrow$ &UIQM$\uparrow$ &FDUM$\uparrow$   &UCIQE$\uparrow$ &UIQM$\uparrow$  & FDUM$\uparrow$       \\
			\hline
			%		\specialrule{0em}{1pt}{1pt} 
			U-NET  & 0.44  & 0.51& 0.36 &0.45  &0.49&0.39       \\
			U-NET+SPE  & 0.56  & 0.69 &0.51  &0.59&0.70  &0.51     \\
			U-NET+SPC	   &   0.51  &0.64&0.44 & 0.49  &0.62&0.48      \\
			U-NET+SPE+SPC	  & 0.65    & 0.88&0.57 &0.71   &	0.75& 0.56 \\
			\hline
		\end{tabular}
	}
	\label{enhance Ablation}		
\end{table*}


From the results, we can conclude that all the different modules we propose have an improvement effect on the visual results, with the SPE module being the most obvious for visual enhancement. Although our use of the shape prior is mainly to improve object detection, the shape prior also provides a prior for underwater image enhancement, so the focus of our model is on the target region. With the combined use of SPE+SPC, we obtain the highest performance improvement, confirming the superiority of the combination of explicit and implicit constraints together.

\begin{figure*}[tp]
	%	\begin{minipage}{0.04\linewidth}
	%			\vspace{10pt}
	%		\rotatebox{0}{(1)}
	%		\\\\\
	%		\vspace{10pt}
	%		\rotatebox{0}{(2)}
	%		\vspace{10pt}
	%	\end{minipage}
	\begin{minipage}{\linewidth}
		%		\vspace{1pt}
		\centerline{\includegraphics[width=\textwidth]{region-enhancement.pdf}}
		\vspace{3pt}
	\end{minipage}
	\caption{ The comparison result between our method and raw image. The yellow box represents the object region, and (c) and (f) represent the feature response at the object location. It can be seen that our method is more effective in recovering the object region. }
	\label{object region enhancement }
\end{figure*}

\begin{table*}[tp]
	\renewcommand{\arraystretch}{1.5}
	\centering
	\caption{The ablation experiment mAP results of Loss weights $\lambda_{1}$ and$\lambda_{2}$. We used YOLOX as the base detector.}	
	\resizebox{\linewidth}{!}{
		\begin{tabular}{|ccccccc|}
			
			%		\specialrule{0em}{1pt}{1pt} 
			\hline
			$\lambda_{1} \& \lambda_{2} \& \lambda_{3}$     &1 $\&$ 1$\&$1  &0.7$\&$0.3 $\&$0.3 &0.5$\&$0.5$\&$0.5  &0.2$\&$0.8$\&$0.2 &0.4$\&$0.6$\&$0.4 & 0.1$\&$0.9$\&$0.1      \\
			\hline
			%		\specialrule{0em}{1pt}{1pt} 
			URPC  & 0.454  & 0.468& 0.466 &\textbf{0.471}  &0.443&   0.441    \\
			UTDAC & 0.460  & 0.477& 0.455 &\textbf{0.483}  &0.454&    0.446   \\
			
			\hline
		\end{tabular}
	}
	\label{weights Ablation}	
	
\end{table*}


In addition, we also perform an experimental comparison of the ablation of feature map responses, the results of which are shown in Fig.\ref{feature visual }. The brightest colour represents the highest feature response. From the feature response results, our method has the highest feature response in the object region, which also verifies the ability of our model to locate the target region and extract richer information about the target region.

\textbf{Effect of weights in Loss Function}.
To improve the detection performance of SG detection, we use an effective unified loss function that includes the object detection loss Lde and the underwater image enhancement loss Ls. Accordingly, two loss weights ($\lambda_{1}$, $\lambda_{2}$ and$\lambda_{3}$ ) are used to balance the performance of these loss functions. For  and , detailed experiments are performed on the dataset to ensure their optimal values, as shown in Table.\ref{weights Ablation}. As observed, the image restoration loss is very helpful in improving the detection ability of the proposed method. Therefore, when  $\lambda_{1}$= 0.2 and $\lambda_{2}$ = 0.8 are set in our experiments, the performance of SG detection is the best.


\subsection{Discussion}
We have conducted detailed experiments to compare the performance of our method with existing SOTA methods in both object detection and underwater image enhancement. From the comparison results, our method achieves the best performance in object detection and is also very effective in visual enhancement of underwater images.

In addition, from the table and the visual comparison results, both MSCR and GUDCP reduce the performance of object detection to a certain extent, which also proves that there is not necessarily a positive correlation between image enhancement and object detection. This suggests that rather than enhancing the feature information required for object detection, these enhancement methods introduce noise.

Therefore, this positively illustrates the need to combine the two efforts of underwater object detection and image enhancement: with underwater image enhancement, we obtain the "clean" features needed for object detection; on the other hand, the object detection results also guide the direction of the underwater image enhancement, rather than just improving the visual experience. The experimental metrics as well as the visual experience results show that our approach significantly improves the object detection performance while enhancing the visual experience.



\section{Conclusion}
IIn this paper, from the current research status and challenges of existing underwater image object detection, we point out that the existing underwater object detection mostly relies on pre-processing to improve the image quality and then achieve the purpose of improving the object detection accuracy. However, this consumes more computational resources and the pre-processing methods are not universally applicable. Therefore, we innovatively combine two tasks, object detection and underwater image enhancement, and propose the SG detection network, which shares clean features through the underwater image enhancement process, thus facilitating object detection. Meanwhile, the object shape prior is embedded in our network as a learnable module, and the global and local shape feature modelling capabilities are enhanced by the shape prior enhancement module, which interacts with the original features. To further enhance the network's ability to use the shape prior, we constrain it both explicitly and implicitly in a way that allows object recognition accuracy to be further improved. We conduct experiments on both URPC and UTDAC datasets, and our method achieves large performance gains in combination with different detectors, demonstrating the effectiveness and generality of our model and showing a competitive speed advantage over existing methods.

However, detecting objects in underwater images remains a challenging problem. While our method improves the shortcomings of existing methods to some extent, the overall accuracy still lags far behind natural images. Furthermore, the current underwater object datasets are relatively sparse and the detection categories are discrete. As a result, the establishment of a general underwater object detection model is still pending.


%\section{Acknowledgments}


%\section{Results}\label{sec2}
%
%Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text.
%
%\section{This is an example for first level head---section head}\label{sec3}
%
%\subsection{This is an example for second level head---subsection head}\label{subsec2}
%
%\subsubsection{This is an example for third level head---subsubsection head}\label{subsubsec2}
%
%Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. 
%
%\section{Equations}\label{sec4}
%
%Equations in \LaTeX\ can either be inline or on-a-line by itself (``display equations''). For
%inline equations use the \verb+$...$+ commands. E.g.: The equation
%$H\psi = E \psi$ is written via the command \verb+$H \psi = E \psi$+.
%
%For display equations (with auto generated equation numbers)
%one can use the equation or align environments:
%\begin{equation}
%\|\tilde{X}(k)\|^2 \leq\frac{\sum\limits_{i=1}^{p}\left\|\tilde{Y}_i(k)\right\|^2+\sum\limits_{j=1}^{q}\left\|\tilde{Z}_j(k)\right\|^2 }{p+q}.\label{eq1}
%\end{equation}
%where,
%\begin{align}
%D_\mu &=  \partial_\mu - ig \frac{\lambda^a}{2} A^a_\mu \nonumber \\
%F^a_{\mu\nu} &= \partial_\mu A^a_\nu - \partial_\nu A^a_\mu + g f^{abc} A^b_\mu A^a_\nu \label{eq2}
%\end{align}
%Notice the use of \verb+\nonumber+ in the align environment at the end
%of each line, except the last, so as not to produce equation numbers on
%lines where no equation numbers are required. The \verb+\label{}+ command
%should only be used at the last line of an align environment where
%\verb+\nonumber+ is not used.
%\begin{equation}
%Y_\infty = \left( \frac{m}{\textrm{GeV}} \right)^{-3}
%    \left[ 1 + \frac{3 \ln(m/\textrm{GeV})}{15}
%    + \frac{\ln(c_2/5)}{15} \right]
%\end{equation}
%The class file also supports the use of \verb+\mathbb{}+, \verb+\mathscr{}+ and
%\verb+\mathcal{}+ commands. As such \verb+\mathbb{R}+, \verb+\mathscr{R}+
%and \verb+\mathcal{R}+ produces $\mathbb{R}$, $\mathscr{R}$ and $\mathcal{R}$
%respectively (refer Subsubsection~\ref{subsubsec2}).
%
%\section{Tables}\label{sec5}
%
%Tables can be inserted via the normal table and tabular environment. To put
%footnotes inside tables you should use \verb+\footnotetext[]{...}+ tag.
%The footnote appears just below the table itself (refer Tables~\ref{tab1} and \ref{tab2}). 
%For the corresponding footnotemark use \verb+\footnotemark[...]+
%
%\begin{table}[h]
%\caption{Caption text}\label{tab1}%
%\begin{tabular}{@{}llll@{}}
%\toprule
%Column 1 & Column 2  & Column 3 & Column 4\\
%\midrule
%row 1    & data 1   & data 2  & data 3  \\
%row 2    & data 4   & data 5\footnotemark[1]  & data 6  \\
%row 3    & data 7   & data 8  & data 9\footnotemark[2]  \\
%\botrule
%\end{tabular}
%\footnotetext{Source: This is an example of table footnote. This is an example of table footnote.}
%\footnotetext[1]{Example for a first table footnote. This is an example of table footnote.}
%\footnotetext[2]{Example for a second table footnote. This is an example of table footnote.}
%\end{table}
%
%\noindent
%The input format for the above table is as follows:
%
%%%=============================================%%
%%% For presentation purpose, we have included  %%
%%% \bigskip command. please ignore this.       %%
%%%=============================================%%
%\bigskip
%\begin{verbatim}
%\begin{table}[<placement-specifier>]
%\caption{<table-caption>}\label{<table-label>}%
%\begin{tabular}{@{}llll@{}}
%\toprule
%Column 1 & Column 2 & Column 3 & Column 4\\
%\midrule
%row 1 & data 1 & data 2	 & data 3 \\
%row 2 & data 4 & data 5\footnotemark[1] & data 6 \\
%row 3 & data 7 & data 8	 & data 9\footnotemark[2]\\
%\botrule
%\end{tabular}
%\footnotetext{Source: This is an example of table footnote. 
%This is an example of table footnote.}
%\footnotetext[1]{Example for a first table footnote.
%This is an example of table footnote.}
%\footnotetext[2]{Example for a second table footnote. 
%This is an example of table footnote.}
%\end{table}
%\end{verbatim}
%\bigskip
%%%=============================================%%
%%% For presentation purpose, we have included  %%
%%% \bigskip command. please ignore this.       %%
%%%=============================================%%
%
%\begin{table}[h]
%\caption{Example of a lengthy table which is set to full textwidth}\label{tab2}
%\begin{tabular*}{\textwidth}{@{\extracolsep\fill}lcccccc}
%\toprule%
%& \multicolumn{3}{@{}c@{}}{Element 1\footnotemark[1]} & \multicolumn{3}{@{}c@{}}{Element 2\footnotemark[2]} \\\cmidrule{2-4}\cmidrule{5-7}%
%Project & Energy & $\sigma_{calc}$ & $\sigma_{expt}$ & Energy & $\sigma_{calc}$ & $\sigma_{expt}$ \\
%\midrule
%Element 3  & 990 A & 1168 & $1547\pm12$ & 780 A & 1166 & $1239\pm100$\\
%Element 4  & 500 A & 961  & $922\pm10$  & 900 A & 1268 & $1092\pm40$\\
%\botrule
%\end{tabular*}
%\footnotetext{Note: This is an example of table footnote. This is an example of table footnote this is an example of table footnote this is an example of~table footnote this is an example of table footnote.}
%\footnotetext[1]{Example for a first table footnote.}
%\footnotetext[2]{Example for a second table footnote.}
%\end{table}
%
%\vfill\eject
%
%In case of double column layout, tables which do not fit in single column width should be set to full text width. For this, you need to use \verb+\begin{table*}+ \verb+...+ \verb+\end{table*}+ instead of \verb+\begin{table}+ \verb+...+ \verb+\end{table}+ environment. Lengthy tables which do not fit in textwidth should be set as rotated table. For this, you need to use \verb+\begin{sidewaystable}+ \verb+...+ \verb+\end{sidewaystable}+ instead of \verb+\begin{table*}+ \verb+...+ \verb+\end{table*}+ environment. This environment puts tables rotated to single column width. For tables rotated to double column width, use \verb+\begin{sidewaystable*}+ \verb+...+ \verb+\end{sidewaystable*}+.
%
%\begin{sidewaystable}
%\caption{Tables which are too long to fit, should be written using the ``sidewaystable'' environment as shown here}\label{tab3}
%\begin{tabular*}{\textheight}{@{\extracolsep\fill}lcccccc}
%\toprule%
%& \multicolumn{3}{@{}c@{}}{Element 1\footnotemark[1]}& \multicolumn{3}{@{}c@{}}{Element\footnotemark[2]} \\\cmidrule{2-4}\cmidrule{5-7}%
%Projectile & Energy	& $\sigma_{calc}$ & $\sigma_{expt}$ & Energy & $\sigma_{calc}$ & $\sigma_{expt}$ \\
%\midrule
%Element 3 & 990 A & 1168 & $1547\pm12$ & 780 A & 1166 & $1239\pm100$ \\
%Element 4 & 500 A & 961  & $922\pm10$  & 900 A & 1268 & $1092\pm40$ \\
%Element 5 & 990 A & 1168 & $1547\pm12$ & 780 A & 1166 & $1239\pm100$ \\
%Element 6 & 500 A & 961  & $922\pm10$  & 900 A & 1268 & $1092\pm40$ \\
%\botrule
%\end{tabular*}
%\footnotetext{Note: This is an example of table footnote this is an example of table footnote this is an example of table footnote this is an example of~table footnote this is an example of table footnote.}
%\footnotetext[1]{This is an example of table footnote.}
%\end{sidewaystable}
%
%\section{Figures}\label{sec6}
%
%As per the \LaTeX\ standards you need to use eps images for \LaTeX\ compilation and \verb+pdf/jpg/png+ images for \verb+PDFLaTeX+ compilation. This is one of the major difference between \LaTeX\ and \verb+PDFLaTeX+. Each image should be from a single input .eps/vector image file. Avoid using subfigures. The command for inserting images for \LaTeX\ and \verb+PDFLaTeX+ can be generalized. The package used to insert images in \verb+LaTeX/PDFLaTeX+ is the graphicx package. Figures can be inserted via the normal figure environment as shown in the below example:
%
%%%=============================================%%
%%% For presentation purpose, we have included  %%
%%% \bigskip command. please ignore this.       %%
%%%=============================================%%
%\bigskip
%\begin{verbatim}
%\begin{figure}[<placement-specifier>]
%\centering
%\includegraphics{<eps-file>}
%\caption{<figure-caption>}\label{<figure-label>}
%\end{figure}
%\end{verbatim}
%\bigskip
%%%=============================================%%
%%% For presentation purpose, we have included  %%
%%% \bigskip command. please ignore this.       %%
%%%=============================================%%
%
%\begin{figure}[h]%
%\centering
%\includegraphics[width=0.9\textwidth]{fig.eps}
%\caption{This is a widefig. This is an example of long caption this is an example of long caption  this is an example of long caption this is an example of long caption}\label{fig1}
%\end{figure}
%
%In case of double column layout, the above format puts figure captions/images to single column width. To get spanned images, we need to provide \verb+\begin{figure*}+ \verb+...+ \verb+\end{figure*}+.
%
%For sample purpose, we have included the width of images in the optional argument of \verb+\includegraphics+ tag. Please ignore this. 
%
%\section{Algorithms, Program codes and Listings}\label{sec7}
%
%Packages \verb+algorithm+, \verb+algorithmicx+ and \verb+algpseudocode+ are used for setting algorithms in \LaTeX\ using the format:
%
%%%=============================================%%
%%% For presentation purpose, we have included  %%
%%% \bigskip command. please ignore this.       %%
%%%=============================================%%
%\bigskip
%\begin{verbatim}
%\begin{algorithm}
%\caption{<alg-caption>}\label{<alg-label>}
%\begin{algorithmic}[1]
%. . .
%\end{algorithmic}
%\end{algorithm}
%\end{verbatim}
%\bigskip
%%%=============================================%%
%%% For presentation purpose, we have included  %%
%%% \bigskip command. please ignore this.       %%
%%%=============================================%%
%
%You may refer above listed package documentations for more details before setting \verb+algorithm+ environment. For program codes, the ``verbatim'' package is required and the command to be used is \verb+\begin{verbatim}+ \verb+...+ \verb+\end{verbatim}+. 
%
%Similarly, for \verb+listings+, use the \verb+listings+ package. \verb+\begin{lstlisting}+ \verb+...+ \verb+\end{lstlisting}+ is used to set environments similar to \verb+verbatim+ environment. Refer to the \verb+lstlisting+ package documentation for more details.
%
%A fast exponentiation procedure:
%
%\lstset{texcl=true,basicstyle=\small\sf,commentstyle=\small\rm,mathescape=true,escapeinside={(*}{*)}}
%\begin{lstlisting}
%begin
%  for $i:=1$ to $10$ step $1$ do
%      expt($2,i$);  
%      newline() od                (*\textrm{Comments will be set flush to the right margin}*)
%where
%proc expt($x,n$) $\equiv$
%  $z:=1$;
%  do if $n=0$ then exit fi;
%     do if odd($n$) then exit fi;                 
%        comment: (*\textrm{This is a comment statement;}*)
%        $n:=n/2$; $x:=x*x$ od;
%     { $n>0$ };
%     $n:=n-1$; $z:=z*x$ od;
%  print($z$). 
%end
%\end{lstlisting}
%
%\begin{algorithm}
%\caption{Calculate $y = x^n$}\label{algo1}
%\begin{algorithmic}[1]
%\Require $n \geq 0 \vee x \neq 0$
%\Ensure $y = x^n$ 
%\State $y \Leftarrow 1$
%\If{$n < 0$}\label{algln2}
%        \State $X \Leftarrow 1 / x$
%        \State $N \Leftarrow -n$
%\Else
%        \State $X \Leftarrow x$
%        \State $N \Leftarrow n$
%\EndIf
%\While{$N \neq 0$}
%        \If{$N$ is even}
%            \State $X \Leftarrow X \times X$
%            \State $N \Leftarrow N / 2$
%        \Else[$N$ is odd]
%            \State $y \Leftarrow y \times X$
%            \State $N \Leftarrow N - 1$
%        \EndIf
%\EndWhile
%\end{algorithmic}
%\end{algorithm}
%
%%%=============================================%%
%%% For presentation purpose, we have included  %%
%%% \bigskip command. please ignore this.       %%
%%%=============================================%%
%\bigskip
%\begin{minipage}{\hsize}%
%\lstset{frame=single,framexleftmargin=-1pt,framexrightmargin=-17pt,framesep=12pt,linewidth=0.98\textwidth,language=pascal}% Set your language (you can change the language for each code-block optionally)
%%%% Start your code-block
%\begin{lstlisting}
%for i:=maxint to 0 do
%begin
%{ do nothing }
%end;
%Write('Case insensitive ');
%Write('Pascal keywords.');
%\end{lstlisting}
%\end{minipage}
%
%\section{Cross referencing}\label{sec8}
%
%Environments such as figure, table, equation and align can have a label
%declared via the \verb+\label{#label}+ command. For figures and table
%environments use the \verb+\label{}+ command inside or just
%below the \verb+\caption{}+ command. You can then use the
%\verb+\ref{#label}+ command to cross-reference them. As an example, consider
%the label declared for Figure~\ref{fig1} which is
%\verb+\label{fig1}+. To cross-reference it, use the command 
%\verb+Figure \ref{fig1}+, for which it comes up as
%``Figure~\ref{fig1}''. 
%
%To reference line numbers in an algorithm, consider the label declared for the line number 2 of Algorithm~\ref{algo1} is \verb+\label{algln2}+. To cross-reference it, use the command \verb+\ref{algln2}+ for which it comes up as line~\ref{algln2} of Algorithm~\ref{algo1}.
%
%\subsection{Details on reference citations}\label{subsec7}
%
%Standard \LaTeX\ permits only numerical citations. To support both numerical and author-year citations this template uses \verb+natbib+ \LaTeX\ package. For style guidance please refer to the template user manual.
%
%Here is an example for \verb+\cite{...}+: \cite{bib1}. Another example for \verb+\citep{...}+: \citep{bib2}. For author-year citation mode, \verb+\cite{...}+ prints Jones et al. (1990) and \verb+\citep{...}+ prints (Jones et al., 1990).
%
%All cited bib entries are printed at the end of this article: \cite{bib3}, \cite{bib4}, \cite{bib5}, \cite{bib6}, \cite{bib7}, \cite{bib8}, \cite{bib9}, \cite{bib10}, \cite{bib11}, \cite{bib12} and \cite{bib13}.
%
%\section{Examples for theorem like environments}\label{sec10}
%
%For theorem like environments, we require \verb+amsthm+ package. There are three types of predefined theorem styles exists---\verb+thmstyleone+, \verb+thmstyletwo+ and \verb+thmstylethree+ 
%
%%%=============================================%%
%%% For presentation purpose, we have included  %%
%%% \bigskip command. please ignore this.       %%
%%%=============================================%%
%\bigskip
%\begin{tabular}{|l|p{19pc}|}
%\hline
%\verb+thmstyleone+ & Numbered, theorem head in bold font and theorem text in italic style \\\hline
%\verb+thmstyletwo+ & Numbered, theorem head in roman font and theorem text in italic style \\\hline
%\verb+thmstylethree+ & Numbered, theorem head in bold font and theorem text in roman style \\\hline
%\end{tabular}
%\bigskip
%%%=============================================%%
%%% For presentation purpose, we have included  %%
%%% \bigskip command. please ignore this.       %%
%%%=============================================%%
%
%For mathematics journals, theorem styles can be included as shown in the following examples:
%
%\begin{theorem}[Theorem subhead]\label{thm1}
%Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. 
%Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. 
%Example theorem text. 
%\end{theorem}
%
%Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text.
%
%\begin{proposition}
%Example proposition text. Example proposition text. Example proposition text. Example proposition text. Example proposition text. 
%Example proposition text. Example proposition text. Example proposition text. Example proposition text. Example proposition text. 
%\end{proposition}
%
%Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text.
%
%\begin{example}
%Phasellus adipiscing semper elit. Proin fermentum massa
%ac quam. Sed diam turpis, molestie vitae, placerat a, molestie nec, leo. Maecenas lacinia. Nam ipsum ligula, eleifend
%at, accumsan nec, suscipit a, ipsum. Morbi blandit ligula feugiat magna. Nunc eleifend consequat lorem. 
%\end{example}
%
%Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text.
%
%\begin{remark}
%Phasellus adipiscing semper elit. Proin fermentum massa
%ac quam. Sed diam turpis, molestie vitae, placerat a, molestie nec, leo. Maecenas lacinia. Nam ipsum ligula, eleifend
%at, accumsan nec, suscipit a, ipsum. Morbi blandit ligula feugiat magna. Nunc eleifend consequat lorem. 
%\end{remark}
%
%Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text.
%
%\begin{definition}[Definition sub head]
%Example definition text. Example definition text. Example definition text. Example definition text. Example definition text. Example definition text. Example definition text. Example definition text. 
%\end{definition}
%
%Additionally a predefined ``proof'' environment is available: \verb+\begin{proof}+ \verb+...+ \verb+\end{proof}+. This prints a ``Proof'' head in italic font style and the ``body text'' in roman font style with an open square at the end of each proof environment. 
%
%\begin{proof}
%Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. 
%\end{proof}
%
%Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text.
%
%\begin{proof}[Proof of Theorem~{\upshape\ref{thm1}}]
%Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. 
%\end{proof}
%
%\noindent
%For a quote environment, use \verb+\begin{quote}...\end{quote}+
%\begin{quote}
%Quoted text example. Aliquam porttitor quam a lacus. Praesent vel arcu ut tortor cursus volutpat. In vitae pede quis diam bibendum placerat. Fusce elementum
%convallis neque. Sed dolor orci, scelerisque ac, dapibus nec, ultricies ut, mi. Duis nec dui quis leo sagittis commodo.
%\end{quote}
%
%Sample body text. Sample body text. Sample body text. Sample body text. Sample body text (refer Figure~\ref{fig1}). Sample body text. Sample body text. Sample body text (refer Table~\ref{tab3}). 
%
%\section{Methods}\label{sec11}
%
%Topical subheadings are allowed. Authors must ensure that their Methods section includes adequate experimental and characterization data necessary for others in the field to reproduce their work. Authors are encouraged to include RIIDs where appropriate. 
%

%
%\begin{enumerate}[1.]
%\item Approval: a statement which confirms that all experimental protocols were approved by a named institutional and/or licensing committee. Please identify the approving body in the methods section
%
%\item Accordance: a statement explicitly saying that the methods were carried out in accordance with the relevant guidelines and regulations
%
%\item Informed consent (for experiments involving humans or human tissue samples): include a statement confirming that informed consent was obtained from all participants and/or their legal guardian/s
%\end{enumerate}
%
%If your manuscript includes potentially identifying patient/participant information, or if it describes human transplantation research, or if it reports results of a clinical trial then  additional information will be required. Please visit (\url{https://www.nature.com/nature-research/editorial-policies}) for Nature Portfolio journals, (\url{https://www.springer.com/gp/authors-editors/journal-author/journal-author-helpdesk/publishing-ethics/14214}) for Springer Nature journals, or (\url{https://www.biomedcentral.com/getpublished/editorial-policies\#ethics+and+consent}) for BMC.
%
%\section{Discussion}\label{sec12}
%
%Discussions should be brief and focused. In some disciplines use of Discussion or `Conclusion' is interchangeable. It is not mandatory to use both. Some journals prefer a section `Results and Discussion' followed by a section `Conclusion'. Please refer to Journal-level guidance for any specific requirements. 
%
%\section{Conclusion}\label{sec13}
%
%Conclusions may be used to restate your hypothesis or research question, restate your major findings, explain the relevance and the added value of your work, highlight any limitations of your study, describe future directions for research and recommendations. 
%
%In some disciplines use of Discussion or 'Conclusion' is interchangeable. It is not mandatory to use both. Please refer to Journal-level guidance for any specific requirements. 
%
%\backmatter
%
%\bmhead{Supplementary information}
%
%If your article has accompanying supplementary file/s please state so here. 
%
%Authors reporting data from electrophoretic gels and blots should supply the full unprocessed scans for key as part of their Supplementary information. This may be requested by the editorial team/s if it is missing.
%
%Please refer to Journal-level guidance for any specific requirements.
%
%\bmhead{Acknowledgments}
%
%Acknowledgments are not compulsory. Where included they should be brief. Grant or contribution numbers may be acknowledged.
%
%Please refer to Journal-level guidance for any specific requirements.
%
\section*{Declarations}
%
%Some journals require declarations to be submitted in a standardised format. Please check the Instructions for Authors of the journal to which you are submitting to see if you need to complete this section. If yes, your manuscript must contain the following sections under the heading `Declarations':
%
\begin{itemize}
\item Funding. The project supported by the National Natural Science Foundation of China(No: 61871124 and 61876037), The national defense Pre-Research foundation of China, by the fund of Science and Technology on Sonar Laboratory (No: 6142109KF201806), by the Stable Supporting Fund of Acoustic Science and Technology Laboratory (No:JCKYS2019604SSJSSO12).

\item Conflict of interest. The authors have no conflicts of interest to declare
relevant to this article's content
\item Ethics approval.  This article does not contain any studies with animals performed by any of the authors.
%\item Consent to participate
%\item Consent for publication
\item Availability of data and materials. The datasets generated during and/or analysed during the current study are not publicly available due to the fact that we do not have permission to make them public, but are available from the corresponding author on reasonable request.
%\item Code availability 
%\item Authors' contributions
\end{itemize}
%
%\noindent
%If any of the sections are not relevant to your manuscript, please include the heading and write `Not applicable' for that section. 
%
%%%===================================================%%
%%% For presentation purpose, we have included        %%
%%% \bigskip command. please ignore this.             %%
%%%===================================================%%
%\bigskip
%\begin{flushleft}%
%Editorial Policies for:
%
%\bigskip\noindent
%Springer journals and proceedings: \url{https://www.springer.com/gp/editorial-policies}
%
%\bigskip\noindent
%Nature Portfolio journals: \url{https://www.nature.com/nature-research/editorial-policies}
%
%\bigskip\noindent
%\textit{Scientific Reports}: \url{https://www.nature.com/srep/journal-policies/editorial-policies}
%
%\bigskip\noindent
%BMC journals: \url{https://www.biomedcentral.com/getpublished/editorial-policies}
%\end{flushleft}
%
%\begin{appendices}
%
%\section{Section title of first appendix}\label{secA1}
%
%An appendix contains supplementary information that is not an essential part of the text itself but which may be helpful in providing a more comprehensive understanding of the research problem or it is information that is too cumbersome to be included in the body of the paper.
%
%%%=============================================%%
%%% For submissions to Nature Portfolio Journals %%
%%% please use the heading ``Extended Data''.   %%
%%%=============================================%%
%
%%%=============================================================%%
%%% Sample for another appendix section			       %%
%%%=============================================================%%
%
%%% \section{Example of another appendix section}\label{secA2}%
%%% Appendices may be used for helpful, supporting or essential material that would otherwise 
%%% clutter, break up or be distracting to the text. Appendices can consist of sections, figures, 
%%% tables and equations etc.
%
%\end{appendices}

%%===========================================================================================%%
%% If you are submitting to one of the Nature Portfolio journals, using the eJP submission   %%
%% system, please include the references within the manuscript file itself. You may do this  %%
%% by copying the reference list from your .bbl file, paste it into the main manuscript .tex %%
%% file, and delete the associated \verb+\bibliography+ commands.                            %%
%%===========================================================================================%%

\bibliographystyle{sn-basic.bst}
\bibliography{reference.bib}% common bib file
%% if required, the content of .bbl file can be included here once bbl is generated
%%\input sn-article.bbl


\end{document}
