Target detection method, target detection system, device and readable storage medium
By calculating the difference between the loss function of the RPN layer and the target detection layer on the client to determine the required parameters, and uploading only these parameters to the server, the problem of low model aggregation efficiency of the Faster R-CNN target detection model in the federated learning framework is solved. , achieving the effect of reducing server calculations and improving model aggregation efficiency.
Patent Information
- Application Number
- CN201910919207.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-09-26
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2039-09-26
AI Technical Summary
When the existing Faster R-CNN object detection model aggregation in the federated learning framework, there are efficiency problems, especially due to the different processing methods and concerns of the RPN layer and the object detection layer, a large number of invalid parameters need to be uploaded to the server, and the increase The calculation amount and calculation time of the server.
The client determines the target detection model and loss function list based on the training samples and the initial detection model, calculates the difference in the loss function between the RPN layer and the target detection layer to determine the required parameters, and only uploads these parameters to the server, and the server calculates the parameters average and feed back the final target detection model.
It reduces the calculation amount and calculation time of the server, improves the efficiency of model aggregation, and does not affect the performance of the target detection model.
Smart Images

Figure CN110705627B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of machine learning technology, and in particular to a target detection method, a target detection system, a device and a readable storage medium. Background Art
[0002] Faster R-CNN is a very popular target detection model. The loss function of the entire network structure consists of two parts: the RPN layer loss for finding candidate regions and the loss function of the final target detection layer.
[0003] When the Faster R-CNN model is currently placed in the federated learning framework for training, the client will perform local model training and aggregate on the server. This indifferent training mode is suitable for most network models. The loss functions of these two parts actually have different processing methods and focuses for image input. For example, the RPN layer is more concerned with how to select reasonable candidate areas, while the object detection layer is concerned with the accuracy of category classification and bounding boxes. Each layer will have a large number of invalid parameters. If all parameters are uploaded to the server, this will increase the server's computing workload and computing time. Summary of the invention
[0004] The main purpose of the present invention is to provide a target detection method, a target detection system, a device and a readable storage medium, aiming to solve the technical problem of the efficiency of the existing Faster R-CNN target detection model when performing model aggregation.
[0005] To achieve the above object, the present invention provides a target detection method, which comprises the following steps:
[0006] The client determines a target detection model and a loss function list based on the training samples and the initial detection model;
[0007] The client determines required parameters corresponding to the target detection model based on the loss function list;
[0008] The client sends the required parameters to the server, so that the server sends the final target detection model to the client;
[0009] The client determines a target detection result corresponding to the sample to be detected based on the final target detection model.
[0010] Further, in one embodiment, the step of the client determining the required parameters corresponding to the target detection model based on the loss function list includes:
[0011] The client calculates a first difference corresponding to the RPN layer loss function and a second difference corresponding to the target detection layer loss function based on the loss function list, wherein the first difference is the difference between the largest RPN layer loss function value and the smallest RPN layer loss function value in the loss function list, and the second difference is the difference between the largest target detection layer loss function value and the smallest target detection layer loss function value in the loss function list;
[0012] The client determines required parameters corresponding to the target detection model based on the first difference and the second difference.
[0013] Further, in one embodiment, the step of the client determining required parameters corresponding to the target detection model based on the first difference and the second difference includes:
[0014] When the first difference is greater than the second difference, the client subtracts the first difference from the second difference to obtain a third difference;
[0015] When the third difference is greater than or equal to a preset value, the client uses the RPN layer parameters in the target detection model as the required parameters;
[0016] When the third difference is less than a preset value, the client uses the RPN layer parameters and the target detection layer parameters in the target detection model as required parameters.
[0017] Furthermore, in one embodiment, the step of determining, by the client, required parameters corresponding to the target detection model based on the first difference and the second difference further includes:
[0018] When the second difference is greater than the first difference, the client subtracts the second difference from the first difference to obtain a fourth difference;
[0019] When the fourth difference is greater than or equal to a preset value, the client uses the target detection layer parameters in the target detection model as the required parameters;
[0020] When the fourth difference is less than a preset value, the client uses the RPN layer parameters and the target detection layer parameters in the target detection model as required parameters.
[0021] Further, in one embodiment, after the step of the client sending the required parameters to the server so that the server sends the final object detection model to the client, the method further includes:
[0022] When receiving the required parameters sent by each client, the server determines the parameter type corresponding to each required parameter, wherein the parameter type includes RPN layer parameters and target detection layer parameters;
[0023] The server determines parameter means corresponding to each parameter type based on the required parameters, and determines parameters corresponding to the final target detection model based on the parameter means.
[0024] Further, in one embodiment, the initial detection model is a Faster R-CNN model, the Faster R-CNN model includes an RPN layer and a target detection layer, and the step of determining the target detection model and the loss function list based on the training sample and the initial detection model by the client includes:
[0025] The client trains the initial detection model based on the training sample, and obtains an RPN layer loss function corresponding to the initial detection model and a target detection layer loss function corresponding to the initial detection model;
[0026] The client generates the loss function list based on the RPN layer loss function and the target detection layer loss function;
[0027] The client determines whether the initial detection model converges;
[0028] If the initial detection model converges, the client determines that the initial detection model is the target detection model.
[0029] Furthermore, in one embodiment, after the step of the client determining whether the initial detection model has converged, the method further includes:
[0030] If the initial detection model does not converge, the client updates the model parameters of the initial detection model;
[0031] Based on the updated model parameters, the initial detection model is updated, and the client continues to train the initial detection model based on the training samples to obtain the RPN layer loss function corresponding to the initial detection model and the target detection layer loss function corresponding to the initial detection model.
[0032] Furthermore, in one embodiment, the target detection device includes:
[0033] A determination module, used to determine a target detection model and a loss function list based on training samples and an initial detection model;
[0034] A processing module, used to determine the required parameters corresponding to the target detection model based on the loss function list;
[0035] A sending module, used for sending the required parameters to the server, so that the server sends the final target detection model to the client;
[0036] The detection module is used to determine the target detection result corresponding to the sample to be detected based on the final target detection model.
[0037] In addition, to achieve the above-mentioned purpose, the present invention also provides a target detection system, which includes: a memory, a processor, and a target detection program stored in the memory and executable on the processor, and when the target detection program is executed by the processor, the steps of any one of the target detection methods described above are implemented.
[0038] In addition, to achieve the above-mentioned purpose, the present invention also provides a readable storage medium, on which a target detection program is stored. When the target detection program is executed by a processor, the steps of any of the target detection methods described above are implemented.
[0039] The present invention determines the target detection model and the loss function list based on the training sample and the initial detection model by the client, and then the client determines the required parameters corresponding to the target detection model based on the loss function list, and then the client sends the required parameters to the server so that the server sends the final target detection model to the client, and finally the client determines the target detection result corresponding to the sample to be detected based on the final target detection model. According to the loss function, the effective model parameters of the client are selected for model aggregation without transmitting all the parameters, which can reduce the calculation amount and calculation time of the server, and greatly improve the efficiency of model aggregation without affecting the performance of the target detection model. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 It is a schematic diagram of the structure of a target detection system in a hardware operating environment involved in an embodiment of the present invention;
[0041] Figure 2 It is a flowchart of the first embodiment of the target detection method of the present invention;
[0042] Figure 3 A schematic diagram of a flow chart of a second embodiment of a target detection method of the present invention;
[0043] Figure 4 Schematic diagram of functional modules of an embodiment of a target detection device of the present invention.
[0044] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0045] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0046] like Figure 1 As shown, Figure 1 It is a schematic diagram of the structure of a target detection system in a hardware operating environment involved in an embodiment of the present invention.
[0047] like Figure 1 As shown, the target detection system may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0048] Those skilled in the art will understand that Figure 1 The target detection system structure shown in the figure does not constitute a limitation on the terminal, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0049] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a picture processing program.
[0050] exist Figure 1 In the terminal shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the processor 1001 can be used to call the image processing program stored in the memory 1005.
[0051] In this embodiment, the target detection system includes: a memory 1005, a processor 1001, and a target detection program stored in the memory 1005 and executable on the processor 1001, wherein when the processor 1001 calls the target detection program stored in the memory 1005, it executes the steps of the target detection method provided in each embodiment of the present application.
[0052] The present invention also provides a target detection method, referring to Figure 2 , Figure 2 FIG. 4 is a flow chart of a first embodiment of a target detection method according to the present invention.
[0053] The embodiments of the present invention provide embodiments of the target detection method. It should be noted that although a logical order is shown in the flow chart, in some cases, the steps shown or described may be performed in an order different from that shown here.
[0054] In this embodiment, the target detection method includes:
[0055] Step S10, the client determines a target detection model and a loss function list based on the training sample and the initial detection model;
[0056] In this embodiment, target detection is a kind of image segmentation based on target geometry and statistical features. It combines the segmentation and recognition of targets into one. Its accuracy and real-time performance are an important capability of the entire system. Especially in complex scenes, when multiple targets need to be processed in real time, automatic target extraction and recognition are particularly important. Target detection has been widely used in the fields of video surveillance, self-driving cars, human tracking, etc. Target detection locates the presence of a target in an image and draws a bounding box around the target. This usually includes two processes: predicting the type of target and then drawing a box around the target.
[0057] Furthermore, Faster R-CNN is a common model architecture for target detection. The Faster R-CNN model consists of two modules: a deep convolutional network (RPN layer) responsible for proposing regions and a Fast R-CNN detector (target detection layer) using these regions. The Region Proposal Network, also known as the RPN layer, takes an image as input and generates an output of rectangular target candidates, each of which has an objectness score. The target detection method of the present invention is applied to a target detection system, which includes multiple clients and a server. Each client performs local model training based on training samples and an initial detection model, and then uploads the local model parameters of the client to the server for aggregation, wherein the main parameters in the model parameters include RPN layer parameters and target detection layer parameters. Specifically, each client in the system trains the initial detection model corresponding to the client based on its own training samples, and then determines the target detection model corresponding to the client and a loss function list, wherein the RPN layer loss function and the target detection layer loss function are stored in the loss function list.
[0058] Specifically, step S10 includes:
[0059] Step a, the client trains the initial detection model based on the training sample, and obtains the RPN layer loss function corresponding to the initial detection model and the target detection layer loss function corresponding to the initial detection model;
[0060] In this embodiment, the initial detection model of the client is a Faster R-CNN model, which includes an RPN layer and a target detection layer. The client performs model training on the initial detection model according to a preset training sample. During the model training process, the RPN layer loss function and the target detection layer loss function can be obtained. It should be noted that the model training is carried out through multiple rounds of training. The RPN layer loss function and the target detection layer loss function are different in each round of training. Usually, they become smaller and smaller until the loss function converges. That is to say, when the training sample is used for model training for the first time, the RPN layer loss function value and the target detection layer loss function value are both the largest. When the model converges, the RPN layer loss function value and the target detection layer loss function value are both the smallest.
[0061] Step b, the client generates the loss function list based on the RPN layer loss function and the target detection layer loss function;
[0062] In this embodiment, the client performs multiple rounds of training on the initial detection model according to preset training samples. In each round of training, the RPN layer loss function value and the target detection layer loss function value are obtained, and the two loss function values are saved in the loss function list. If N rounds of iterations are performed, N RPN layer loss function values and N target detection layer loss function values will be saved, and the N RPN layer loss function values are different, and the N target detection layer loss function values are also different.
[0063] Step c, the client determines whether the initial detection model converges;
[0064] In this embodiment, at the end of each round of training of the initial detection model according to the preset training samples, the client will determine whether the model has converged based on the loss function value of the model. If the loss function value of the model is less than a preset value, the model can be considered to have converged. The preset value is determined based on the actual situation and is not limited in the present invention. Another method to judge the convergence of the model is that when the loss function value of the model no longer changes during the next round of model training, it means that the model has converged at this time.
[0065] Step d: if the initial detection model converges, the client determines that the initial detection model is the target detection model.
[0066] In this embodiment, when the client determines that the model has converged based on the loss function of the model, it means that the model training is completed and there is no need for the next round of model training. The current initial detection model is the target detection model after model training.
[0067] Step e: if the initial detection model does not converge, the client updates the model parameters of the initial detection model;
[0068] In this embodiment, when the client determines that the model has not converged based on the loss function of the model, it means that the model training is not completed and the next round of model training is still needed. At this time, the system parameters of the model are updated according to the preset principles of updating the model parameters, and then the next round of model training is carried out.
[0069] Step f, based on the updated model parameters, update the initial detection model, and continue to execute the step of the client training the initial detection model based on the training sample to obtain the RPN layer loss function corresponding to the initial detection model and the target detection layer loss function corresponding to the initial detection model.
[0070] In this embodiment, after the system parameters of the model are updated, the client continues to use the preset training samples to perform model training on the updated initial detection model, and during the model training process, continues to obtain the RPN layer loss function value and the target detection layer loss function value, save them to the loss function list, and perform subsequent operations.
[0071] Step S20, the client determines required parameters corresponding to the target detection model based on the loss function list;
[0072] In this embodiment, after the model training is completed, the client obtains the maximum RPN layer loss function value and the minimum RPN layer loss function value in the loss function list, and calculates the difference between the maximum RPN layer loss function value and the minimum RPN layer loss function value, which is defined as the first difference. At the same time, the maximum target detection layer loss function value and the minimum target detection layer loss function value are obtained, and the difference between the maximum target detection layer loss function value and the minimum target detection layer loss function value is calculated, which is defined as the second difference. Then, based on the comparison of the two differences, the required parameters corresponding to the target detection model are determined.
[0073] It should be noted that if the first difference is greater than the second difference, and the difference is relatively large, it means that the loss of the RPN layer is more obvious than the loss of the target detection layer, and the RPN layer parameters are used as the required parameters. Similarly, if the second difference is greater than the first difference, and the difference is relatively large, it means that the loss of the target detection layer is more obvious than the loss of the RPN layer, and the target detection layer parameters are used as the required parameters. In other words, each client determines whether it needs to upload the RPN layer parameters or the target detection layer parameters based on the changes in its own RPN layer loss function and the target detection layer loss function, which greatly reduces the amount of calculation on the server side and improves the efficiency of model generation.
[0074] Step S30, the client sends the required parameters to the server, so that the server sends the final object detection model to the client;
[0075] In this embodiment, after the client determines the required parameters corresponding to the client's target detection model based on the comparison relationship between the first difference and the second difference, the client sends the required parameters to the server for aggregation, and then uses the aggregated parameters as the model parameters of the final target detection model. The server then feeds the final target detection model back to the client.
[0076] Step S40: The client determines the target detection result corresponding to the sample to be detected based on the final target detection model.
[0077] In this embodiment, after receiving the final target detection model fed back by the server, the client can use the final target detection model to perform target detection operations. When the client detects a sample to be detected and a target detection command that requires target detection, the sample to be detected is used as the input of the final target detection model, and the target detection operation is performed, and then the final target detection model outputs the target detection result corresponding to the sample to be detected.
[0078] Furthermore, in one embodiment, after step S40, the following steps are further included:
[0079] Step S50, when receiving the required parameters sent by each client, the server determines the parameter type corresponding to each required parameter, wherein the parameter type includes RPN layer parameters and target detection layer parameters;
[0080] In this embodiment, the target detection system includes multiple clients, and each client performs its own model training based on the training samples and the initial detection model. When the model training is completed and the required parameters of each client are determined, each client sends its own required parameters to the server. When the server receives the required parameters sent by each terminal, it further determines the parameter types corresponding to these required parameters, where the parameter types include RPN layer parameters and target detection layer parameters.
[0081] Step S60: The server determines the parameter means corresponding to each parameter type based on the required parameters, and determines the parameters corresponding to the final target detection model based on the parameter means.
[0082] In this embodiment, the parameter types include RPN layer parameters and target detection layer parameters, and the server will receive all the required parameters and divide them into two categories, namely, RPN layer parameters and target detection layer parameters, and then respectively obtain the mean of multiple RPN layer parameters and the mean of multiple target detection layer parameters. Then, the mean of the RPN layer parameters is used as the RPN layer parameters corresponding to the final target detection model, and the mean of the target detection layer parameters is used as the target detection layer parameters corresponding to the final target detection model.
[0083] The target detection method proposed in this embodiment is that the client determines the target detection model and the loss function list based on the training sample and the initial detection model, and then the client determines the required parameters corresponding to the target detection model based on the loss function list, and then the client sends the required parameters to the server so that the server sends the final target detection model to the client, and finally the client determines the target detection result corresponding to the sample to be detected based on the final target detection model. According to the loss function, the effective model parameters of the client are selected for model aggregation without transmitting all parameters, which can reduce the calculation amount and calculation time of the server, and greatly improve the efficiency of model aggregation without affecting the performance of the target detection model.
[0084] Based on the first embodiment, refer to Figure 3 , a second embodiment of the target detection method of the present invention is proposed. In this embodiment, step S20 includes:
[0085] Step S21, the client calculates a first difference corresponding to the RPN layer loss function and a second difference corresponding to the target detection layer loss function based on the loss function list, wherein the first difference is the difference between the largest RPN layer loss function value and the smallest RPN layer loss function value in the loss function list, and the second difference is the difference between the largest target detection layer loss function value and the smallest target detection layer loss function value in the loss function list;
[0086] In this embodiment, the client performs multiple rounds of training on the initial detection model according to preset training samples. In each round of training, the RPN layer loss function value and the target detection layer loss function value are obtained, and the two loss function values are saved in the loss function list. After the model training is completed, the client obtains the maximum RPN layer loss function value and the minimum RPN layer loss function value in the loss function list, and calculates the difference between the maximum RPN layer loss function value and the minimum RPN layer loss function value, which is defined as the first difference. At the same time, the maximum target detection layer loss function value and the minimum target detection layer loss function value are obtained, and the difference between the maximum target detection layer loss function value and the minimum target detection layer loss function value is calculated, which is defined as the second difference.
[0087] Step S22: The client determines required parameters corresponding to the target detection model based on the first difference and the second difference.
[0088] In this embodiment, the client determines the required parameters corresponding to the target detection model based on the first difference and the second difference. If the first difference is greater than the second difference and the difference is relatively large, it means that the loss of the RPN layer is more obvious than the loss of the target detection layer. Similarly, if the second difference is greater than the first difference and the difference is relatively large, it means that the loss of the target detection layer is more obvious than the loss of the RPN layer.
[0089] Specifically, step S22 includes:
[0090] Step g: when the first difference is greater than the second difference, the client subtracts the first difference from the second difference to obtain a third difference;
[0091] Step h: when the third difference is greater than or equal to a preset value, the client uses the RPN layer parameters in the target detection model as the required parameters;
[0092] Step i: when the third difference is less than a preset value, the client uses the RPN layer parameters and the target detection layer parameters in the target detection model as the required parameters.
[0093] In this embodiment, the first difference and the second difference are further compared. When the first difference is greater than the second difference, the first difference is subtracted from the second difference, and their difference is recorded as the third difference. It should be noted that the RPN layer loss function is different from the target detection layer loss function, so the first difference corresponding to the RPN layer loss function and the second difference corresponding to the target detection layer loss function are not completely equal.
[0094] Furthermore, the preset value is a value determined according to the actual situation, and is used to evaluate the closeness between the first difference and the second difference, that is, to determine which layer's loss change is more obvious in the RPN layer loss function and the target detection layer loss function. When the third difference is greater than or equal to the preset value, that is, the difference between the first difference and the second difference is relatively large, it means that the loss of the RPN layer is more obvious than the loss of the target detection layer. At this time, the client uses the RPN layer parameters as the required parameters; when the third difference is less than the preset value, that is, the difference between the first difference and the second difference is not large, it means that the loss of the RPN layer is equivalent to the loss of the target detection layer. At this time, the client uses both the RPN layer parameters and the target detection layer parameters as the required parameters.
[0095] Step k: when the second difference is greater than the first difference, the client subtracts the second difference from the first difference to obtain a fourth difference;
[0096] Step 1: When the fourth difference is greater than or equal to a preset value, the client uses the target detection layer parameters in the target detection model as the required parameters;
[0097] Step m: when the fourth difference is less than a preset value, the client uses the RPN layer parameters and the target detection layer parameters in the target detection model as the required parameters.
[0098] In this embodiment, the first difference and the second difference are further compared. When the second difference is greater than the first difference, the second difference is subtracted from the first difference, and their difference is recorded as the fourth difference.
[0099] Furthermore, the preset value is a value determined according to the actual situation, and is used to evaluate the closeness between the first difference and the second difference, that is, to determine which layer has a more obvious loss change in the RPN layer loss function and the target detection layer loss function. When the fourth difference is greater than or equal to the preset value, that is, the second difference is quite different from the first difference, it means that the loss of the target detection layer is more obvious than the loss of the RPN layer. At this time, the client uses the target detection layer parameters as the required parameters; when the fourth difference is less than the preset value, that is, the first difference is not much different from the second difference, it means that the loss of the RPN layer is equivalent to the loss of the target detection layer. At this time, the client uses both the RPN layer parameters and the target detection layer parameters as the required parameters.
[0100] The target detection method proposed in this embodiment calculates the first difference corresponding to the RPN layer loss function and the second difference corresponding to the target detection layer loss function based on the loss function list by the client, wherein the first difference is equal to the difference between the largest RPN layer loss function value and the smallest RPN layer loss function value in the loss function list, and the second difference is equal to the difference between the largest target detection layer loss function value and the smallest target detection layer loss function value in the loss function list, and then the client determines the required parameters corresponding to the target detection model based on the first difference and the second difference. The loss of the target detection layer and the RPN layer are compared according to the first difference and the second difference, and then the required parameters of each client are accurately determined according to the comparison result, without transmitting all the parameters, which can reduce the calculation amount and calculation time of the server, and reduce the number of client parameter uploads, thereby reducing the calculation amount on the server side and improving the model generation efficiency.
[0101] The present invention further provides a target detection device, referring to Figure 4 , Figure 4 Schematic diagram of functional modules of an embodiment of a target detection device of the present invention.
[0102] A determination module 10, used to determine a target detection model and a loss function list based on the training sample and the initial detection model;
[0103] A processing module 20, configured to determine required parameters corresponding to the target detection model based on the loss function list;
[0104] A sending module 30, configured to send the required parameters to the server, so that the server sends the final target detection model to the client;
[0105] The detection module 40 is used to determine the target detection result corresponding to the sample to be detected based on the final target detection model.
[0106] Furthermore, the processing module 20 is also used for:
[0107] The client calculates a first difference corresponding to the RPN layer loss function and a second difference corresponding to the target detection layer loss function based on the loss function list, wherein the first difference is the difference between the largest RPN layer loss function value and the smallest RPN layer loss function value in the loss function list, and the second difference is the difference between the largest target detection layer loss function value and the smallest target detection layer loss function value in the loss function list;
[0108] The client determines required parameters corresponding to the target detection model based on the first difference and the second difference.
[0109] Furthermore, the processing module 20 is also used for:
[0110] When the first difference is greater than the second difference, the client subtracts the first difference from the second difference to obtain a third difference;
[0111] When the third difference is greater than or equal to a preset value, the client uses the RPN layer parameters in the target detection model as the required parameters;
[0112] When the third difference is less than a preset value, the client uses the RPN layer parameters and the target detection layer parameters in the target detection model as required parameters.
[0113] Furthermore, the processing module 20 is also used for:
[0114] When the second difference is greater than the first difference, the client subtracts the second difference from the first difference to obtain a fourth difference;
[0115] When the fourth difference is greater than or equal to a preset value, the client uses the target detection layer parameters in the target detection model as the required parameters;
[0116] When the fourth difference is less than a preset value, the client uses the RPN layer parameters and the target detection layer parameters in the target detection model as required parameters.
[0117] Furthermore, the target detection device further includes:
[0118] A classification module, configured to determine, upon receiving the required parameters sent by each client, a parameter type corresponding to each required parameter, wherein the parameter type includes an RPN layer parameter and a target detection layer parameter;
[0119] A clustering module is used to determine the parameter means corresponding to each parameter type based on the required parameters, and determine the parameters corresponding to the final target detection model based on the parameter means.
[0120] Furthermore, the determining module 10 is also used for:
[0121] The client trains the initial detection model based on the training sample, and obtains an RPN layer loss function corresponding to the initial detection model and a target detection layer loss function corresponding to the initial detection model;
[0122] The client generates the loss function list based on the RPN layer loss function and the target detection layer loss function;
[0123] The client determines whether the initial detection model converges;
[0124] If the initial detection model converges, the client determines that the initial detection model is the target detection model.
[0125] Furthermore, the determining module 10 is also used for:
[0126] If the initial detection model does not converge, the client updates the model parameters of the initial detection model;
[0127] Based on the updated model parameters, the initial detection model is updated, and the client continues to train the initial detection model based on the training samples to obtain the RPN layer loss function corresponding to the initial detection model and the target detection layer loss function corresponding to the initial detection model.
[0128] In addition, an embodiment of the present invention further proposes a readable storage medium, on which a target detection program is stored. When the target detection program is executed by a processor, the steps of the target detection method in the above-mentioned embodiments are implemented.
[0129] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0130] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0131] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for enabling a system device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0132] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A target detection method, applied to a target detection system, wherein the target detection system comprises a server and a plurality of clients, characterized in that: The target detection method comprises the following steps: The client determines a target detection model and a loss function list based on the training samples and the initial detection model; The client determines required parameters corresponding to the target detection model based on the loss function list; The client sends the required parameters to the server, so that the server sends the final target detection model to the client; The client determines the target detection result corresponding to the sample to be detected based on the final target detection model; The step of the client determining the required parameters corresponding to the target detection model based on the loss function list includes: The client calculates a first difference corresponding to the RPN layer loss function and a second difference corresponding to the target detection layer loss function based on the loss function list, wherein the first difference is the difference between the largest RPN layer loss function value and the smallest RPN layer loss function value in the loss function list, and the second difference is the difference between the largest target detection layer loss function value and the smallest target detection layer loss function value in the loss function list; The client determines required parameters corresponding to the target detection model based on the first difference and the second difference; After the step of the client sending the required parameters to the server so that the server sends the final target detection model to the client, the method further includes: When receiving the required parameters sent by each client, the server determines the parameter type corresponding to each required parameter, wherein the parameter type includes RPN layer parameters and target detection layer parameters; The server determines parameter means corresponding to each parameter type based on the required parameters, and determines parameters corresponding to the final target detection model based on the parameter means.
2. The target detection method according to claim 1, characterized in that: The step of determining, by the client, required parameters corresponding to the target detection model based on the first difference and the second difference comprises: When the first difference is greater than the second difference, the client subtracts the first difference from the second difference to obtain a third difference; When the third difference is greater than or equal to a preset value, the client uses the RPN layer parameters in the target detection model as the required parameters; When the third difference is less than a preset value, the client uses the RPN layer parameters and the target detection layer parameters in the target detection model as required parameters.
3. The target detection method according to claim 1, characterized in that: The step of determining, by the client, required parameters corresponding to the target detection model based on the first difference and the second difference further includes: When the second difference is greater than the first difference, the client subtracts the second difference from the first difference to obtain a fourth difference; When the fourth difference is greater than or equal to a preset value, the client uses the target detection layer parameters in the target detection model as the required parameters; When the fourth difference is less than a preset value, the client uses the RPN layer parameters and the target detection layer parameters in the target detection model as required parameters.
4. The target detection method according to any one of claims 1 to 3, characterized in that: The initial detection model is a Faster R-CNN model, and the Faster R-CNN model includes an RPN layer and a target detection layer. The client determines the target detection model and the loss function list based on the training sample and the initial detection model, including: The client trains the initial detection model based on the training sample, and obtains an RPN layer loss function corresponding to the initial detection model and a target detection layer loss function corresponding to the initial detection model; The client generates the loss function list based on the RPN layer loss function and the target detection layer loss function; The client determines whether the initial detection model converges; If the initial detection model converges, the client determines that the initial detection model is the target detection model.
5. The target detection method according to claim 4, characterized in that: After the step of the client determining whether the initial detection model has converged, the method further includes: If the initial detection model does not converge, the client updates the model parameters of the initial detection model; Based on the updated model parameters, the initial detection model is updated, and the client continues to train the initial detection model based on the training samples to obtain the RPN layer loss function corresponding to the initial detection model and the target detection layer loss function corresponding to the initial detection model.
6. A target detection device, characterized in that: The target detection device comprises: A determination module, used to determine a target detection model and a loss function list based on training samples and an initial detection model; A processing module, used to determine the required parameters corresponding to the target detection model based on the loss function list; the processing module is also used for the client to calculate a first difference corresponding to the RPN layer loss function and a second difference corresponding to the target detection layer loss function based on the loss function list, wherein the first difference is the difference between the largest RPN layer loss function value and the smallest RPN layer loss function value in the loss function list, and the second difference is the difference between the largest target detection layer loss function value and the smallest target detection layer loss function value in the loss function list; the client determines the required parameters corresponding to the target detection model based on the first difference and the second difference; A sending module, used for sending the required parameters to the server, so that the server sends the final target detection model to the client; A classification module, configured to determine a parameter type corresponding to each required parameter when receiving the required parameters sent by each client, wherein the parameter type includes an RPN layer parameter and a target detection layer parameter; A clustering module, used to determine the parameter means corresponding to each parameter type based on the required parameters, and determine the parameters corresponding to the final target detection model based on the parameter means; The detection module is used to determine the target detection result corresponding to the sample to be detected based on the final target detection model.
7. A target detection system, characterized in that: The target detection system includes: a memory, a processor, and a target detection program stored in the memory and executable on the processor. When the target detection program is executed by the processor, the steps of the target detection method according to any one of claims 1 to 5 are implemented.
8. A readable storage medium, characterized in that: The readable storage medium stores a target detection program, and when the target detection program is executed by a processor, the steps of the target detection method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Model parameter training method and device based on federated learning, equipment and medium
CN109635462A
Training method and device for target detection and terminal equipment
CN109657615A