Campus riding detection method based on density estimation

By adopting a density estimation-based campus cycling detection method, which combines crowd density estimation and contrastive learning modules, the occlusion problem in campus cycling detection is solved, thereby improving the accuracy of detection and the effectiveness of safety management.

CN121617006APending Publication Date: 2026-03-06HANGZHOU PUZHONG SHUZHI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511741686.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-25
Publication Date
2026-03-06

AI Technical Summary

Technical Problem

Existing pedestrian detection methods suffer from obstruction issues when detecting cyclists on campus, leading to high false positive or false negative rates and making it difficult to effectively manage the safety of cyclists on campus.

Method used

A density-based campus cycling detection method is adopted, which combines the task of crowd density estimation. The threshold setting of the nonmaximum suppression algorithm is guided by the crowd density, and a contrastive learning module is introduced to enhance the feature representation of the visible part of the cyclist. Feature extraction and prediction are performed through Siamese neural network and deep learning technology.

Benefits of technology

It effectively reduced the MR-2 index of cyclists under different types of obstruction, and improved the accuracy of cyclist detection and safety management capabilities on campus.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121617006A_ABST
    Figure CN121617006A_ABST
Patent Text Reader

Abstract

The invention discloses a campus riding detection method based on crowd density estimation, and the method comprises the steps: obtaining an original video stream of the detection of a rider in a campus, obtaining an original image, and generating a twin image; inputting the original image and the twinborn image into a twinborn neural network at the same time, and performing feature extraction on the sample pair image to obtain a rider feature and a shelter feature; the extracted features are predicted, the center point, the size and the position offset of the rider are predicted, the crowd density is estimated, and the center point of the rider is predicted for the extracted features in the twin image; constructing a self-adaptive mapping relation between the crowd local density value and an adjusting threshold value in a non-maximum suppression algorithm, and dynamically adjusting shielding among the riders; a contrast learning module is used to limit the characterization difference obtained after the sample pair image is input into the twin neural network, and the feature expression of the visible part of the rider is enhanced. And according to the empirical value, the MR-2 index is reduced to 8.4%, so that the problem of shielding among riders is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of pedestrian detection technology, specifically to a density estimation-based campus cycling detection method, which mainly focuses on the detection and safety management of electric bicycle riders on campus. Background Technology

[0002] Pedestrian detection is a branch of object detection. The task of object detection is to identify the presence of predefined types of objects in an image. Object detection tasks include identifying objects and providing a bounding box for each object. In pedestrian detection, as the name suggests, the predefined object type is only pedestrians.

[0003] The main existing methods for pedestrian detection are as follows: First, a feature extraction network (e.g., ResNet50) is used as the backbone to extract features from the image. Then, a feature fusion module is used. This module fuses features from the feature maps generated by the feature extraction network. For feature fusion to work, the smaller-scale feature maps need to be upsampled to transform all feature maps to a uniform scale. Common upsampling methods include deconvolution and up-sampling. The fused feature maps are then decoupled and fed into different decoders to predict the pedestrian's position, size, and offset. This yields regions in the image where pedestrians may exist. Finally, a non-maximum suppression algorithm is used to filter the prediction results, resulting in the final prediction.

[0004] Pedestrian detection feature extraction primarily utilizes the candidate bounding boxes (BODs) output by pedestrian detection models to locate potential pedestrians in images. Compared to general object detection tasks, pedestrian detection only involves predicting pedestrians, resulting in lower feature dimensions. However, pedestrian detection often focuses more on pedestrian occlusion. Occlusion can be categorized into intra-class occlusion and inter-class occlusion. Intra-class occlusion refers to occlusion between pedestrians. Non-maximum suppression (NMS) algorithms are often used to mitigate intra-class occlusion. However, due to manually set parameters, NMS often presents a contradictory problem: a high NMS threshold often leads to many false positives; conversely, a low NMS threshold often results in the loss of highly overlapping pedestrian targets. To address this issue, some improved NMS algorithms have been proposed, but they still result in many false positives with highly overlapping predicted bounding boxes. Therefore, dynamic threshold NMS algorithms have emerged, often using maximum intersection-union ratio (MUI) to encode density. However, these methods typically lead to inconsistencies between the density of the true samples and the MUI of the predicted samples, and they lack continuity. Furthermore, this method is not well-suited for anchor-free models.

[0005] Currently, most methods focus on pedestrian detection. With improved transportation, more and more students are choosing to cycle on campus. Cyclists on campus travel at much higher speeds than pedestrians, and during school hours, the large number of people increases the risk of collisions. Therefore, detecting cyclists on campus is essential for effective safety management and reducing unnecessary disputes. However, due to the high speeds and unpredictable nature of obstruction during cycling, detecting cyclists presents challenges. Summary of the Invention

[0006] To address the aforementioned technical problems, this invention provides a campus cycling detection method based on crowd density estimation. Addressing the occlusion problem, it combines the traditional non-maximum suppression algorithm with a crowd density estimation task, using crowd density to guide the threshold setting of the non-maximum suppression algorithm. Furthermore, a contrastive learning module is introduced to enhance the feature representation of the visible portion of the cyclist's image while mitigating feature interference from occluded portions.

[0007] The technical solution adopted is as follows: A density-based method for campus cyclists includes the following steps: Obtain the raw video stream for detecting cyclists on campus; Extract video frames from the video stream to obtain the original image; Twin images are generated using a data-driven, automated data augmentation strategy. Construct a Siamese neural network by simultaneously inputting the original image and the Siamese image as sample images into the Siamese neural network; Feature extraction is performed on the images of the samples processed by the Siamese neural network to obtain the features of the cyclists and the features of the occupants that obstruct the cyclists. The extracted features in the original image are used to predict the cyclist center point, cyclist size, cyclist position offset, and crowd density estimation. The extracted features in the twin image are used to predict the cyclist center point. An adaptive mapping relationship is constructed between the local density value of the crowd and the adjustment threshold in the nonmaximum suppression algorithm to dynamically adjust the occlusion between cyclists. By using a contrastive learning module to limit the representational gap obtained after inputting samples into a Siamese neural network, the feature representation of the visible part of the cyclist is enhanced.

[0008] Preferably, DLA-34 and ResNet-50 network architectures are used as the backbone networks to extract features from the original image and twin image.

[0009] More preferably, an end-to-end density estimation network based on deep learning is used for feature extraction. The specific method is as follows: Multi-scale feature maps extracted from the backbone network are input into a lightweight density prediction head; The density prediction head employs a hierarchical fusion structure, integrating contextual information from different resolutions, and then using regression processing to produce a high-resolution density map. ; Density map Each pixel value in This represents the probability density of a cyclist's center at that location. A higher value indicates a greater likelihood of a cyclist's center at that location, while a lower value indicates a greater likelihood of the location being background or a severely occluded area. The density prediction head uses a conditional convolutional network, which adaptively adjusts the convolutional kernel parameters based on the local content of the image to handle scale changes and occlusion.

[0010] Furthermore, a spatial attention mechanism is introduced to enhance the representation ability of densely populated areas, and the density map ground truth is... The generation employs an adaptive scaling Gaussian kernel method, and an adaptive loss function is used to construct the loss function to train the density estimation network; each real cyclist's annotation point For a two-dimensional Gaussian distribution, its covariance matrix is... The density map ground truth is related to the bounding box size of the cyclist. The expression is:

[0011] in, yes diagonal array , used to define the k-th real cyclist at its center point The surrounding Gaussian distribution pattern; and The expansion of the Gaussian distribution in the width and height directions is controlled separately, and a scale-adaptive method is used to define it. and ,Right now: , ; in, It is an empirical scaling factor with a value ranging from 0.1 to 0.3; This represents the width (in pixels) of the bounding box of the k-th cyclist. This represents the height (in pixels) of the bounding box labeled with the k-th cyclist. The constructed loss function is used to train the density estimation network:

[0012] The adaptive loss function uses Focal L2 loss, defined as follows: , Used for reweighted loss.

[0013] Furthermore, a lightweight dynamic threshold prediction module is employed to construct the dynamic threshold for the local density value of the crowd and the nonmaximum suppression algorithm. The adaptive mapping relationship between them is specifically achieved through the following method: For each candidate box From its corresponding density map Extract a local region centered on the bounding box. Density statistical characteristics :

[0014] in, For an aggregation operation, the max pooling method is used to characterize the congestion level of the region; statistical characteristics Features of the candidate box itself To perform fusion, input a miniature regression subnetwork. This directly predicts the dynamic NMS threshold specific to this candidate box. :

[0015] in, These are the learnable parameters of the regression subnetwork; The regression subnetwork The output is constrained by a sigmoid function, which determines the predicted dynamic threshold. Always falls within a predefined reasonable range Inside:

[0016] The dynamic threshold It is fed into a nonmaximum suppression algorithm to suppress other redundant boxes around the candidate box. The higher the value, the more crowded and severe the occlusion in the area, and the more lenient the suppression strategy is needed to preserve the real target that is partially occluded; The lower the value, the more isolated and clear the target is, and a more stringent suppression strategy can be adopted.

[0017] Preferably, the twin image is generated using a data-driven automated data augmentation strategy to replace the manual construction of the interference matrix. The specific method is as follows: By analyzing the occlusion patterns and contextual information of cyclist instances in the training dataset, the system automatically learns and generates various semantically consistent enhancement transforms to construct the original image. twin samples ; A learning-based automated data augmentation strategy is employed, using reinforcement learning or search algorithms to discover the optimal combination of augmentation transformations and their intensity parameters in the training dataset, thereby generating twin images that conform to the real physical occlusion patterns. It is applied directly to the entire image or the target candidate region, and is represented as:

[0018] in, Represents the selected automated enhancement transformation function. The parameters represent the control of the transformation type and intensity, and these parameters can be randomly generated using a preset strategy.

[0019] Preferably, the enhancement transformations employed include, but are not limited to, region dropping, content pasting, and style perturbation; The region discarding method involves randomly or based on the attention map selecting rectangular or irregular continuous regions in the image, setting their pixel values ​​to zero, or filling them with noise to simulate occlusion. The content pasting involves cropping out cyclists or background fragments from other training images and pasting them into the target area of ​​the current image to create structured occlusion. The style perturbation refers to altering the appearance texture of local regions through a lightweight style transfer network or Fourier domain transform to simulate imaging differences while preserving their structural content.

[0020] Preferably, the contrastive learning module adopts a self-supervised contrastive learning framework, and its loss function adopts an improved form based on InfoNCE loss. The specific calculation method is as follows:

[0021] in, and These represent the original images. and its twin image The normalized feature vector obtained after the twin network backbone and mapping; Indicates cosine similarity; It is a temperature hyperparameter used to adjust the degree of attention given to difficult negative samples; This represents the total number of samples in a batch.

[0022] More preferably, an overall loss function is used to optimize the prediction of the cyclist center point, cyclist size, cyclist position offset, and crowd density estimation. The overall loss function used is:

[0023]

[0024]

[0025]

[0026]

[0027]

[0028]

[0029] in: To predict the loss of the task based on the cyclist's center point, cyclist size, and cyclist position offset; It is the training loss for the crowd density estimation task; This is the loss from the contrastive learning module task; and These are the weights; It is the Kth cyclist in the image; It is the predicted probability that the current pixel is the center point of the cyclist; It is the actual annotation information corresponding to each pixel; hyperparameters and It is an adjustment parameter in Focal Loss; This represents the network's predicted value. This is the actual value that has been labeled. The technical solution of this invention has the following advantages: This invention utilizes a Siamese neural network in a cyclist detection method, combined with a contrastive learning module, to better extract features of occluded cyclists in cyclist images and enhance the feature representation of the visible parts of the cyclist. Experimental verification shows that this invention, combining contrastive learning and a crowd density-based NMS algorithm, achieves high MR (Mean Interaction) accuracy under four different occlusion types (Bare [0.95, 1], Reasonable [0.65, 1], Partial [0.65, 0.9], and Heavy [0, 0.65]).-2 The indicators were reduced to 8.4%, 45.3%, 8.2%, and 5.2%, thus solving the problem of obstruction between cyclists and making it easier to detect and manage the safety of cyclists using electric bicycles and other bicycles on campus. Attached Figure Description

[0030] To more clearly illustrate the specific embodiments of the present invention, the accompanying drawings used in the specific embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0031] Figure 1 This is a block diagram of the campus cyclist detection method provided by the present invention; Figure 2 These are examples of cyclist detection heatmaps provided by this invention. Image a is the actual annotation information in CityPersons; image b is a cyclist center heatmap generated using the annotation information; and image c is a crowd density heatmap generated using the annotation information. Detailed Implementation

[0032] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0033] like Figure 1 As shown, this invention provides a campus cycling detection method based on crowd density estimation, specifically including the following steps:

S01

[0034]

S02

[0035] Transformations include, but are not limited to, region discarding, content pasting, and style perturbation. Region discarding refers to randomly selecting rectangular or irregular continuous regions in an image, either based on the attention map, setting their pixel values ​​to zero, or filling them with noise to simulate occlusion. Content pasting refers to cropping out cyclists or background fragments from other training images and pasting them into the target region of the current image to create structured occlusion. Style perturbation refers to changing the appearance texture (such as lighting and color) of local regions through lightweight style transfer networks or Fourier domain transforms to simulate imaging differences while preserving their structural content.

[0036] Learning-based automated data augmentation strategies (such as RandAugment and AutoAugment) are employed to discover the optimal combination of augmentation transformations and their intensity parameters in the training dataset through reinforcement learning or search algorithms, thereby generating twin images that are both diverse and conform to the real physical occlusion rules.

[0037] Twin images The generation process does not rely on precise weakly labeled occlusion region information `area(occ)`, but instead applies the aforementioned data augmentation methods directly to the entire image or target candidate region, as follows:

[0038] in, Represents the selected automated enhancement transformation function. Parameters controlling the type and intensity of the transformation; these parameters can be randomly generated using a preset strategy. The generated twin image. With the original image Positive sample pairs are formed for subsequent comparative learning in the Siamese neural network, aiming to improve the model's robustness to occlusion, deformation, and changes in the I-tube.

[0039]

S04

[0040]

S05

[0041]

S06

[0042] This invention uses an end-to-end density estimation network based on deep learning for feature extraction, specifically including the following steps: Multi-scale feature maps extracted from the backbone network are input into a lightweight density prediction head; The density prediction head employs a hierarchical fusion structure, integrating contextual information from different resolutions, and then using regression processing to produce a high-resolution density map. ; Density map Each pixel value in This represents the probability density of a cyclist's center at that location. A higher value indicates a greater likelihood of a cyclist's center at that location, while a lower value indicates a greater likelihood of the location being background or a severely occluded area. The density prediction head uses a conditional convolutional network, which adaptively adjusts the convolutional kernel parameters based on the local content of the image to handle scale changes and occlusion.

[0043] Simultaneously, the spatial attention mechanism is introduced to enhance the representation ability of densely populated areas, and the density map ground truth... The generation employs an adaptive scaling Gaussian kernel method, and an adaptive loss function is used to construct the loss function to train the density estimation network; each real cyclist's annotation point For a two-dimensional Gaussian distribution, its covariance matrix is... The density map ground truth is related to the bounding box size of the cyclist. The expression is:

[0044] in, yes diagonal array , used to define the k-th real cyclist at its center point The surrounding Gaussian distribution pattern; and The expansion of the Gaussian distribution in the width and height directions is controlled separately, and a scale-adaptive method is used to define it. and ,Right now: , ; in, It is an empirical scaling factor with a value ranging from 0.1 to 0.3; This represents the width (in pixels) of the bounding box of the k-th cyclist. This represents the height (in pixels) of the bounding box labeled with the k-th cyclist. The constructed loss function is used to train the density estimation network:

[0045] The adaptive loss function uses Focal L2 loss, defined as follows: , Used for reweighting loss. Points with large residuals (usually foreground peaks) are given higher weights; points with small residuals (usually flat background areas) are given lower weights.

[0046]

S07

[0047] in, For an aggregation operation, the max pooling method is used to characterize the congestion level of the region; statistical characteristics Features of the candidate box itself To perform fusion, input a miniature regression subnetwork. This directly predicts the dynamic NMS threshold specific to this candidate box. :

[0048] in, These are the learnable parameters of the regression subnetwork; Regression Subnetwork The output is constrained by a sigmoid function to ensure the predicted dynamic threshold. Always falls within a predefined reasonable range Inside:

[0049] Dynamic threshold It is then fed into the Non-Maximum Suppression (NMS) algorithm to suppress other redundant boxes around the candidate box. The higher the value, the more crowded and severe the occlusion in the area, and the more lenient the suppression strategy is needed to preserve the real target that is partially occluded; The lower the value, the more isolated and clear the target is, and a more stringent suppression strategy can be adopted.

[0050]

S08

[0051] The contrastive learning module in this invention adopts a self-supervised contrastive learning framework, and the specific calculation method of its loss function is as follows: Contrastive learning aims to narrow the distance between positive sample pairs (the original image and its twin image) in the feature space, while simultaneously widening the distance between negative samples (different images), in order to learn a robust representation to occlusion. Its loss function employs an improved form based on InfoNCE loss:

[0052] in, and These represent the original images. and its twin image The normalized feature vector obtained after the twin network backbone and mapping; This represents the cosine similarity. It is a temperature hyperparameter used to adjust the level of attention given to difficult negative samples. This represents the total number of samples in a batch.

[0053] The predictions of cyclist center point, cyclist size, cyclist position offset, and crowd density are optimized using an overall loss function. The overall loss function used is:

[0054]

[0055]

[0056]

[0057]

[0058]

[0059]

[0060] in: To predict the loss of the task based on the cyclist's center point, cyclist size, and cyclist position offset; It is the training loss for the crowd density estimation task; This is the loss from the contrastive learning module task; and These are the weights; It is the Kth cyclist in the image; It is the predicted probability that the current pixel is the center point of the cyclist; It is the actual annotation information corresponding to each pixel; hyperparameters and It is an adjustment parameter in Focal Loss; This represents the network's predicted value. It is the actual value that is labeled.

[0061] Figure 2 This is an example of the heat map annotation for detecting cyclists on campus, which is a result of the present invention. The cyclists can be clearly detected from the image, and a bounding box is marked for each cyclist, thus solving the problem of occlusion between cyclists.

[0062] This invention was validated on the Citypersons and Caltech datasets to demonstrate its effectiveness. Citypersons is a subset of the open-source CityScapes dataset, containing 5000 images with an average of 7 pedestrians per image. Each image provides visible area annotations and full-body pedestrian annotations. This dataset is further divided into four subsets based on pedestrian visibility, from highest to lowest: Bare [0.95, 1], Reasonable [0.65, 1], Partial [0.65, 0.9], and Heavy [0, 0.65]. Each image is 2048×1024 pixels, representing high-resolution image input. The Caltech dataset consists of images from a 2.485-hour video recording, divided into training and validation sets by frame segmentation. The training set contains 6 subset sequences, totaling 42782 frames, while the test set contains 5 subsets, totaling 4024 frames. Each data sheet is 640×480 pixels and contains 350,000 bounding boxes and 2,300 pedestrian annotations.

[0063] Experimental setup All models were built using PyTorch. The optimizer was Adam, and similar to the CSP and APD models, moving average weights were used to update parameters during training. This invention used DLA-34 and ResNet-50 pre-trained on ImageNet as the backbone. During training, random scaling and random cropping were used to augment the data. The input network sizes for the Citypersons and Caltech datasets were 1024×2048 and 480×640, respectively. For the Citypersons dataset, this invention was trained on two GPUs (RTX6000), with four images allocated to each GPU. The initial learning rate was set to 1×10⁻⁶. -4 The dataset was trained for 37.5k iterations. For the Caltech dataset, each batch size contained 16 images, and training was performed using a single GPU (RTX6000) with a learning rate adjusted to 1×10⁻⁶. -4 The training was completed after 10,000 iterations.

[0064] The evaluation index used is MR -2 MR -2 The calculation is derived from the miss rate – FPPI curve, and the calculation formula is as follows:

[0065]

[0066] Assuming there are k false positives per image (FPPI) in N images, then FPPI is k / N, and missrate(1-R) ​​is the minimum miss rate corresponding to that FPPI value. Typically, the upper limit of the acceptable false positive rate per image is independent of pedestrian density, making it a better choice than the PR curve. The method for obtaining each FPPI and miss rate is the same as obtaining P and R values ​​in AP: obtain the confidence scores of all detection boxes, sort them from high to low, and sequentially determine the top-n as pedestrians. The final calculated metric is MR. -2 It is the log-average miss rate. The calculation method is as follows: in a logarithmic coordinate system, starting from 10... -2 Up to 10 0 Nine FPPI values ​​are taken evenly from the given range. These nine FPPI values ​​correspond to nine miss rate values. The average of these nine miss rate values ​​is the log-average miss rate.

[0067] Experimental results The results are compared with those of current mainstream pedestrian detection models on the Citypersons dataset, as detailed in Table 1 below. Pedestrians are further divided into four subsets based on their visibility, from highest to lowest: Bare [0.95, 1], Reasonable [0.65, 1], Partial [0.65, 0.9], and Heavy [0, 0.65]. This invention uses DLA-34 as the backbone, and the test images are taken at their original size (1024×2048). The experimental results show that this invention achieves higher MR (Mean Impact Ratio) at four occlusion levels. -2 The indicators reached 8.4%, 45.3%, 8.2%, and 5.2% respectively. Among them, Heavy –MR -2 It is 1.3% lower than the best existing detector's APD (46.6%). This clearly demonstrates that the present invention has a greater advantage over other models in dealing with occlusion problems.

[0068] Table 1: Comparison of this invention with other mainstream models on the Citypersons dataset

[0069] To further verify the robustness and effectiveness of the model in this invention, experiments were conducted on the Caltech dataset, and the results are shown in Table 2. The experimental results demonstrate that the Reasonable-MR model... -2 It can achieve a score of 3.8%, which is better than existing methods. It is worth mentioning that this invention was trained only on Caltech's training data, and its performance can surpass some models trained using additional training sets (such as Citypersons).

[0070] Table 2: Comparison of this invention with other mainstream models on the Caltech dataset

[0071] This invention collects data on cyclists on campus. Utilizing the detection method provided by this invention, experiments have verified that this invention, combining contrastive learning and a crowd density-based NMS algorithm, achieves high MR (Mean Interference Rate) under four different occlusion types (Bare [0.95, 1], Reasonable [0.65, 1], Partial [0.65, 0.9], and Heavy [0, 0.65]). -2 The indicators were reduced to 8.4%, 45.3%, 8.2%, and 5.2%, thus solving the problem of obstruction between cyclists and making it easier to detect and manage the safety of cyclists using electric bicycles and other bicycles on campus.

[0072] Any aspects not covered in this invention are applicable to existing technologies.

[0073] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.

Claims

1. A campus ride detection method based on density estimation, characterized in that, The method comprises the following steps: Obtaining an original video stream of a campus riding person detection; Cutting out video frames from the video stream to obtain original images; Generating a twin image by using an automatic data enhancement strategy based on data driving; Building a twin neural network, and inputting the original image and the twin image into the twin neural network as sample pair images; Extracting features of the sample pair images processed by the twin neural network to obtain features of a riding person and features of an occlusion object that occludes the riding person; Predicting the features in the original image to predict a riding person center point, a riding person size, a riding person position offset and a crowd density estimation, and predicting the features in the twin image to predict a riding person center point; Building an adaptive mapping relationship between a crowd local density value and an adjusted threshold in a non-maximum suppression algorithm to dynamically adjust occlusions between the riding persons; Using a contrast learning module to limit a representation gap obtained by inputting the sample pair images into the twin neural network, and strengthening feature expression of a visible part of the riding person. 2.The density estimation based campus ride detection method of claim 1, wherein, DLA-34 and ResNet-50 network architectures are used as backbone networks to extract features of the original image and the twin image. 3.The density estimation based campus ride detection method of claim 2, wherein, An end-to-end density estimation network based on deep learning is used for feature extraction, and the specific method is as follows: Multi-scale feature maps extracted by the backbone network are input into a lightweight density prediction head; The density prediction head adopts a hierarchical fusion structure, integrates context information from different resolutions, and obtains a high-resolution density map through regression processing ; Density map Each pixel value in The density represents the probability density of the presence of a cyclist's center at that location. A higher value indicates a greater likelihood of the cyclist's center being present at that location, while a lower value indicates a greater likelihood of the location being background or a severely occluded area. The density prediction head employs a conditional convolutional network, which adaptively adjusts the convolutional kernel parameters based on the local content of the image to handle scale variations and occlusion. 4.The density estimation based campus ride detection method of claim 1, wherein, The spatial attention mechanism is introduced to strengthen the representation ability of the crowd dense area, and the generation of the density map ground truth adopts an adaptive scale Gaussian kernel method, and an adaptive loss function is used to construct a loss function to train the density estimation network; each real cyclist labeling point corresponds to a two-dimensional Gaussian distribution, and the covariance matrix of which is associated with the size of the bounding box of the cyclist, and the expression of the density map ground truth is: wherein is a diagonal matrix for defining the Gaussian distribution shape of the kth real cyclist around the center point of the kth real cyclist and respectively control the spread of the Gaussian distribution in the width and height directions, the scale adaptive method is used to define and i.e. , ; wherein, is an empirical scaling factor, having a value of 0.1 to 0.3; width of the annotated bounding box (pixels) representing the k-th cyclist; heightk represents the height (pixels) of the annotated bounding box of the kth cyclist; A loss function is constructed to train the density estimation network: For the adaptive loss function, Focal L2 loss is adopted, defined as , is used to reweight the loss. 5.The density estimation based campus ride detection method of claim 4, wherein, A lightweight dynamic threshold prediction module is used to construct the dynamic threshold for local population density values ​​and nonmaximum suppression algorithms. The adaptive mapping relationship between them is specifically achieved through the following method: For each candidate box , a local region centered at the box is extracted from its corresponding density map , and the density statistical features of the local region are computed : wherein, is a pooling operation using max-pooling method for representing the crowdedness of the region; The statistical features characteristics of the candidate box itself fusion, input a micro regression sub-network , directly predict the dynamic NMS threshold dedicated to this candidate box : wherein, are learnable parameters of the regression subnetwork. The output of the regression subnetwork is constrained by a sigmoid function, which puts the predicted dynamic threshold always in a predefined reasonable interval . The dynamic threshold is sent into a non-maximum suppression algorithm to suppress other redundant boxes around the candidate box, which The higher the value, the more crowded and occluded the region is, and a more lenient suppression strategy is needed to preserve the partially occluded real target. The lower the value, the more isolated and clear the target is, and a more stringent suppression strategy can be used. 6.The density estimation based campus ride detection method of claim 1, wherein, The generation of the twin image uses an automatic data enhancement strategy based on data driving to replace a manually constructed interference matrix, and the specific method is as follows: By analyzing the occlusion patterns and context information of the cyclist instances in the training dataset, multiple semantic-consistent augmentation transformations are automatically learned and generated for constructing the original image twin samples of the original image ​ Adopt learning-based automatic data augmentation strategy, find the optimal augmentation transformation combination and its intensity parameters in the training data set through reinforcement learning or search algorithm, generate twin images conforming to the real physical occlusion rule which is directly applied on the whole image or target candidate region, and is represented as: wherein, representing a selected automated enhancement transform function, representing a parameter controlling the transform type and intensity, which can be randomly generated with a preset policy.

7. The campus riding detection method based on density estimation according to claim 6, characterized in that, The enhancement transformation includes but is not limited to region discard, content paste and style disturbance; The region discard randomly or according to an attention map selects a rectangular or irregular continuous region in the image, sets the pixel value to zero or fills noise to simulate occlusion; The content paste cuts out a riding person or a background segment in other training images, and pastes it to a target region of the current image to create a structured occlusion; The style disturbance changes the appearance texture of a local region by using a lightweight style transfer network or a Fourier domain transformation to simulate imaging differences while retaining the structural content.

8. The density estimation based campus ride detection method according to any one of claims 1-7, wherein, The contrast learning module uses a self-supervised contrast learning framework, and the loss function uses an improved form based on the InfoNCE loss, and the specific calculation method is as follows: wherein, and denote the original image and its twin image the normalized feature vector obtained after the twin network backbone and mapping; denotes the cosine similarity; is a temperature hyperparameter that regulates the degree of focus on difficult negative samples; represents the total number of samples in a batch. 9.The density estimation based campus ride detection method of claim 1, wherein, An overall loss function is used to optimize the prediction of the riding person center point, the riding person size, the riding person position offset and the crowd density estimation, and the overall loss function used is as follows: wherein: to predict the loss of the cyclist center point, cyclist size, cyclist position offset task; is the training loss for the crowd density estimation task; is the loss for the contrastive learning module task; and are weights, respectively; is the Kth cyclist in the image; is the probability that the current pixel point is the center point of the cyclist; is the real label information corresponding to the pixel point; hyperparameters and is a tuning parameter in Focal Loss; represents the predicted value of the network, is the true value of the label.