Pedestrian re-identification method, device, computer-readable storage medium and terminal device

CN114943985BActive Publication Date: 2025-03-18UBTECH ROBOTICS CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210609192.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-31
Publication Date
2025-03-18
Estimated Expiration
2042-05-31

AI Technical Summary

Technical Problem

In the prior art, the triple loss function based on absolute distances, when facing scenarios where there are small differences between classes and large differences within classes, it leads to unstable model training, poor feature discrimination and robustness, and reduces the accuracy of pedestrian re-identification.

Method used

The triple loss function based on proportion is used to improve the stability of model training by constraining the ratio of the positive sample feature distance to the negative sample feature distance is less than the preset proportional threshold.

Benefits of technology

The stability of model training and discriminant and robustness of features are improved, thereby improving the accuracy of pedestrian re-identification results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114943985B_ABST
    Figure CN114943985B_ABST
Patent Text Reader

Abstract

The present application belongs to the field of pedestrian re-identification technology, and in particular, relates to a pedestrian re-identification method, apparatus, computer-readable storage medium and terminal device. The loss function used in the model training process of the method is a preset ratio-based triplet loss function; the ratio-based triplet loss function constrains the ratio of the positive sample feature distance to the negative sample feature distance to be less than a preset ratio threshold; the positive sample feature distance is the distance between the reference image feature and the positive sample image feature; the negative sample feature distance is the distance between the reference image feature and the negative sample image feature. When faced with a scene where the inter-class difference is very small and the intra-class difference is very large, the ratio-based triplet loss function can effectively improve the stability of the model training compared to the absolute distance-based triplet loss function in the prior art, and the features extracted by the trained model are more discriminative and robust, thereby improving the accuracy of the pedestrian re-identification results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of pedestrian re-identification, and in particular, relates to a pedestrian re-identification method, apparatus, computer-readable storage medium and terminal device. Background Art

[0002] Person re-identification, also known as pedestrian re-identification, is a technology that uses computer vision technology to determine whether there is a specific pedestrian in an image or video sequence.

[0003] In the process of pedestrian re-identification technology developing from traditional metric learning to deeper and wider deep neural network learning, distance measurement is indispensable. Pedestrian re-identification technology needs to be able to effectively narrow the distance between the same category and increase the distance between different categories in the feature space. Based on the distance metric, researchers have proposed many loss functions for supervised network learning. Among them, the triple loss function based on absolute distance is the most widely used loss function, and in general, it can achieve good training results.

[0004] However, when faced with scenarios where the inter-class differences are small and the intra-class differences are large, the triplet loss function based on absolute distance will cause instability in model training, resulting in poor discriminability and robustness of the features extracted by the trained model, thereby reducing the accuracy of the pedestrian re-identification results. Summary of the invention

[0005] In view of this, embodiments of the present application provide a pedestrian re-identification method, apparatus, computer-readable storage medium, and terminal device to solve the problem of low accuracy of pedestrian re-identification methods in the prior art.

[0006] A first aspect of an embodiment of the present application provides a pedestrian re-identification method, which may include:

[0007] Get the pending person re-identification task;

[0008] Using a preset pedestrian re-identification model to process the pedestrian re-identification task to obtain a pedestrian re-identification result;

[0009] Among them, the loss function used by the pedestrian re-identification model during the model training process is a preset ratio-based triplet loss function; the ratio-based triplet loss function constrains the ratio of the positive sample feature distance to the negative sample feature distance to be less than a preset ratio threshold; the positive sample feature distance is the distance between the reference image feature and the positive sample image feature; the negative sample feature distance is the distance between the reference image feature and the negative sample image feature; the ratio threshold is a variable, and the ratio threshold is negatively correlated with the negative sample feature distance.

[0010] In a specific implementation of the first aspect, the ratio-based triplet loss function may be:

[0011]

[0012] Among them, N tp is the number of triples, i is the serial number subscript, f a 、f p and f n are the reference image features, positive sample image features and negative sample image features respectively, D is the distance function, β is the ratio threshold, {*} + =max{*,0}, max is the maximum value function, L triplet_ratio is the ratio-based triplet loss function.

[0013] In a specific implementation of the first aspect, the ratio threshold satisfies:

[0014]

[0015] in, β1 is the preset ratio threshold lower limit, β2 is the preset ratio threshold lower limit, is the preset lower distance limit, is the preset upper limit of distance, and F is the preset functional relationship.

[0016] In another specific implementation of the first aspect, the ratio-based triplet loss function may be:

[0017]

[0018] Among them, N tp is the number of triples, i and j are serial subscripts, and f a 、f p and f n are the reference image features, positive sample image features and negative sample image features respectively, D is the distance function, β is the ratio threshold, {*} + =max{*, 0}, max is the maximum value function, min is the minimum value function, P and A are the number of pedestrians in a training batch and the number of images of each pedestrian, respectively, L triplet_ratio is the ratio-based triplet loss function.

[0019] In another specific implementation of the first aspect, the ratio threshold satisfies:

[0020]

[0021] in, β1 is the preset ratio threshold lower limit, β2 is the preset ratio threshold lower limit, is the preset lower distance limit, is the preset upper limit of distance, and F is the preset functional relationship.

[0022] A second aspect of an embodiment of the present application provides a pedestrian re-identification device, which may include:

[0023] A task acquisition module is used to obtain pending person re-identification tasks;

[0024] A pedestrian re-identification module is used to process the pedestrian re-identification task using a preset pedestrian re-identification model to obtain a pedestrian re-identification result; wherein the loss function used by the pedestrian re-identification model in the model training process is a preset ratio-based triplet loss function; the ratio-based triplet loss function constrains the ratio of the positive sample feature distance to the negative sample feature distance to be less than a preset ratio threshold; the positive sample feature distance is the distance between the reference image feature and the positive sample image feature; the negative sample feature distance is the distance between the reference image feature and the negative sample image feature; the ratio threshold is a variable, and the ratio threshold is negatively correlated with the negative sample feature distance.

[0025] In a specific implementation of the second aspect, the ratio-based triplet loss function may be:

[0026]

[0027] Among them, N tp is the number of triples, i is the serial number subscript, f a 、f p and f n are the benchmark image features, positive sample image features and negative sample image features respectively, D is the distance function, β is the ratio threshold, {*} + =max{*,0}, max is the maximum value function, L triplet_ratio is the ratio-based triplet loss function.

[0028] In a specific implementation of the second aspect, the ratio threshold satisfies:

[0029]

[0030] in, β1 is the preset ratio threshold lower limit, β2 is the preset ratio threshold lower limit, is the preset lower distance limit, is the preset upper limit of distance, and F is the preset functional relationship.

[0031] In another specific implementation of the second aspect, the ratio-based triplet loss function may be:

[0032]

[0033] Among them, N tp is the number of triples, i and j are serial subscripts, and f a 、f p and f n are the reference image features, positive sample image features and negative sample image features respectively, D is the distance function, β is the ratio threshold, {*} + =max{*, 0}, max is the maximum value function, min is the minimum value function, P and A are the number of pedestrians in a training batch and the number of images of each pedestrian, respectively, L triplet_ratio is the ratio-based triplet loss function.

[0034] In another specific implementation of the second aspect, the ratio threshold satisfies:

[0035]

[0036] in, β1 is the preset ratio threshold lower limit, β2 is the preset ratio threshold lower limit, is the preset lower distance limit, is the preset upper limit of distance, and F is the preset functional relationship.

[0037] A third aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any one of the above-mentioned pedestrian re-identification methods are implemented.

[0038] The fourth aspect of an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the above-mentioned pedestrian re-identification methods when executing the computer program.

[0039] A fifth aspect of an embodiment of the present application provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes the steps of any one of the above-mentioned pedestrian re-identification methods.

[0040] Compared with the prior art, the embodiments of the present application have the following beneficial effects: the loss function used in the model training process of the embodiments of the present application is a preset ratio-based triplet loss function; the ratio-based triplet loss function constrains the ratio of the positive sample feature distance to the negative sample feature distance to be less than a preset ratio threshold; the positive sample feature distance is the distance between the reference image feature and the positive sample image feature; the negative sample feature distance is the distance between the reference image feature and the negative sample image feature. When faced with a scenario where the inter-class difference is very small and the intra-class difference is very large, the ratio-based triplet loss function can effectively improve the stability of the model training compared to the absolute distance-based triplet loss function in the prior art, and the features extracted by the trained model are more discriminative and robust, thereby improving the accuracy of the pedestrian re-identification results. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0042] Figure 1 is a schematic diagram of a triplet image;

[0043] Figure 2 Schematic diagram of the functional relationship between the ratio threshold and the negative sample feature distance;

[0044] Figure 3 This is a flow chart of an embodiment of a pedestrian re-identification method in an embodiment of the present application;

[0045] Figure 4 This is a structural diagram of an embodiment of a pedestrian re-identification device in an embodiment of the present application;

[0046] Figure 5 This is a schematic block diagram of a terminal device in an embodiment of the present application. DETAILED DESCRIPTION

[0047] In order to make the purpose, features, and advantages of the invention of this application more obvious and easy to understand, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the embodiments described below are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0048] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0049] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0050] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0051] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0052] In addition, in the description of the present application, the terms "first", "second", "third", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0053] The loss function is an integral part of the deep network model. During the model training process, the loss function enhances the model's feature representation ability by minimizing the error between the model's predicted value and the true value. In fine-grained recognition visual tasks such as person re-identification, the loss function usually optimizes both the inter-class distance and the intra-class distance at the same time, thereby enhancing the model's discriminability and robustness.

[0054] The triplet loss function is the most common loss function in visual tasks and is often used in tasks such as face recognition, image classification, and person re-identification. The input of the triplet loss function is a feature triple {f a , f p , f n}, where f a 、f p and f n They are respectively the reference image features, positive sample image features and negative sample image features in the triplet. Figure 1Shown is a schematic diagram of a triplet of images, where each group of images is, from left to right, a reference image, a positive sample image, and a negative sample image.

[0055] The triplet loss function based on absolute distance constrains the negative sample feature distance D(f a ,f n ) and the positive sample feature distance D(f a ,f p ) is greater than the preset difference threshold, thereby achieving the optimization goal of increasing the intra-class similarity and reducing the inter-class similarity. Among them, the positive sample feature distance is the distance between the reference image feature and the positive sample image feature, and the negative sample feature distance is the distance between the reference image feature and the negative sample image feature.

[0056] The formula of the triplet loss function based on absolute distance is as follows:

[0057]

[0058] Among them, N tp is the number of triples, i is the serial number subscript, D is the distance function, α is the difference threshold, {*} + =max{*,0}, max is the maximum value function, L triplet is the triplet loss function based on absolute distance.

[0059] In model training, the computational complexity of using all triples to train the model is O(N 3 ), where N is the number of images in the training data set. Therefore, in order to improve the training efficiency of the model, the strategy of hard example mining is often used to select triples, as shown below. Under the strategy of hard example mining, the formula of the triple loss function based on absolute distance is:

[0060]

[0061] Among them, min is the minimum function, j is the serial number subscript, P and A are the number of pedestrians in a training batch and the number of images of each pedestrian, respectively.

[0062] However, in the task of person re-identification, different pedestrians may wear similar clothes (i.e., inter-class differences). The image of the same pedestrian often has drastic changes in appearance (i.e., intra-class differences) due to changes in the pedestrian’s posture and camera angle. Very big).

[0063] At this time, the triplet loss function based on absolute distance still constrains the difference between the feature distance of negative samples and the feature distance of positive samples, which will cause adverse consequences such as unstable training. For example, when the value of α is set to 0.4, for Figure 1 For the triplet images in (a) and (d), since the negative sample images are very similar to the reference images, the value of the negative sample feature distance is 0.5. At this time, the triplet loss function based on absolute distance requires that the value of the positive sample feature distance must be less than 0.1 to meet its constraint, which will increase the optimization difficulty of the model and cause instability in model training.

[0064] Therefore, when dealing with the problem of small inter-class differences and large intra-class differences that often occur in fine-grained recognition tasks such as pedestrian re-identification, the model cannot be trained stably because the triplet loss function based on absolute distance only constrains the absolute difference between the feature distance of negative samples and the feature distance of positive samples.

[0065] Considering the above-mentioned shortcomings of the triple loss function based on absolute distance, a triple loss function based on ratio is proposed in the embodiment of the present application. Different from the triple loss function based on absolute distance, which constrains the difference between the feature distance of negative samples and the feature distance of positive samples, the triple loss function based on ratio constrains the ratio of the feature distance of positive samples to the feature distance of negative samples to be less than a preset ratio threshold, and its corresponding formula is as follows:

[0066]

[0067] Among them, β is the ratio threshold, L triplet_ratio is the ratio-based triplet loss function.

[0068] Accordingly, under the strategy of hard example mining, the formula of the ratio-based triple loss function is:

[0069]

[0070] In a specific implementation of an embodiment of the present application, β is a constant, and its specific value can be set according to actual conditions. For example, it can be set to 0.5 or other values, and the embodiment of the present application does not make specific limitations on this.

[0071] The following is a comparison of the triplet loss function based on absolute distance and the triplet loss function based on ratio based on three cases:

[0072] In the first case, when faced with a scenario where the inter-class differences are small and the intra-class differences are large, e.g. Figure 1For the triplet images in (a) and (d), the training process of the ratio-based triplet loss function is more stable and robust than that of the absolute distance-based triplet loss function. For example, when the value of β is set to 0.5, since the negative sample image is very similar to the reference image, the value of the negative sample feature distance is 0.5. At this time, the ratio-based triplet loss function requires the value of the positive sample feature distance to be less than 0.25 to meet the constraint condition. In contrast, the absolute distance-based triplet loss function requires the value of the positive sample feature distance to be less than 0.10 (α is 0.4).

[0073] The second case is when facing scenarios where both inter-class differences and intra-class differences are relatively mild, e.g. Figure 1 For the triplet images in (b) and (e), the negative sample feature distance is 0.7. The triplet loss function based on absolute distance requires the positive sample feature distance to be less than 0.3 (α is 0.4), while the triplet loss function based on ratio requires the positive sample feature distance to be less than 0.35 (β is 0.5). Due to the reduced constraints on inter-class differences, the triplet loss function based on ratio may damage the intra-class compactness in this case.

[0074] The third case is when facing a scenario where the inter-class differences are large (i.e., the distinction between different pedestrians is high) and the intra-class differences are small, e.g. Figure 1 For the triplet images in (c) and (f), since the feature distance of the negative samples is large enough and the feature distance of the positive samples is small enough, the constraints of the triplet loss function based on absolute distance and the triplet loss function based on ratio are met.

[0075] From the above analysis, we can see that when the inter-class difference is very small, the ratio-based triplet loss function will appropriately relax the constraints on the feature distance of the positive samples, thereby improving the stability of training; when both the inter-class difference and the intra-class difference are relatively mild, the ratio-based triplet loss function will destroy the intra-class compactness.

[0076] Therefore, in another specific implementation of the embodiment of the present application, the ratio-based triplet loss function can be further improved, and β is no longer used as a constant, but as a variable, which can be adaptively changed as the feature distance of the negative sample changes. The formula of the ratio-based triplet loss function is as follows:

[0077]

[0078]

[0079] Among them, F is the preset function relationship, β1 is the preset ratio threshold lower limit, β2 is the preset ratio threshold lower limit, is the preset lower distance limit, The preset upper limit of the distance, the specific values ​​of these hyperparameters can be set according to the actual situation, and the embodiments of the present application do not make specific limitations on this.

[0080] Accordingly, under the strategy of hard example mining, the formula of the ratio-based triple loss function is:

[0081]

[0082] After this improvement, β becomes Figure 2 The piecewise function shown in . When the value of the negative sample feature distance is large, the value of β becomes smaller accordingly to maintain a strong constraint on the positive sample feature distance and not destroy the intra-class compactness; when the value of the negative sample feature distance is small, the value of β becomes larger accordingly, thereby relaxing the constraint on the positive sample feature distance and maintaining the stability of training.

[0083] During the model training process of the pedestrian re-identification model, any of the above-mentioned ratio-based triplet loss functions can be used to obtain a pedestrian re-identification model with stronger discriminability and robustness to image features.

[0084] After obtaining the person re-identification model, we can apply it to the actual person re-identification task. Figure 3 , an embodiment of a pedestrian re-identification method in the embodiment of the present application may include:

[0085] Step S301: Obtain a pedestrian re-identification task to be processed.

[0086] Step S302: Use the pedestrian re-identification model to process the pedestrian re-identification task to obtain a pedestrian re-identification result.

[0087] In summary, the loss function used in the model training process of the embodiment of the present application is a preset ratio-based triplet loss function; the ratio-based triplet loss function constrains the ratio of the positive sample feature distance to the negative sample feature distance to be less than a preset ratio threshold; the positive sample feature distance is the distance between the reference image feature and the positive sample image feature; the negative sample feature distance is the distance between the reference image feature and the negative sample image feature. When faced with a scenario where the inter-class difference is very small and the intra-class difference is very large, the ratio-based triplet loss function can effectively improve the stability of the model training compared to the absolute distance-based triplet loss function in the prior art, and the features extracted by the trained model are more discriminative and robust, thereby improving the accuracy of the pedestrian re-identification results.

[0088] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0089] Corresponding to the pedestrian re-identification method described in the above embodiment, Figure 4 A structural diagram of an embodiment of a pedestrian re-identification device provided in an embodiment of the present application is shown.

[0090] In this embodiment, a pedestrian re-identification device may include:

[0091] A task acquisition module 401 is used to acquire a pedestrian re-identification task to be processed;

[0092] The pedestrian re-identification module 402 is used to use a preset pedestrian re-identification model to process the pedestrian re-identification task to obtain a pedestrian re-identification result; wherein the loss function used by the pedestrian re-identification model in the model training process is a preset ratio-based triplet loss function; the ratio-based triplet loss function constrains the ratio of the positive sample feature distance to the negative sample feature distance to be less than a preset ratio threshold; the positive sample feature distance is the distance between the reference image feature and the positive sample image feature; the negative sample feature distance is the distance between the reference image feature and the negative sample image feature.

[0093] In a specific implementation of the embodiment of the present application, the ratio-based triplet loss function may be:

[0094]

[0095] Among them, N tp is the number of triples, i is the serial number subscript, f a 、f p and f n are the benchmark image features, positive sample image features and negative sample image features respectively, D is the distance function, β is the ratio threshold, {*} + =max{*,0}, max is the maximum value function, L triplet_ratio is the ratio-based triplet loss function.

[0096] In a specific implementation of the embodiment of the present application, the ratio threshold may be a variable and satisfies:

[0097]

[0098] in, β1 is the preset ratio threshold lower limit, β2 is the preset ratio threshold lower limit, is the preset lower distance limit, is the preset upper limit of distance, and F is the preset functional relationship.

[0099] In a specific implementation of the embodiment of the present application, the ratio threshold may also be a constant.

[0100] In another specific implementation of the embodiment of the present application, the ratio-based triplet loss function may be:

[0101]

[0102] Among them, N tp is the number of triples, i and j are serial subscripts, and f a 、f p and f n are the benchmark image features, positive sample image features and negative sample image features respectively, D is the distance function, β is the ratio threshold, {*} + =max{*, 0}, max is the maximum value function, min is the minimum value function, P and A are the number of pedestrians in a training batch and the number of images of each pedestrian, respectively, L triplet_ratio is the ratio-based triplet loss function.

[0103] In another specific implementation of the embodiment of the present application, the ratio threshold may be a variable and satisfies:

[0104]

[0105] in, β1 is the preset ratio threshold lower limit, β2 is the preset ratio threshold lower limit, is the preset lower distance limit, is the preset upper limit of distance, and F is the preset functional relationship.

[0106] In another specific implementation of the embodiment of the present application, the ratio threshold may also be a constant.

[0107] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices, modules and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0108] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0109] Figure 5 A schematic block diagram of a terminal device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.

[0110] like Figure 5 As shown, the terminal device 5 of this embodiment includes: a processor 50, a memory 51, and a computer program 52 stored in the memory 51 and executable on the processor 50. When the processor 50 executes the computer program 52, the steps in the above-mentioned various pedestrian re-identification method embodiments are implemented, such as Figure 3 Alternatively, when the processor 50 executes the computer program 52, the functions of each module / unit in the above-mentioned device embodiments are realized, for example Figure 4 The functions of modules 401 to 402 are shown.

[0111] Exemplarily, the computer program 52 may be divided into one or more modules / units, which are stored in the memory 51 and executed by the processor 50 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 52 in the terminal device 5.

[0112] The terminal device 5 can be a computing device such as a mobile phone, a tablet computer, a desktop computer, a notebook, a PDA, a robot, etc. Those skilled in the art will understand that Figure 5 It is only an example of the terminal device 5 and does not constitute a limitation of the terminal device 5. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal device 5 may also include input and output devices, network access devices, buses, etc.

[0113] The processor 50 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0114] The memory 51 may be an internal storage unit of the terminal device 5, such as a hard disk or memory of the terminal device 5. The memory 51 may also be an external storage device of the terminal device 5, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 5. Further, the memory 51 may also include both an internal storage unit of the terminal device 5 and an external storage device. The memory 51 is used to store the computer program and other programs and data required by the terminal device 5. The memory 51 may also be used to temporarily store data that has been output or is to be output.

[0115] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0116] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0117] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0118] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0119] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0120] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0121] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media do not include electric carrier signals and telecommunication signals.

[0122] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A pedestrian re-identification method, characterized in that: include: Get the pending person re-identification task; Using a preset pedestrian re-identification model to process the pedestrian re-identification task to obtain a pedestrian re-identification result; Among them, the loss function used by the pedestrian re-identification model during the model training process is a preset ratio-based triplet loss function; the ratio-based triplet loss function constrains the ratio of the positive sample feature distance to the negative sample feature distance to be less than a preset ratio threshold; the positive sample feature distance is the distance between the reference image feature and the positive sample image feature; the negative sample feature distance is the distance between the reference image feature and the negative sample image feature; the ratio threshold is a variable, and the ratio threshold is negatively correlated with the negative sample feature distance.

2. The pedestrian re-identification method according to claim 1, characterized in that: The ratio-based triplet loss function is: Among them, N tp is the number of triples, i is the serial number subscript, f a 、f p and f n are the reference image features, positive sample image features and negative sample image features respectively, D is the distance function, β is the ratio threshold, {*} + =max{*,0}, max is the maximum value function, L triplet_ratio is the ratio-based triplet loss function.

3. The pedestrian re-identification method according to claim 2, characterized in that: The ratio threshold satisfies: in, β1 is the preset ratio threshold lower limit, β2 is the preset ratio threshold lower limit, is the preset lower distance limit, is the preset upper limit of distance, and F is the preset functional relationship.

4. The pedestrian re-identification method according to claim 1, characterized in that: The ratio-based triplet loss function is: Among them, N tp is the number of triples, i and j are serial subscripts, and f a 、f p and f n are the benchmark image features, positive sample image features and negative sample image features respectively, D is the distance function, β is the ratio threshold, {*} + =max{*, 0}, max is the maximum value function, min is the minimum value function, P and A are the number of pedestrians in a training batch and the number of images of each pedestrian, respectively, L triplet_ratio is the ratio-based triplet loss function.

5. The pedestrian re-identification method according to claim 4, characterized in that: The ratio threshold satisfies: in, β1 is the preset ratio threshold lower limit, β2 is the preset ratio threshold lower limit, is the preset lower distance limit, is the preset upper limit of distance, and F is the preset functional relationship.

6. A pedestrian re-identification device, characterized in that: include: A task acquisition module is used to obtain pending person re-identification tasks; A pedestrian re-identification module is used to process the pedestrian re-identification task using a preset pedestrian re-identification model to obtain a pedestrian re-identification result; wherein the loss function used by the pedestrian re-identification model in the model training process is a preset ratio-based triplet loss function; the ratio-based triplet loss function constrains the ratio of the positive sample feature distance to the negative sample feature distance to be less than a preset ratio threshold; the positive sample feature distance is the distance between the reference image feature and the positive sample image feature; the negative sample feature distance is the distance between the reference image feature and the negative sample image feature; the ratio threshold is a variable, and the ratio threshold is negatively correlated with the negative sample feature distance.

7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the pedestrian re-identification method according to any one of claims 1 to 5 are implemented.

8. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the pedestrian re-identification method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Pedestrian re-identification method and device based on self-supervised learning, equipment and storage medium

    CN114529946A

  • Expression recognition method and system

    CN114529969A