Two-Stage Adaptive Network for Semi-Supervised Cross-Domain Crater Detection under Varying Scenario Distributions

Crater detection can provide valuable information for humans to explore the topography and understand the history of extraterrestrial planets. Due to the significantly varying scenario distributions, existing detection models trained on known labelled crater datasets are hardly effective when applied to new unlabelled planets. To address this issue, we propose a two-stage adaptive network (TAN) for semi-supervised cross-domain crater detection. Our network is built on the YOLOv5 detector, where a series of strategies are employed to enhance its cross-domain generalisation ability. In the first stage, we propose an attention-based scale-adaptive fusion (ASAF) strategy to handle objects with significant scale variances. Furthermore, we propose a smoothing hard example mining (SHEM) loss function to address the issue of overfitting on hard examples. In the second stage, we propose a sort-based pseudo-labelling fine-tuning (SPF) strategy for semi-supervised learning to mitigate the distributional differences between source and target domains. For both stages, we employ weak or strong image augmentation to suit different cross-domain tasks. Experimental results on benchmark datasets demonstrate that the proposed network can enhance domain adaptation ability for crater detection under varying scenario distributions.


Introduction
Delving into the topography and history of extraterrestrial planets (e.g., Mars and the Moon) through the analysis of impact craters is important for humans to explore outer space and broaden their cognition scope.Recent studies on crater detection have been conducted in the field of computer vision.However, the exploration of craters on these planets encounters various challenges [1][2][3].For example, craters on different planets can exhibit significant differences in scale characteristics, density distributions, and background interference.Figure 1 shows two sample images from the LROC (Lunar Reconnaissance Orbiter Camera) dataset [4] and the DACD (Domain Adaptive Crater Detection) dataset [5], along with the distributions of craters in terms of scale variations on these two datasets.Overall, the LROC dataset contains smaller and more craters than the DACD dataset.Some images in the DACD dataset show severe background weathering, which significantly interferes with crater detection.Hence, detection models trained on known crater datasets are difficult to directly apply to new planets due to the domain gap.The development of a robust model with good generalisation abilities under significantly varying scenario distributions remains a great challenge.Training a crater detection model that can adapt to the terrain of unknown exoplanets is challenging.Recent works [5][6][7][8][9] have attempted to address this issue.For example, the studies in [5,7,9] employ attention mechanisms or use dilated convolution to learn better feature representations.The work in [8] trains the model using generated data.However, due to the lack of sufficient real extraterrestrial data, existing generative models are not always effective.The studies in [5,9] develop progressive sampling strategies based on the subspace along the geodesic on the Grassmann manifold or Hough transforms to enhance the performance of crater detection.These methods assume that the cross-domain data distributions between source and target domains are similar, but in reality they vary significantly from one planet to another.To better learn the distribution of unknown target domains, some studies employ semi-supervised pseudo-labelling [10,11], consistent strategy training [12], and weakly supervised attention mechanisms [13].In addition, some studies [14,15] attempt to mine hard samples by using a penalty function to enhance the model's robustness.However, due to the significant domain gap, they do not generalise well to unknown distributions.
To improve the generalisation performance, in this paper, we propose a two-stage adaptive network (TAN) for semi-supervised cross-domain crater detection under varying scenario distributions.Our network is built on the YOLOv5 detector where a series of strategies are employed to enhance the cross-domain generalisation ability.In the first stage, we propose an attention-based scale-adaptive fusion (ASAF) strategy to handle objects with significant scale variances.We propose a smoothing hard example mining (SHEM) loss function to solve the issue of model overfitting on challenging examples.In the second stage, we propose a sort-based pseudo-labelling fine-tuning (SPF) strategy for semi-supervised learning to mitigate the distributional differences between the source and target domains.For both stages, we employ weak or strong image augmentation to suit different cross-domain tasks.Experimental results demonstrate the network's strong domain adaptation ability for crater detection under varying scenario distributions.
The main contributions of this paper are summarised as follows: (1) We present an attention-based scale-adaptive fusion (ASAF) strategy.This strategy improves the model's scale adaptability, which is helpful for detecting craters with significant scale variations.(2) We introduce a smoothing hard example mining (SHEM) loss function to address the issue that the model trained on the source domain is biased towards hard examples in the source domain, leading to poor generalisation to the target domain.(3) We design a sort-based pseudo-labelling fine-tuning (SPF) strategy.In SPF, we use the trained model from the source domain to generate high-quality pseudo-labels for the target domain.Subsequently, we fine-tune the model to make it adapt well to the target domain.(4) We adopt weak or strong image augmentation to suit different cross-domain tasks by taking into account the distribution characteristics of extraterrestrial planets.

Related Work
Over the past several years, object detection based on deep learning [16][17][18][19] has made great progress.Crater detection is also gradually gaining attention [5][6][7][8][9].However, there are still several issues that have not yet been fully resolved, including the extreme imbalance of crater sizes, domain adaptation, and the absence of sufficiently labelled datasets.

Object Detection
For object detection, mainstream methods are based on feature pyramids and feature fusion.After the feature pyramid network (FPN) [17] was developed, there have been many variants [20].For example, the work in [21] directly assigns shallow and deep features to different scales.After that, many methods such as top-down integration [17] and two-way integration [22] were developed.The classical approach [16] continuously reduces the feature map from top to bottom while fusing shallow features.Some subsequent studies have investigated bidirectional fusion features [20], or even more complex circular recursive fusion features [23].However, most of the methods mentioned extract deep convolutional features through continuous subsampling, which is not ideal for detecting small objects.
A global receptive field can serve as an effective equaliser between large and small targets.The study in [24] examines the various receptive fields of images, while [25] employs hollow convolution to broaden the perceptual field, where attention is used to gather more contextual information.Some studies replace all the core convolutions of the backbone or neck network with attention modules [26,27].Although these methods are good solutions to specific problems, shallow knowledge is still forgotten as the network layer deepens, and the information of small targets cannot be effectively propagated to deeper layers in the network.
Considering multiple-scale objects, image augmentation methods such as stitching and blurring [28] are used to balance the performance of large and small target detection.Because most of the hard-to-detect targets are small, researchers have conducted some data augmentation studies on small targets [28,29].However, these augmentation methods are not suitable for cross-domain object detection, where uneven data distributions may be present in the source and target domains.
In view of the above problems, in this paper we propose the ASAF strategy to fuse shallow information and improve the detection ability of small objects.Furthermore, we employ different levels of data enhancement strategies (e.g., weak or strong image augmentation) to suit distinct cross-domain tasks by taking into account the distribution characteristics of extraterrestrial planets.

Domain-Adaptive Object Detection
Domain-adaptive object detection has achieved significant results [3,5,30,31].In the field of crater detection, the target domain involves unknown extraterrestrial terrains and interference scenarios.Hence, researchers have made attempts in the directions of sample adaptation and model adaptation, most of which are based on the methods of adversarial learning or mutual supervised learning.Some sample adaptation methods apply alignment strategies to address the differences between the source and target domains.For example, Ref. [32] attempts to align spatial distributions through intrinsic knowledge mining and relational knowledge constraints.Ref. [33] uses adversarial training and pseudo-labelling to adapt to the target domain.In this way, the model gradually learns the target domain, and the data in the target domain guide the classifiers to achieve a cross-domain effect.However, these methods require a thorough understanding of the similarities and differences between the target and source domains.If the target domain and its spatial distribution are unknown, these methods may not be effective.
Some model adaptation methods are based on the idea of cross-domain-adaptive modules.The design of adaptive modules allows unsupervised adaptation of the model to the target domain.Some studies have developed modules to help assess the consistency between domains [34] for improved alignment.There are also modules based on knowledge-mining strategies [35], by which the images are re-modelled and the network is guided to distinguish the similarities and differences between the domains.
Inspired by the above works, in this paper, we propose the SPF strategy to make the model trained on the source domain learn the distribution of the target domain after fine-tuning and obtain high-quality pseudo-labels.

Object Detection with a Scarcity of Labelled Data
Currently, there is no high-quality benchmark dataset for crater detection, and the quality of datasets is often uneven.To the best of our knowledge, only a few crater datasets [6,8,36] have been made available and there is currently no extensive benchmark dataset similar to COCO or PASCAL VOC.Because deep learning is data-hungry, generative learning [8,37,38] has gained attention for acquiring training data.There are also some works that use text to generate images [39].Due to the scarcity of labelled data, it is currently challenging to synthesise real crater data.
Recent studies [10,12,33] have employed semi-supervised algorithms to address the limited labelled data through consistency-based learning or pseudo-labelling.Consistencybased learning algorithms use two networks to learn the consistency of output results for the same unlabelled images under various perturbations.As a result, information from unlabelled data is fully utilised.Pseudo-labelling algorithms [10,33] use models pre-trained on labelled data to generate pseudo-labels for unlabelled data during model training.
In case of limited labelled data, some studies [15,40] tackle this issue by increasing the penalty for erroneous samples, or by employing hard example mining strategies [41].However, these studies do not address the cross-domain problem.When applied to crossdomain crater detection, the model is more biased towards challenging examples in the source domain, which fails to generalise well to the target domain with simple distributions.
Due to the great disparity of craters on different exoplanets, we need to develop some strategies to make the model adaptive to varying scenario distributions.Based on the above works, in this paper, we propose the SHEM loss function.It aims to identify challenging examples in the source domain with complex distributions, while facilitating the model's adaptation to the target domain with simpler distributions.By contrast, if the source domain has relatively simple distributions, we only adopt the common hard example mining loss to make our model adaptive to the target domain with complex distributions.

Proposed Method
Figure 2 shows the proposed framework TAN, which mainly consists of the following four new components: the attention-based scale-adaptive fusion (ASAF) strategy, the smoothing hard example mining (SHEM) loss functions, the sorting-based pseudo-labelling fine-tuning (SPF), and the data augmentation strategy.Specifically, Figure 2 illustrates two types of cross-domain tasks.The upper section of this figure illustrates cross-domain detection using the DACD dataset as the source domain and the LROC dataset as the target domain.This is a detection task from the complex to the simple domain.Hence, we adopt weak augmentation, ASAF, and SHEM to train our model in the source domain, followed by fine-tuning to learn the distribution of the target domain.
The bottom part of this figure illustrates cross-domain detection from simple to complex.That is, we use the LROC dataset as the source domain and the DACD dataset as the target domain.In this case, we rely on strong augmentation and the focal function (without ASAF) to mine challenging examples in the source domain.This approach facilitates subsequent learning in the target domain with complex distributions.
The motivations for the use of different first-stage training processes are as follows.For the cross-domain problem, craters in the source and target domains can have different scenario distributions (complex or simple).If the source domain is complex, we use a weak augmentation method to prevent the model over-learning the complex features.We also use the ASAF strategy to mitigate the extreme scale variations in craters (too big or small).In addition, we use the SHEM to mitigate the model bias towards hard examples and achieve better generalisation ability.On the contrary, if the source domain is simple, we use the strong augmentation to enhance the robustness of our model, and the ASAF and SHEM are accordingly no longer needed.

Attention-Based Scale-Adaptive Fusion (ASAF)
As the convolutional layers deepen, shallow and subtle target features are more likely to be overlooked.In addition, due to limited labelled data and potential interference, models tend to be biased towards the training data.Therefore, integrating the initial feature maps and emphasising informative features can mitigate this bias and enhance the model's robustness.
Motivated by these observations, we introduce an ASAF strategy to integrate shallow information into the deeper layers.Specifically, our model architecture is based on the YOLOv5 [42], which consists of three main components: backbone, neck, and head.The core modules of the backbone and neck are C3, including three Conv blocks and a bottleneck block.Additionally, the backbone incorporates the focus structure, while the neck utilises the FPN [17] with the PAN (Path Aggregation Network) [22] architecture.We pass the shallow feature maps of different stages to the NAM (Normalisation-Based Attention Module) [43], and then, fuse the feature maps P3, P4, and P5 in the backbone and the neck (refer to Figure 3).Here, P denotes the feature maps of various sizes acquired from different layers of the network in the YOLOv5 architecture.Furthermore, to extract global long-range features, we incorporate C3TR (C3 + Transformer block [44]) into the backbone by replacing a series of bottlenecks in the C3 with one Transformer block [44].In addition, we inject multiple C3 modules into the neck after fusing shallow attention-based feature maps.These C3 modules collectively contribute to improved performance for detecting large targets.The details of NAMs [43] as attention mechanism modules are shown in Figure 4.Each NAM contains the CBAM (Convolutional Block Attention Module) [26] with some modified channel and spatial attention sub-modules.To be specific, the channel attention sub-module uses the scale factor in batch normalisation (BN), which measures the variance in the channels and indicates their significance.This can be formulated as follows: where µ B and σ B are the mean and standard deviation of the mini-batch B, respectively; γ and β are trainable affine transformation parameters (i.e., scale and shift).Assume that F1 is the input feature and M c is the output feature; they are given in the following equations: where M c represents the output feature, γ is the scaling factor for each channel, and the weights are obtained as W γ = γ i / ∑ j=0 γ j .Similarly, for the spatial attention sub-module, the formula for the spatial attention mechanism is given below: where λ is the scaling factor of BN (i.e., pixel normalisation in Figure 4), the weights are W λ = λ i / ∑ j=0 λ j , and the output is denoted as M s .

Smoothing Hard Example Mining (SHEM)
The original YOLOv5 utilised the binary cross-entropy (BCE) loss function for classification and objectness.However, we found that the focal loss [45] outperforms BCE for binary crater detection due to its superior ability to balance positive and negative examples.The focal loss function is computed as follows: where y represents the true label, q represents the predicted probability, λ represents the focal parameter, and α is the correction parameter.The above equations can be summarised as the following equation: To address challenging target detection where significant background interference and complex distributions are present, we introduce a loss function to mine hard examples.First, we employ the balance factor ξ to enhance the focal loss function, known as the equilibrium focal loss (BFL) [14], defined as Based on Equation (7), we calculate BFLs for the feature maps at various scales, each with a distinct distribution of loss values.Then, we select the top K% of loss values that have been sorted as the loss values for the feature maps.Subsequently, we average and weigh the loss values at different scales to obtain the Loss Rank Function (LRM).Considering the substantial variations in crater scales, we extended the final head in the YOLOv5 model to four scales.While the LRM [14] loss function enables the model to learn numerous hard examples, its emphasis on hard examples may lead to overfitting on the source domain dataset.Therefore, we introduce the SHEM loss function to calculate the objectness loss.The computation framework of the SHEM loss function is depicted in Figure 5, and can be formulated as follows: where w denotes a weight vector, and λ denotes a regularisation parameter (we set its value to 5 × 10 −9 ).Here, we utilise L2 regularisation to ensure the model gradually learns hard examples and mitigate the risk of overfitting.As shown in Figure 2, we use the three losses, i.e., SHEM, focal, and complete intersection over union (CIoU) losses to train our first-stage model for cross-domain detection (from complex to simple).

Sorting-Based Pseudo-Labelling Fine-Tuning (SPF)
The gap between the source and target domains for crater detection can be significant, especially in the case that the target domain is entirely unknown to the source domain and lacks label information.Therefore, it is impractical to use the conventional learning model to obtain the feature distribution of the target domain.To address this issue, we employ pseudo-labelling to fine-tune the model, as detailed below.
The source domain dataset with labels is denoted as D 1 = {x i , y i } N 1 , where N 1 is the total number of samples, x i denotes the image sample, and y i denotes the corresponding sample labels.The target domain dataset without labels is denoted as D 2 = {x i } N 2 , where N 2 is the total number of samples in the target domain.After obtaining the trained detection model in the source domain (denoted as M 1 ), as introduced previously, we apply M 1 to the unlabelled target domain D 2 to obtain the pseudo-labels ŷi for the image x i , i.e., To fully learn the distribution of the target domain with high-quality pseudo-labels, we sort images in descending order based on the number of detected objects in each sample and choose a subset of them as our fine-tuning training set.The formula is as follows: Here, ỹj is the pseudo-labels for the jth image after sorting and selection, and h is the selected proportion, defined as where α is a control parameter, which is used to balance the number of pseudo-labelled data used for fine-tuning and the source data.The balance is achieved by setting a relatively small α value if the amount of source data is much larger than that of the target data, and a large α value if the amount of source data is much smaller than that of the target data.Subsequently, we fine-tune the pre-trained model M 1 , which is obtained in the first stage, on {ỹ j } as well as the corresponding images for 2-3 rounds by freezing the backbone parameters (the first 10 layers in the model).The calculation process is illustrated in Figure 2.

Data Augmentation Strategy
A challenge arises when the model trained on the source domain fails to adapt to the target domain due to a lack of understanding of the target domain's distributions.Moreover, in the new domain, the model may encounter interference from unknown environments, and is influenced by factors such as different signal-to-interference ratios and background complexity.These domain gaps make the model hard to transfer between different domains, resulting in inaccurate detection results.
To address this issue, we propose a domain-adaptive data augmentation strategy for cross-domain detection that distinguishes between complex and simple data distributions.As shown in Figure 2, models trained on the source domain with less background interference tend to be less robust.To address this issue, we employ strong data augmentation techniques (e.g., affine transformation and random mosaic) to increase the complexity of the training data.Conversely, for the source domain data with complex distributions, we only apply minor data augmentation techniques (e.g., simple flipping and stitching) to ensure that the model learns from smoother data.In this way, the model becomes better adapted to the smoothed domain for cross-domain detection.

Experiments
In this section, we first introduce the datasets used for our experiments, and then, introduce the used evaluation metrics and our implementation details.Next, we compare our method with the state of the art (SOTA) and perform ablation experiments.After visualising the detection results, we provide some discussions on our method.

Datasets
We use the following three datasets for our experiments.DACD Dataset.The DACD [5] (Domain Adaptive Crater Detection) dataset contains two scenes of craters: the day craters and the night craters on Mars.It consists of 1000 images from 90 • S to 90 • N latitude and 180 • W to 180 • E longitude, leading to more than 20,000 craters in total.The size of these craters is about 5 pixels to 300 pixels.The scenario of the dataset contains a lot of noisy interference.
LROC Dataset.To validate the effectiveness of our model for solving the crossdomain problem, we choose a public crater dataset [4], which is obtained by the Lunar Reconnaissance Orbiter Camera (LROC).It consists of 866 images of size 416 × 416 pixels captured on the Moon.The size of most of the craters is between 3 pixels and 200 pixels, and the craters are relatively densely distributed.
DOTA Dataset.In addition, we demonstrate the generalisation ability of our model on the large public remote sensing dataset DOTA [46] (A Large-scale Dataset for Object Detection in Aerial Images).It consists of 2806 aerial images from different sensors and platforms.There are 15 categories of images (about 4000-by-4000 pixels) which exhibit a variety of scales, orientations, and shapes.

Evaluation Metrics
We use recall, precision and mean average precision (mAP) to evaluate our model; these are defined as follows.
The quality of a single detection box is determined by the IoU value, which is the intersection ratio between the predicted and actual detection frames.We use recall and precision to evaluate the performance of the network model by setting the IoU threshold to 0.5 by default, i.e.,

Recall =
TP TP + FN (12) When the IoU of the detection frame is greater than or equal to 0.5, it is classified as a true positive (TP); otherwise, the detected crater is classified as a false positive (FP).FN represents the number of false negatives, and TN is the number of negative samples that are correctly identified.
In addition to the above metrics, we use mAP to calculate the mean value of AP for all classes, where AP is the area under the precision-recall curve.In our experiments, we calculate two kinds of mAPs: (1) mAP@.5 by setting IoU to 0.5; (2) mAP@.5:.95 by varying IoU from 0.5 to 0.95 with an interval of 0.05 and averaging the results.

Implementation Details
In our experiments, we use the YOLOv5 [42] as our baseline.For dataset splitting, we split the source dataset into training and validation sets in a ratio of 8:2.We use Pytorch as our deep learning framework, and we resize the images to 640 × 640 pixels during training.We adopt SGD [47] as our optimiser and use momentum gradient descent as our learning strategy with an initial learning rate of 0.01, 3 rounds of iteration once, and a weight decay of 0.0005.All the experiments are run on a 3.70 GHz and 18-processor Intel Xeon W-2255 CPU, and an Nvidia GeForce RTX 3080Ti GPU with 12 G memory.

Comparison with State-of-the-Art Methods
In this section, some comparisons with other models are conducted on the three datasets.We use MMDetection [48] as a tool.According to their working principle, some backbone networks are introduced for object detection in some models.

Comparisons on DACD Dataset and Cross-Domain from DACD to LROC
Some SOTA detection methods are selected in Table 1 for comparison with our model.Compared with some two-stage models (e.g., Faster R-CNN [16] and Libra R-CNN [49]), our model demonstrates superior precision but slightly inferior recall performance.Compared with single-stage detection models (e.g., YOLOv5 [42] and YOLOv7 [50]), our model achieves better detection performance in both precision and recall.In Table 1, the PVT has only a slightly higher recall, but the precision is much lower than our model.Finally, for cross-domain detection (from the DACD dataset to the LROC dataset), our model slightly improves the baseline YOLOv5 in precision, but achieves a significantly better result in recall (about 24.04%) than the baseline.These results show that our proposed ASAF can achieve good generic detection performance by combining shallow information without cross-domain detection.After migrating to the LROC dataset, our model achieves the best results in terms of both precision and recall, demonstrating the effectiveness of SPF used in the second stage.

Comparisons on LROC Dataset and Cross-Domain from LROC to DACD
As shown in Table 2, the proposed model achieves the best performance in terms of precision.Due to the shallow information propagation using an attention-based scaleadaptive fusion strategy, our model can accurately detect small craters in the samples from the LROC dataset.When the model trained on the LROC dataset is tested on the DACD dataset, our model improves the baseline YOLOv5 [42] by 6.02% in terms of recall.This is because the use of SPF and the data augmentation strategy can adapt to the distribution of the target domain.The recall of our model is worse than that of PVT [57] and ATSS [58].The reasons are as follows.The DACD dataset consists of high-resolution images which contain crater objects with unbalanced distributions, while LROC consists of images containing dense small crater objects.As ATSS is dedicated to addressing the unbalanced sample problems for object detection, it generally achieves good results on the DACD dataset.Due to the use of the convolution-free pyramid attention mechanism, PVT has a natural advantage for the dense small object detection task (see the results of recall on LROC), and still maintains excellent performance on the DACD dataset for the cross-domain problem.In this section, we use a large remote sensing object detection dataset, DOTA [46], to evaluate the model's performance on the generic detection task.The DOTA dataset contains many small targets and has a wide variety of scenarios.We follow the training and testing settings defined in [46] to evaluate the models on the DOTA dataset.We show the results in Table 3, where we have listed the AP value for each object category.The abbreviations of the categories are described as follows: BD-baseball field, GTF-runway, SV-small vehicle, LV-large vehicle, TC-tennis court, BC-basketball court, SC-storage tank, SBF-soccer field, RA-roundabout, SP-swimming pool, HC-helicopter.As can be seen from Table 3, our model shows better mAP performance compared to other methods, with the exception of YOLOv7.However, as shown in Tables 1 and 2, YOLOv7 [50] exhibits poorer performance than our model for cross-domain crater detection.There are also some models [57,58] that perform well when the DACD dataset is used as the source domain, but show poor generalisation and robustness on the DOTA dataset because they struggle to adapt to complex changes.This proves that our model can guarantee no performance degradation in the generic remote image object detection task, in addition to demonstrating good generalisation abilities for cross-domain crater detection.

Ablation Studies
The comparison results presented in Tables 1-3 demonstrate that the proposed TAN is superior to many state-of-the-art methods.In the following section, we comprehensively analyse TAN from three aspects to explore its superiority.For this purpose, we perform ablation experiments by using DACD as the source domain and LROC as the target domain.
(1) Effects of replacing NAM in the model by using different attention mechanism modules with an SHEM or a focal loss function.To this end, we do not use data augmentation strategies and SPF, and define YOLOv5 as the basic scheme, which uses the focal loss for objectness (without any attention mechanisms).Based on YOLOv5, we evaluate the effects of different attention mechanisms and loss functions on the precision and mAP@.5:.95, as illustrated in Figure 6.Here, Trans stands for the Transformer block [44], Bif stands for the Vision Transformer with Bi-Level Routing Attention block [27], SE stands for the SE block in Squeeze-and-Excitation Networks [59], CBAM stands for the Convolutional Block Attention Module [26], ECA stands for the Efficient Channel Attention block [60], and GAM stands for the Global Attention Mechanism block [61].As show in Figure 6, the adopted SHEM outperforms the focal loss with respect to both evaluation indicators.The use of different attention mechanisms can generally improve the performance of the basic YOLOv5.Among them models, our adopted NAM [43] achieves the best performance.The above results show that our proposed method, using NAM coupled with the SHEM loss function, has good generalisation ability for cross-domain crater detection.
(2) Effects of data augmentation and SPF.The two strategies in our model complement each other, and we refer to it as BOT (bag of tricks) for cross-domain crater detection experiments from DACD to LROC.To validate their effectiveness, we do not use ASAF and SHEM in all the compared models.Instead, we compare the results using mAP@.5:.95 as the evaluation indicator.As shown in Figure 7, the use of BOT improves the mAP@.5:.95 for all the compared models.In particular, our model improves the mAP@.5:.95 value by 2.79 when BOT is used, demonstrating its effectiveness for cross-domain crater detection.In order to verify the effectiveness of the two strategies individually, we conduct experiments by only using SPF and the resulting mAP@.5:.95 is 21.98%.By comparing the results obtained using BOT (i.e., 23.10%) and without using BOT (i.e., 20.31%), we can see the efficacy of both data augmentation and SPF.
(3) Effects of different combinations of our proposed components.To this end, we conduct ablation experiments on different combinations of the proposed ASAF, SHEM, and BOT.As can be seen from Table 4, each component helps to improve the recall and mAP@.5:.95.When all the three components are used, our model achieves the best results, demonstrating the effectiveness of these components.

Visualisation
We visualise the detection results of different models on the DACD dataset.As can be seen in Figure 8a, our model demonstrates good detection results.ATSS [58] misses larger-scale craters, PVT [57] overlooks some small craters, and Faster R-CNN [16] detects more craters.For the cross-domain detection from DACD to LROC, our model detects more craters than other models, while ATSS misses many small craters, as shown in Figure 8b.Thus, our model has better generalisation ability, which enables it to adapt more effectively to cross-domain scenarios with different background distributions.

Further Discussion
In future research, we aim to enhance the model's performance based on lower-quality labelled datasets.Our findings emphasise the significant challenge of accurately labelling craters in images.The manual labelling process is inherently complex and prone to errors.As such, our focus will shift towards techniques for weakly supervised target detection with incomplete labels or entirely unsupervised targets.We are committed to addressing the issue of effectively identifying more craters in scenarios involving poor data quality or incomplete labels.
In addition, we conduct experiments using different backbone networks in Table 5.As can be seen, the results obtained by using the backbone networks with a large number of parameters are not necessarily better.For backbone networks with a small number of parameters, such as ConvNeXt [62] and Ghost [63], the detection results are pretty good.Therefore, in future research we will investigate lightweight backbone networks which can still maintain high-quality detection results for practical applications.

Conclusions
In this study, we propose TAN, a two-stage adaptive network for semi-supervised cross-domain crater detection.TAN is based on the YOLOv5 detector, which incorporates a series of strategies to improve the cross-domain generalisation abilities.In the first stage, we propose an attention-based scale-adaptive fusion strategy to address the scale variation issue of crater objects.We also propose a smoothing hard example mining loss function to solve the issue of overfitting on hard examples.In the second stage, we propose a sort-based pseudo-labelling fine-tuning strategy by using the trained model in the first stage to address the distributional differences between the source and target domains.For both the stages mentioned above, we employ weak or strong image augmentation to suit different cross-domain tasks (from complex to simple or vice versa).
To validate the performance of our network, we conduct ablation experiments on the DACD and LROC datasets, as well as cross-domain experiments.We also validate the generality of our model on a large remote sensing dataset called DOTA.All of our ablation experiments demonstrate the strong domain-adaptive ability of our model under varying scenario distributions.
Future Work.We will further improve our model's generalisation ability, especially in case of poor data quality or very limited labelled data.In addition, we will explore lightweight models which can maintain good detection results.

Figure 1 .
Figure 1.(Top) One of the samples in the LROC dataset and the distributions of all craters in this dataset.(Bottom) One of the samples in the DACD dataset and the distributions of all craters in this dataset.Compared with the top sample, the bottom one has more background interference.According to the statistical results of these two datasets, the LROC dataset contains smaller and more craters than DACD.

Figure 2 .
Figure 2. The architecture of our proposed two-stage TAN model for cross-domain crater detection.The first stage: (1) ASAF utilises the attention-based NAM (Normalisation-Based Attention Module) to fuse shallow information to improve scale adaptation abilities; (2) the SHEM loss function is used to alleviate the bias of the model.The second stage: The SPF strategy is adopted to sort and select high-quality pseudo-labels which are used to fine-tune the model.In these two stages, we adopt weak or strong image augmentation to match different cross-domain tasks.The new components are highlighted in blue font or regions.

Figure 3 .
Figure 3. Illustration of our model architecture with the ASAF strategy.To prevent the model from losing crucial information, we incorporate C3TR (C3 + Transformer) into the backbone.We pass the shallow feature maps of different stages to NAM to obtain shallow attention-based feature maps.We also inject multiple C3 modules into the neck to detect large targets.

Figure 5 .
Figure5.The overall flow of the SHEM loss function.We calculate BFLs for the feature maps at four scales, each with a distinct distribution of loss values.Then, we select the top K% of loss values that have been sorted for the feature maps.Subsequently, we average and weigh the loss values at different scales to obtain the Loss Rank Function (LRM), followed by L2 regularisation to obtain the objectness loss.

Figure 8 .
Figure 8. Visualisation of the detection results of different models on the LROC dataset as well as the cross-domain detection results.(a).Visualisation of the detection results of the proposed method and the mainstream methods on the DACD dataset.(b).Visualisation of the detection results of the proposed method and the mainstream methods for cross-domain detection from DACD to LROC.

Table 1 .
Performance comparison on the DACD dataset and cross-domain detection from DACD to LROC.

Table 2 .
Performance comparison on the LROC dataset and cross-domain detection from LROC to DACD.

Table 3 .
Performance comparison on the DOTA dataset.

Table 4 .
Ablation experiments on different combinations of our proposed strategies for cross-domain crater detection from DACD to LROC.
[49]re 6.Ablation experiment on different attention mechanism modules and loss functions for cross-domain crater detection from DACD to LROC.Figure 7.Ablation experiment on BOT (data augmentation and SPF) for cross-domain crater detection from DACD to LROC, where the Faster refers to Faster R-CNN[16]and Libra refers to Libra R-CNN[49].

Table 5 .
Results obtained by using different backbone networks on the DACD dataset.