{'fraction_non_alphanumeric': 0.03209561034275406, 'fraction_numerical': 0.011500300661455201, 'mean_word_length': 4.9701592999775634, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Domain Adaptive Person Search

Person search is a challenging task which aims to achieve joint pedestrian detection and person re-identification (ReID). Previous works have made significant advances under fully and weakly supervised settings. However, existing methods ignore the generalization ability of the person search models. In this paper, we take a further step and present Domain Adaptive Person Search (DAPS), which aims to generalize the model from a labeled source domain to the unlabeled target domain. Two major challenges arises under this new setting: one is how to simultaneously solve the domain misalignment issue for both detection and Re-ID tasks, and the other is how to train the ReID subtask without reliable detection results on the target domain. To address these challenges, we propose a strong baseline framework with two dedicated designs. 1) We design a domain alignment module including image-level and task-sensitive instance-level alignments, to minimize the domain discrepancy. 2) We take full advantage of the unlabeled data with a dynamic clustering strategy, and employ pseudo bounding boxes to support ReID and detection training on the target domain. With the above designs, our framework achieves 34.7% in mAP and 80.6% in top-1 on PRW dataset, surpassing the direct transferring baseline by a large margin. Surprisingly, the performance of our unsupervised DAPS model even surpasses some of the fully and weakly supervised methods. The code is available at https://github.com/caposerenity/DAPS.


Introduction
Person search [44,39] aims to detect and identify the query person from natural images. The mainstream approaches to tacking this task is to simultaneously address both tasks in an end-to-end manner, where supervised learning [44,34,6,26] that rely on both pedestrian bounding boxes annotation and identity labels have been actively investigated. However, these supervised methods may suffer from significant performance degradation on unseen domains due to domain gaps. To address this problem, several recent works [40,20] propose the weakly supervised person search (WSPS) setting without accessible ID annotations, shown in Fig. 1. Nevertheless, several limitations are still waiting to be addressed. First, these works still require manual annotation of the ground-truth bounding boxes for the detection task, which obviously is not an economical option for real-world applications. Second, there exist several large-scale annotated person search datasets, e.g., CUHK-SYSU [39] and PRW [44], which can serve as supervised source domains and help improve the performance on the unlabeled target data. Unfortunately, the weakly supervised setting does not fully unleash the potential of the available training data. Third, these methods adopt an inconsistent training strategy with supervised detection and unsupervised ReID, which ignores the essential correlation between the two sub-tasks.
Inspired by the unsupervised domain adaptation (UDA) [16,23,36], as shown in Fig. 1, we present the Domain Adaptive Person Search (DAPS) framework, where person search models trained on labeled source domain are transferred to unlabeled target domains. Compared to weakly supervised person search, neither the identity labels nor the bounding boxes are accessible in DAPS. Our framework faces two major challenges: (1) Both the detection and the ReID sub-tasks suffer from domain gap. However, detection focuses on the commonness of people regardless of the identities, while ReID needs to learn the uniqueness of different persons. This conflict can be more serious in domain adaptation. (2) Since the ground-truth detection boxes are not available, it will be extremely challenging to accurately localize the pedestrians in the target domain, which further increases the difficulty for the ReID sub-task. Therefore, directly extending WSPS methods to take advantage of target domain data is infeasible.
To address the first challenge, we explore domain alignment for robust domain invariant feature learning. In the context of pedestrian detection, this is typically achieved by domain adversarial training [8] on both image-level and instance-level features. Following this line of research, we design a domain align-ment module (DAM) to alleviate the discrepancy between different domains. Specifically, on the one hand, we introduce domain discriminators at intermediate backbone layers. On the other hand, we perform a task-sensitive instancelevel alignment to mitigate the conflicts between two sub-tasks. We observe that such a domain alignment operation is beneficial for both branches.
To tackle the second challenge, we generate pseudo bounding boxes on the target domain images iteratively, and perform the training process with GT and pseudo boxes for domain adaptation. Furthermore, we present a dynamic clustering strategy to generate pseudo identity labels on the target domain. To fully release the potential of the target domain training data, the proposed framework refines the detection task with selected proposals, and enhances the interaction between the two sub-tasks with hybrid hard case mining. Experimental results demonstrate that this design surprisingly achieves comparative performance with directly adopting ground-truth bounding boxes.
Our contributions are summarized as three-fold: -We introduce a novel unsupervised domain adaptation paradigm for person search. This setting requires neither bounding boxes nor identity annotations on the target domain, making it more practical for real-world applications. -We present the DAPS framework to overcome the challenges caused by cross-domain discrepancy and cross-task dependency. We propose domain alignment for person search to enhance domain-invariant feature learning. Meanwhile, a dynamic clustering and a hybrid hard case mining strategy are introduced to facilitate unsupervised target domain learning. -Without any auxiliary label in the target domain, our framework achieves promising performance on two target person search benchmarks, surprisingly outperforming several weakly and fully supervised models.

Person Search
With the development of deep learning and large scale benchmarks [39,44], person search [4] has recently become a popular research topic. Existing fully supervised person search models can be divided into two-step and one-step frameworks. Two-step frameworks typically consist of separately trained detection and ReID models [34,21]. Zheng et al. [44] make a systematic evaluation on different combination of detection and ReID models. Wang et al. [34] solve the inconsistency between detection and person ReID tasks. One-step frameworks [6,26,41] design a unified model to jointly solve detection and ReID tasks in an endto-end manner, making the pipeline more efficient. Yan et al. [43] introduce a graph model to explore the impact of contextual information for identity matching. Chen et al. [6] disentangle the person representation into norm and angle to eliminate the cross-task conflict. Li et al. [26] develop a sequential structure to reduce the low-quality proposals. Several recently studies [40,20] adopt the weakly supervised setting without no accessible person ID labels. In this work, we explore a novel person search setting to generalize labeled source to unlabeled target domain without any bounding boxes and ID labels annotation.

Domain Adaptation for Person ReID
Unsupervised domain adaptation (UDA) ReID [7,10,28,15,17,32,42] typically trains a model with labelled source domain and transfers to the target domain under the unsupervised setting. Mainstream UDA ReID methods can be divided into two categories. The first category employs generative adversarial networks [19] to mitigate the style discrepancy and translate the labelled source domain data into the target domain [7,10,28]. For the second category, they generate pseudo labels by clustering [15,17,32] or assigning soft labels [35] on target domain, and use these pseudo labels to further supervise target domain training.
Recently, pseudo label-based methods raise more attention due to their superior performance. However, UDA ReID requires the cropped images, which cannot be directly extended to adaptive person search due to the lack of bounding boxes on target domain. To address this, we propose a dynamic clustering strategy to generate high-quality pseudo boxes to facilitate target domain training.

Domain Adaptive Object Detection
Existing Domain Adaptive approaches object detection can be categorized into three main branches, including adversarial-based methods [33,8,45,37,31], discrepancy-based methods [24,2,3] and reconstruction-based methods [27,1,11]. Adversarial-based methods utilize a domain discriminator to distinguish the domain of input data, the adversarial training is performed to encourage domain confusion between the source domain and the target domain. The discrepancybased strategy utilizes the unlabeled target domain images to fine-tune the detector, and further followed by mean-teacher learning [2] or auto-annotation [3]. The reconstruction-based approaches bridge the domain gap by reconstructing the source or target samples, which is usually realized by image-to-image translation [1,27]. In this work, we consider the conflicts between sub-tasks of person search, and develop a task-sensitive alignment module to alleviate such conflicts.

Framework Overview
The general pipeline of the proposed DAPS framework is illustrated in Fig. 2. Given the input images from both the source and the target domain, the imagelevel feature maps are extracted with a backbone network. Then, these features are input into the Region Proposal Network (RPN) to generate candidate bounding boxes, which are subsequently fed into the ROI-Align layer to represent instance-level feature maps. To close the domain gaps for the downstream detection and ReID tasks, we design a domain alignment module (DAM) to align both image-level and instance-level features from different domains.  Fig. 2: Architecture of the DAPS framework. "GRL" denotes the gradient reverse layer [16]. The backbone follows SeqNet [26], and we employ a domain alignment module to minimize domain discrepancy on both image-level and instance-level. We further impose dynamic clustering, hybrid hard case mining and target detection training to take full advantage of the unlabeled target domain data.
Subsequently, the domain-aligned instance-level feature maps are input into both the detection and the ReID branch. Since the ground-truth bounding boxes are not available in the target domain, the model will generate different pedestrian detection results for each training epoch. Therefore, it is infeasible to follow the traditional UDA ReID methods, which generally perform clustering on a fixed size of instances to generate pseudo labels. To address this issue, we design a novel dynamic clustering strategy, which continuously associates the bounding boxes generated from consecutive epochs, to guarantee the stability of instance-level ReID features. Based on dynamic clustering strategy, we further introduce the hybrid hard case mining and the target domain detection refinement to sufficiently take advantage of the unlabeled training data.

Domain Alignment Module
Image-level Alignment. As discussed in [36,8,7,10], minimizing domain discrepancy is beneficial for both sub-tasks of person search, and an effective way is to guide the model to learn domain-invariant representation. Motivated by the recent progress in domain adaptive detectors [8,45,37,31], where intermediate features are imposed with image-level alignment constraints, we introduce a domain alignment module into our DAPS framework. As shown in Fig. 2, DAM employs a patch-based domain classifier to predict the domain where the input feature comes from. A min-max formulation is adopted to misdirect the domain classifier and encourage domain-invariant representation learning.
We have tried to conduct image-level alignment on different intermediate features and multi-scale alignment, but achieve no better results. Task-sensitive Instance-level Alignment. As illustrated in Fig. 3, our framework consists of two head networks, where the detection performance mainly depends on the first standard Faster R-CNN [18] head, while the NAE [6] head is highly relevant to ReID. When the scale of the source domain is much smaller than the unlabeled target, the target pseudo bounding boxes predicted by detector trained on the source can be severely overfitted to the smaller domain, but no reliable target detection guidance can relieve this issue. When the target is much smaller, pseudo target ID labels can be easily obtained by clustering, but these might provide insufficient generalizing for the ReID sub-task.
According to the characteristics of the up-and down-stream tasks, we propose the task-sensitive instance-level alignment module by balancing the alignment weight on instance-level features for both sub-tasks. Suppose we have K 1 instances in the standard head and K 2 instances for the NAE head, two domain classifiers   Fig. 4: Illustration of the dynamic clustering and hard case mining. At start of each epoch, we employ generated proposals, including both qualified ones and hard cases, to update the memory bank. Qualified proposals are adopted for matching pseudo boxes memory, and hard cases will directly be added.
where j ∈ {1, ..., K 1 }, and k ∈ {1, ..., K 2 }. The source and target domain contains N s and N t images respectively, and the balancing factor λ is obtained by where the σ (·) is Sigmoid function to normalize the domain scale ratio. Moreover, we impose a L2-norm regularizer to ensure the consistency between image-level and instance-level classifiers.

Training on Unlabeled Target Domain
Dynamic Clustering. UDA ReID models typically employ the clustering strategy (e.g., DBSCAN) to generate pseudo labels for the target domain instances, and employ memory-based losses [17] for metric learning. However, without ground-truth bounding boxes on target domain, the instances can be only generated from the detection results, which varies with the training process. This makes it infeasible to directly apply typical clustering approach to DAPS. To address this issue, we propose a novel dynamic clustering strategy to make full use of the detection results for continuous ReID training.
As illustrated in Fig. 4, an asynchronized training strategy is introduced to progressively update pseudo bounding boxes with the selected proposals as ground-truth boxes on the target domain. Specifically, for the beginning α epochs, DAPS is trained only on the source dataset labeled with both bounding boxes and ID labels. After that, we maintain a bounding box memory M B = {B 1 , ..., B Nt } and a feature vector memory M V = {V 1 , ..., V Nt }, corresponding to each of N t target domain images. At the start of each subsequent epochs, DAPS filters out high-confidence candidate proposals {c 1 , ..., c m } from x t i , and employ them to match pseudo bounding boxes in box memory B i = {b 1 , ..., b n } according to IOU scores. Every proposal is assigned to the most relevant box in memory if their IOU score is above the threshold, and the boxes which fail to match any qualified proposal will be removed from memory B i . The remaining boxes in the memory are continuously updated in the Exponential Moving Average (EMA) method.
For example, suppose the proposals c j1 , c j2 , c j3 are mapped to the box b k , then b k is updated by: where γ ∈ [0, 1] controls the update rate. Eventually, the proposals without any matched box will also be fed into the memory B i , and further, the feature memory M V is updated in the same way. Afterwards, we perform clustering upon where w, f , and v represents the target domain clusters, the independent instances and the source domain classes, respectively. z + is the corresponding class prototype of the input feature x, and · denotes the inner product to measure the feature similarity. The features in the memory will be updated in a momentum way during backward stage: where z t is the t-th prototype in the memory bank M. Hybrid Hard Case Mining. A significant challenge for dynamic clustering is to generate reliable bounding boxes. We treat those boxes with lower confidence than a threshold as negative samples. In order to sufficiently exploit target domain information, we explore the potential of adding these "negative" samples to the ReID training. Proposals with relatively low confidence scores can be divided into highly overlapped with high-confidence boxes, the undetected persons and the background clutters. It is undesirable to enhance the ReID subtask by treating all these proposals as negative samples. As a result, we design a hierarchical scheme to categorize the candidate proposals, and employ both of the low-confidence person proposals and non-trivial background clutters to enhance the discrimination of the ReID branch.
Specifically, proposals with confidence score in the range of (ϵ h , ϵ p ) defined by upper and lower bound thresholds are regarded as non-trivial cases. We exclude highly overlapped duplicates by further screening IOUs with positive proposals, while the hybrid of undetected persons and the negative clutters are reserved for training. The features of these hard cases will be added to M, and be used for the contrastive learning process. The memory loss in Eq. 5 is modified as: where h denotes the hybrid hard cases. It is noteworthy that the hybrid hard cases will be involved into the dynamic clustering before the next epoch. Once a hard case is matched with new qualified proposals, it will be treated as a positive sample and updated in a momentum way. Target Detection Training. Although DAM can minimize the domain discrepancy, the over-fitting towards the source domain is still likely to take place, especially when the source domain data is extremely less complex and comprehensive than the target domain images. To this end, simultaneously training detection with both of the source and the target domain data is beneficial for the generalization ability of model. DAM and dynamic clustering provide relatively reliable pseudo bounding boxes, and specifically, we employ such pseudo bounding boxes after the α epoch to supervise detection on the target domain. In this way, the potential of unlabeled target domain images is released for both ReID and detection training.

Datasets and Evaluation Protocols
Datasets. We employ two large-scale benchmark datasets, CUHK-SYSU [39] and PRW [44] in our experiments. CUHK-SYSU is one of the largest public datasets for person search, composed of 18,184 images and 96,143 bounding boxes from 8,432 different identities. It is divided into a training set of 11,206 images with 5,532 identities, and a test set with 6,978 gallery images and 2,900 query images. The widely used PRW dataset contains 11,816 images, 43,110 annotated bounding boxes from 932 identities. The training set includes 5,704 images and 482 labelled persons, while the other 6,112 images and 2,057 probe persons from 450 identities are adopted as test set.
Evaluation Protocols. Our experiments employ the default splits for both datasets. For domain adaptation settings, the annotations of dataset used as the source domain is accessible, while neither bounding boxes nor identity labels of datasets as the target domain are available. All evaluations are performed on the test set of target domain. We adopt the widely used mean average precision (mAP) and cumulative matching characteristic (CMC) top-1 accuracy as evaluation metrics for ReID sub-task, while average precision (AP) and recall rate are adopted as the metrics for detection.

Implementation Details
We adopt ResNet50 [22] pretrained on ImageNet-1k [9] as our default backbone network. DBSCAN [14] with self-paced learning strategy [25] is employed as the basic clustering method, we set default hyper-parameters ϵ p = 0.95, ϵ h = 0.8 and λ t = 0.1. During training, the input images are resized to 1500 × 900, and random horizontal flip is applied for data augmentation. Our model is optimized by Stochastic Gradient Descent (SGD) for 20 epochs. We set a mini-batch size of 4, and an initial learning rate of 0.0024, which is reduced by a factor of 0.1 at epoch 16 with warmed up in the first epoch. The momentum and weight decay are set to 0.9 and 5×10 −4 , respectively. We set the momentum factor γ for memory updating to 0.2. The starting epoch of α is set to 8 when PRW is chosen as target domain, and 0 for CUHK-SYSU. All experiments are implemented with one NVIDIA Tesla A100 GPU. We also plan to support this project with MindSpore in our future work.

Ablation Study
We perform analytical experiments to verify the effectiveness of each detailed component in our proposed framework. In table 1, we compare the baseline method with different combinations of proposed components, and report the results on both CUHK-SYSU and PRW datasets. For example, when we use CUHK-SYSU as the target domain dataset, the directly transferring baseline Table 3: Comparative results when employing different strategies to handle the lack of bounding boxes. 'GT' refers to using the ground truth bounding boxes for all the training process of ReID, and 'GT for init' only employs these boxes to initialize the memory bank. 'static' means directly employing the qualified proposals before each epoch.  Effectiveness of task-sensitive instance-level alignment. To validate the effectiveness of our task-sensitive instance-level alignment design, we compare it with normal instance-level alignment, which conducts instance alignment on both head networks without balancing between them. As observed in Table 2, the task-sensitive design successfully alleviates the inner task conflicts and outperforms normal strategy by a large margin.
Effectiveness of dynamic clustering. As aforementioned, the key to utilizing unlabeled target domain data is generating reliable pseudo bounding boxes. To validate the quality of the pseudo bounding boxes we use, we compare different strategies of obtaining bounding boxes, and the results are reported in Table 3. We first measure the performance achieved by using ground-truth HSRFK $FFXUDF\ bounding boxes for training the ReID task. Furthermore, we report the performance achieved by directly employing the qualified proposals before each epoch, which is denoted as 'static' in Table 3. The results reveal that our proposed dynamic clustering strategy can generate trustworthy pseudo bounding boxes to achieve comparable performance with using ground-truth boxes.
Effectiveness of asynchronized training. We conduct experiments for influences by the training stage hyper-parameter α on final performance. As shown in Table 4, when PRW is adopted as the target domain, the best performance is achieved with α = 8, while with α = 0 for CUHK-SYSU. The results might be counterintuitive but indeed validate our task-sensitive motivation. For smaller source dataset, even limited additional target information might be helpful for cross-domain generalization. In contrast, for larger source dataset, unreliable target proposals can be harmful for domain gap bridging.
Analysis on hyper-parameter ϵ p . We visualize the influence of hyperparameter ϵ p in Fig. 5. We observe that the value of ϵ p influences the ReID performance to a large extend, and the best performance is achieved with ϵ p = 0.95. From Fig. 5b, it can be observed that the selection of ϵ p is a trade-off between recall rate and proposal quality. Setting it to a extremely high value leads to discarding useful proposals, while a low threshold will induct clutters to undermine the quality of clustering.

Comparison with State-of-the-Art Methods
Since no existing person search methods with such domain adaptation settings can be directly compared, we further compare DAPS with fully supervised methods in Table 5, including both of the two-step methods and one-step ones. It is surprising that our framework even surpasses some supervised methods. For example, DAPS outperforms MGTS [5], OIM [39], IAN [38], NPSM [29] and CTXGraph [43] on PRW. The comparison with the state-of-the-art fully supervised methods indicate that there exists a large performance gap, and we hope our work will encourage more explorations for this setting. Moreover, to make measure the theoretical upper limit of DAPS setting, we train some state-ofthe-art method with both datasets in a supervised manner, and more details are described in the supplementary material.
The comparisons with existing weakly supervised methods are shown in Table 6, and we also present the results of training R-SiamNet with both datasets in the weakly supervised manner. When evaluated on the PRW dataset, DAPS outperforms all existing weakly supervised methods by a significant margin. For the CUHK-SYSU dataset, DAPS still underperforms the state-of-the-art weakly supervised models, which is mainly caused by the limitation brought by detection capabilities. As mentioned in Sec. 4.1, the images and identities in PRW are prominently fewer than those in CUHK-SYSU, and this further leads to the poor detection performance of adopting CUHK-SYSU as target domain.

Qualitative Results
To better illustrate the distributions of our hybrid hard cases, we visualize some qualitative results from both datasets in Fig. 6. As is observed, the hybrid hard cases consist of undetected persons (column a), highly overlapped human crops (column b) and background clutters(column c,d). These qualitative results  Fig. 6: Visualization of some hard cases, the green bounding boxes denote the qualified proposals, while the red ones denote the undetected persons. The crops of the hybrid hard cases are presented on the right of the images.
demonstrate the diversity of our hybrid hard cases, and validate the rationality of adding such cases to the memory bank.

Conclusions
In this paper, we introduce a novel Domain Adaptive Person Search setting, where neither bounding boxes nor identity labels for target domain are required. Based on this new setting, we propose a strong baseline framework by investigating domain alignment and taking advantage of unlabeled target domain data. Extensive results on two large-scale benchmarks demonstrate the promising performance our framework achieves and the effectiveness of designed modules. We hope this work will encourage more exploration in this direction.