A method and device for identifying whether a pedestrian holds an object in his hand
By obtaining pedestrian key point information and using the knowledge distillation method of teacher model and student model, the accuracy and speed problems in pedestrian hand recognition are solved, and the recognition accuracy is significantly improved.
Patent Information
- Application Number
- CN202210044806.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-14
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2042-01-14
AI Technical Summary
The existing technology has low accuracy and slow speed in identifying whether pedestrians hold objects in their hands, making it difficult to effectively identify small targets, such as mobile phones.
By obtaining pedestrian key point information, the hand area image is determined, and the knowledge distillation method of the teacher model and student model is used to improve the recognition accuracy of the student model, and the gradient descent method is used to adjust the model weight parameters until the preset conditions are met.
It improves the accuracy and speed of identifying whether pedestrians hold objects in their hands. Compared with the student model trained with a single variable error, the recognition accuracy is significantly improved.
Smart Images

Figure CN114495165B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and specifically provides a method and a device for identifying whether a pedestrian holds an object in his hand. Background Art
[0002] At present, mobile phones have become an essential part of people's lives. Therefore, in many monitoring scenarios, it is important to monitor whether pedestrians are holding mobile phones. At present, artificial intelligence technology is usually used to automatically identify whether pedestrians are holding mobile phones. Ordinary pedestrian mobile phone recognition algorithms are mostly implemented by detecting pedestrian pictures, but mobile phone objects are small and account for a small proportion of the entire pedestrian picture. The current algorithm usually has certain difficulties in detecting small targets and it is difficult to achieve high recognition accuracy. On the other hand, the deployment of large models usually consumes more resources, and directly training small models usually cannot achieve the accuracy of large models, and it is difficult to solve the problem of behavior recognition well. These problems lead to the unsatisfactory performance of the final trained model in terms of accuracy and speed.
[0003] Accordingly, the art needs a new solution for identifying whether a pedestrian is holding an object in his hand to solve the above problem. Summary of the invention
[0004] In order to overcome the above defects, the present invention is proposed to solve or at least partially solve the technical problem that the existing model has low accuracy and slow speed in identifying whether a pedestrian's hand holds an object. The present invention provides a method and device for identifying whether a pedestrian's hand holds an object.
[0005] In a first aspect, the present invention provides a method for identifying whether a pedestrian's hand is holding an object, comprising: obtaining a historical pedestrian image sample set containing a pedestrian's hand region; obtaining a pedestrian hand region image of each sample in the historical pedestrian image sample set from the historical pedestrian image sample set using a pedestrian key point model; training a student model using the pedestrian hand region image of each sample in the historical pedestrian image sample set and a teacher model to obtain a trained student model; and identifying a pedestrian image to be identified based on the pedestrian key point model and the trained student model to obtain an identification result.
[0006] In one embodiment, using a pedestrian key point model to obtain a pedestrian hand area image of each sample in the historical pedestrian image sample set from the historical pedestrian image sample set includes: inputting the historical pedestrian image sample set into the pedestrian key point model to obtain pedestrian key point information, wherein the pedestrian key point information includes a wrist key point and an elbow key point; calculating the distance from the wrist key point to the elbow key point; determining the side length of a square centered on the wrist key point based on the distance from the wrist key point to the elbow key point; determining a pedestrian hand area based on the square side length and the wrist key point; and splicing the pedestrian hand areas to obtain a pedestrian hand area image of each sample in the historical pedestrian image sample set.
[0007] In one embodiment, the student model is trained using the pedestrian hand area image of each sample in the historical pedestrian image sample set and the teacher model to obtain the trained student model, including: inputting the hand area image of each sample in the historical pedestrian image sample set into the teacher model and the student model to obtain a first output vector and a second output vector, respectively; determining a training error based on the first output vector and the second output vector; and training the student model based on a gradient descent method and the training error to obtain a trained student model.
[0008] In one embodiment, determining the training error based on the first output vector and the second output vector includes: calculating a first error and a second error based on the first output vector and the second output vector, respectively, and the calculation formulas of the first error and the second error are respectively:
[0009]
[0010] l2=ylogx+(1-y)log(1-x) (2)
[0011]
[0012] Among them, l1 is the first error, l2 is the second error, z={z0,z1,z2,z3,z4} is the first output vector, z0 and z1 are the horizontal and vertical coordinates of the upper left corner of the hand area image of the pedestrian's hand holding the object output by the teacher model, z2 and z3 are the horizontal and vertical coordinates of the lower right corner of the hand area image of the pedestrian's hand holding the object output by the teacher model, z4 is the confidence value output by the teacher model, k={k0,k1,k2,k3,k4} is the second output vector, k0 and k1 are the horizontal and vertical coordinates of the upper left corner of the hand area image of the pedestrian's hand holding the object output by the student model, k2 and k3 are the horizontal and vertical coordinates of the lower right corner of the hand area image of the pedestrian's hand holding the object output by the student model, and k4 is the confidence value output by the student model; the training error is determined based on the first error and the second error.
[0013] In one embodiment, determining the training error based on the first error and the second error includes: taking the sum of the first error and the second error as the training error.
[0014] In one embodiment, training a student model based on a gradient descent method and the training error to obtain a trained student model includes: determining whether the training error meets a preset condition, and if so, using the current student model as a trained student model; if not, adjusting the weight parameters of the student model based on the gradient descent method, and updating the training error based on the teacher model and the student model after adjusting the weight parameters, until the updated training error meets the preset condition, and using the student model after adjusting the weight parameters as the trained student model.
[0015] In one embodiment, the pedestrian image to be identified is identified based on the pedestrian key point model and the trained student model to obtain the identification result, including: inputting the pedestrian image to be identified into the pedestrian key point model to obtain the pedestrian hand area image; inputting the pedestrian hand area image into the trained student model to obtain the recognition result.
[0016] In a second aspect, the present invention provides a device for identifying whether a pedestrian is holding an object in his hand, comprising: a first acquisition module, configured to acquire a historical pedestrian image sample set containing a pedestrian hand area; a second acquisition module, configured to acquire a pedestrian hand area image of each sample in the historical pedestrian image sample set from the historical pedestrian image sample set using a pedestrian key point model; a training module, configured to train a student model using the pedestrian hand area image of each sample in the historical pedestrian image sample set and a teacher model to obtain a trained student model; and a recognition module, configured to recognize the pedestrian image to be recognized based on the pedestrian key point model and the trained student model to obtain a recognition result.
[0017] In a third aspect, an electronic device is provided, comprising a processor and a storage device, wherein the storage device is suitable for storing a plurality of program codes, and the program codes are suitable for being loaded and run by the processor to execute any of the aforementioned methods for identifying whether a pedestrian is holding an object in his or her hand.
[0018] In a fourth aspect, a computer-readable storage medium is provided, wherein a plurality of program codes are stored therein, wherein the program codes are suitable for being loaded and run by a processor to execute any of the aforementioned methods for identifying whether a pedestrian is holding an object in his or her hand.
[0019] The above one or more technical solutions of the present invention have at least one or more of the following beneficial effects:
[0020] The present invention proposes a method and device for identifying whether a pedestrian's hand holds an object. By using the pedestrian's key point information, the pedestrian's hand area image is obtained, which provides a basis for the subsequent training of the teacher model and the student model. In view of the problem that the student model has average performance, the knowledge distillation method is used to improve the recognition accuracy of the student model, thereby improving the recognition accuracy of the pedestrian image.
[0021] Through the pedestrian key point model, the pedestrian hand area image of each sample in the historical pedestrian image sample set is obtained from the historical pedestrian image sample set, which provides technical support for the subsequent training of the teacher model and the student model, and is conducive to improving the accuracy of model training.
[0022] The knowledge distillation method is used to train the student model through the trained teacher model, thereby improving the recognition accuracy of the student model. In addition, in this application, the sum of the first error corresponding to the corresponding position of the pedestrian's hand holding the object in the hand area image output by the corresponding model and the second error corresponding to the confidence is used as the training error to train the student model. Compared with the student model obtained by the error training determined by a single variable in the existing method, the recognition accuracy of the student model is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The disclosure of the present invention will become more easily understood with reference to the accompanying drawings. It is easy for those skilled in the art to understand that these drawings are only for illustrative purposes and are not intended to limit the scope of protection of the present invention. In addition, similar numbers in the figures are used to represent similar components, among which:
[0024] Figure 1 is a schematic flow chart of main steps of a method for identifying whether a pedestrian holds an object in his hand according to an embodiment of the present invention;
[0025] Figure 2 is a schematic diagram of the training process of a student model according to an embodiment of the present invention;
[0026] Figure 3 It is a schematic diagram of the main structural block diagram of a device for identifying whether a pedestrian is holding an object in his hand according to an embodiment of the present invention.
[0027] Reference numerals list :
[0028] 11: First acquisition module; 12: Second acquisition module; 13: Training module; 14: Recognition module. DETAILED DESCRIPTION
[0029] Some embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.
[0030] In the description of the present invention, "module" and "processor" may include hardware, software or a combination of the two. A module may include hardware circuits, various suitable sensors, communication ports, and memories, and may also include software parts, such as program codes, or a combination of software and hardware. The processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor, or any other suitable processor. The processor has data and / or signal processing functions. The processor may be implemented in software, hardware, or a combination of the two. Non-temporary computer-readable storage media include any suitable medium that can store program codes, such as a magnetic disk, a hard disk, an optical disk, a flash memory, a read-only memory, a random access memory, and the like. The term "A and / or B" means all possible combinations of A and B, such as only A, only B, or A and B. The term "at least one A or B" or "at least one of A and B" has a similar meaning to "A and / or B", and may include only A, only B, or A and B. The singular terms "one" and "the" may also include plural forms.
[0031] At present, the traditional model has low accuracy and slow speed in identifying whether a pedestrian is holding an object in his hand. For this reason, this application proposes a method and device for identifying whether a pedestrian is holding an object in his hand. By using the key point information of the pedestrian, the hand area image of the pedestrian is obtained, which provides a basis for the subsequent training of the teacher model and the student model. In view of the general performance of the student model, the knowledge distillation method is used to improve the recognition accuracy of the student model, thereby improving the recognition accuracy of the pedestrian image. In addition, the objects held by the hands of pedestrians in this application can be mobile phones, cigarettes, and other objects that can be captured by the camera and visible to the human eye. In the subsequent embodiments, mobile phones will be used as examples of objects held by pedestrians for detailed description, which will not be repeated here.
[0032] See attached Figure 1 , Figure 1 FIG. 1 is a flow chart of the main steps of a method for identifying whether a pedestrian is holding an object in his hand according to an embodiment of the present invention. Figure 1 As shown, the method for identifying whether a pedestrian holds an object in his hand in the embodiment of the present invention mainly includes the following steps S101 to S104.
[0033] Step S101: obtaining a historical pedestrian image sample set containing pedestrian hand regions, where the historical pedestrian image sample set is mainly used for model training.
[0034] Step S102: using the pedestrian key point model to obtain the pedestrian hand region image of each sample in the historical pedestrian image sample set from the historical pedestrian image sample set. This step can be specifically implemented through the following steps S1021 to S1025.
[0035] Step S1021: Input the historical pedestrian image sample set into the pedestrian key point model to obtain pedestrian key point information, where the pedestrian key point information includes wrist key points and elbow key points, and may also be key point information of the head, shoulder, knee, etc. Specifically, the pedestrian key point model in the present application may be an AlphaPose model, a CMU OpenPose model, etc., but is not limited thereto, and any other model that can obtain pedestrian key point information based on the historical pedestrian image sample set may also be used in this embodiment.
[0036] Step S1022: Calculate the distance from the wrist key point to the elbow key point.
[0037] Step S1023: Based on the distance from the wrist key point to the elbow key point, determine the side length of the square centered on the wrist key point. Specifically, set the hand area to a square area with the wrist key point as the center point of the square. To prevent the output of the pedestrian key point model from being unstable and causing key point offset problems, in this embodiment, 1.5 times the distance from the wrist key point to the elbow key point is used as the side length of the square area, thereby obtaining a larger hand area, ensuring that the hand area is correct while ensuring that the size of the pedestrian's hand area holding the phone is appropriate.
[0038] Step S1024: Determine the pedestrian's hand region based on the side length of the square and the wrist key point. Specifically, the wrist key point is used as the center point of the square, and the pedestrian's hand region can be determined based on the side length of the square.
[0039] Step S1025: stitching the pedestrian hand regions to obtain the pedestrian hand region image of each sample in the historical pedestrian image sample set. Specifically, the two hand regions of the pedestrian are scaled to 224×224 pixels and then stitched left and right to obtain a stitched pedestrian hand region image of 224×448 size.
[0040] In this embodiment, the pedestrian hand area image of each sample in the historical pedestrian image sample set is obtained from the historical pedestrian image sample set through the pedestrian key point model, which provides technical support for the subsequent training of the teacher model and the student model. Compared with the prior art method of directly training a small model with pedestrian images, it is beneficial to improve the accuracy of model training.
[0041] Step S103: Train the student model using the pedestrian hand region image of each sample in the historical pedestrian image sample set and the teacher model to obtain a trained student model. The teacher model in this step can be a trained teacher model, which can be a trained teacher model obtained by training the teacher model using the hand region image of each sample in the historical pedestrian image sample set, and then use the trained teacher model to help train the student model, which is beneficial to improve the training accuracy of the student model. This step can be specifically implemented through the following steps S1031-S1033.
[0042] Step S1031: Input the hand region image of each sample in the historical pedestrian image sample set into the teacher model and the student model to obtain the first output vector and the second output vector respectively. In this step, after inputting the hand region image of each sample in the historical pedestrian image sample set into the trained teacher model, the first output vector z={z0,z1,z2,z3,z4} is obtained, where z is a five-dimensional vector, z0 and z1 are the horizontal coordinate and vertical coordinate of the upper left corner of the hand region image of the pedestrian's hand holding the object output by the teacher model, z2 and z3 are the horizontal coordinate and vertical coordinate of the lower right corner of the hand region image of the pedestrian's hand holding the object output by the teacher model, and z4 is the confidence value output by the teacher model, indicating the probability that the object recognized by the teacher model is a mobile phone. After inputting the hand area image of each sample in the historical pedestrian image sample set into the student model, the second output vector k = {k0, k1, k2, k3, k4} is obtained, where k is a five-dimensional vector, k0 and k1 are the horizontal and vertical coordinates of the upper left corner of the hand area image of the object held by the pedestrian's hand output by the student model, respectively, k2 and k3 are the horizontal and vertical coordinates of the lower right corner of the hand area image of the object held by the pedestrian's hand output by the student model, respectively, and k4 is the confidence value output by the student model, indicating the probability that the object recognized by the student model is a mobile phone.
[0043] Step S1032: Determine the training error based on the first output vector and the second output vector. In the knowledge distillation stage, the first error l1 is calculated using mse loss for the first four dimensions of the output vectors of the teacher model and the student model, and the second error l2 is calculated using bce loss for the fifth dimension of the output vectors of the teacher model and the student model, thereby obtaining the training error l=l1+l2 based on the sum of the first error l1 and the second error l2. The calculation formulas for the first error l1 and the second error l2 are as follows:
[0044]
[0045] l2=ylogx+(1-y)log(1-x) (2)
[0046]
[0047] Among them, l1 is the first error, l2 is the second error, z = {z0, z1, z2, z3, z4} is the first output vector, z0 and z1 are the horizontal and vertical coordinates of the upper left corner of the hand area image of the pedestrian's hand held object output by the teacher model, z2 and z3 are the horizontal and vertical coordinates of the lower right corner of the hand area image of the pedestrian's hand held object output by the teacher model, z4 is the confidence value output by the teacher model, k = {k0, k1, k2, k3, k4} is the second output vector, k0 and k1 are the horizontal and vertical coordinates of the upper left corner of the hand area image of the pedestrian's hand held object output by the student model, k2 and k3 are the horizontal and vertical coordinates of the lower right corner of the hand area image of the pedestrian's hand held object output by the student model, and k4 is the confidence value output by the student model. In addition, the first error in this embodiment is not limited to being calculated using MSE loss, and the second error is not limited to being calculated using BCE loss. They can also be calculated using output feature loss, instance relationship loss, etc., but are not limited to this.
[0048] Step S1033: Train the student model based on the gradient descent method and the training error to obtain a trained student model. Specifically, after obtaining the training error based on step S1032, first determine whether the current training error meets the preset conditions. If so, use the current student model as a trained student model for pedestrian image recognition. If not, adjust the weight parameters of the student model by gradient descent, and recalculate the training error based on the teacher model and the student model after adjusting the weight parameters. The method for recalculating the training error based on the teacher model and the student model after adjusting the weight parameters can be found in the above steps S1031 and S1032, which will not be repeated here. Then determine whether the training error meets the preset conditions. If not, continue to adjust the weight parameters of the student model by gradient descent until the training error updated based on the teacher model and the student model after adjusting the weight parameters meets the preset conditions, and use the student model after adjusting the weight parameters as the trained student model.
[0049] The knowledge distillation method is used to train the student model through the trained teacher model, thereby improving the recognition accuracy of the student model. In addition, in this application, the sum of the first error corresponding to the corresponding position of the pedestrian's hand holding the object in the hand area image output by the corresponding model and the second error corresponding to the confidence is used as the training error to train the student model. Compared with the student model obtained by error training determined by a single variable in the prior art, the recognition accuracy of the student model is improved.
[0050] Step S104: Identify the pedestrian image to be identified based on the pedestrian key point model and the trained student model to obtain the identification result. Specifically, when identifying the pedestrian image to be identified, first input the pedestrian image to be identified into the pedestrian key point model to obtain the pedestrian hand area image. The specific method of obtaining the pedestrian hand area image from the pedestrian key point model can refer to the aforementioned step S102, which will not be repeated here. Then input the pedestrian hand area image into the trained student model, so that it can be identified whether the pedestrian hand area holds items such as mobile phones or cigarettes.
[0051] Based on the above steps S101 to S104, the pedestrian's hand area image is obtained using the pedestrian's key point information, which provides a basis for the subsequent training of the teacher model and the student model. In view of the problem of the general performance of the student model, the knowledge distillation method is used to improve the recognition accuracy of the student model, thereby improving the recognition accuracy of the pedestrian image.
[0052] It should be pointed out that although the various steps in the above embodiments are described in a specific order, those skilled in the art can understand that in order to achieve the effects of the present invention, different steps do not have to be performed in such an order. They can be performed simultaneously (in parallel) or in other orders. These changes are within the scope of protection of the present invention.
[0053] like Figure 2 As shown in the figure, the pedestrian hand area image obtained by the key point model can be used to train the teacher model and the small model respectively. The small model here is the student model. Before training the student model, the teacher model is first trained to obtain a trained teacher model. Then, the trained teacher model and the pedestrian hand area image are used to perform knowledge distillation on the student model, and finally a trained student model is obtained.
[0054] Furthermore, the present invention also provides a device for identifying whether a pedestrian is holding an object in his hand.
[0055] See attached Figure 3 , Figure 3 FIG. 1 is a main structural block diagram of a device for identifying whether a pedestrian holds an object in his hand according to an embodiment of the present invention. Figure 3 As shown, the device for identifying whether a pedestrian's hand holds an object in an embodiment of the present invention mainly includes a first acquisition module 11, a second acquisition module 12, a training module 13 and an identification module 14. In some embodiments, one or more of the first acquisition module 11, the second acquisition module 12, the training module 13 and the identification module 14 can be combined into one module. In some embodiments, the first acquisition module 11 can be configured to acquire a historical pedestrian image sample set containing a pedestrian hand area. The second acquisition module 12 can be configured to use a pedestrian key point model to acquire a pedestrian hand area image of each sample in the historical pedestrian image sample set from the historical pedestrian image sample set. The training module 13 can be configured to train the student model using the pedestrian hand area image of each sample in the historical pedestrian image sample set and the teacher model to obtain a trained student model. The identification module 14 can be configured to identify the pedestrian image to be identified based on the pedestrian key point model and the trained student model to obtain an identification result. In one embodiment, the description of the specific implementation function can be referred to the description of steps S101-step S104.
[0056] The above-mentioned device for identifying whether a pedestrian holds an object in his hand is used to perform Figure 1The embodiment of the method for identifying whether a pedestrian is holding an object in his hand is shown in the figure. The technical principles, technical problems solved and technical effects produced by the two are similar. Technical personnel in this technical field can clearly understand that for the convenience and conciseness of description, the specific working process and relevant instructions of the device for identifying whether a pedestrian is holding an object in his hand can refer to the contents described in the embodiment of the method for identifying whether a pedestrian is holding an object in his hand, and will not be repeated here.
[0057] It is understood by those skilled in the art that the present invention implements all or part of the processes in the method of the above embodiment, and can also be completed by instructing the relevant hardware through a computer program, and 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, medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, electric carrier signal, telecommunication signal and software distribution medium that can carry the computer program code. 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.
[0058] Furthermore, the present invention also provides an electronic device. In an electronic device embodiment according to the present invention, the electronic device includes a processor and a storage device, the storage device can be configured to store a program for executing the method for identifying whether a pedestrian's hand holds an object in the above method embodiment, and the processor can be configured to execute the program in the storage device, which includes but is not limited to executing the method for identifying whether a pedestrian's hand holds an object in the above method embodiment. For ease of explanation, only the parts related to the embodiment of the present invention are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present invention.
[0059] Furthermore, the present invention also provides a computer-readable storage medium. In a computer-readable storage medium embodiment according to the present invention, the computer-readable storage medium can be configured to store a program for executing the method for identifying whether a pedestrian's hand is holding an object in the above method embodiment, and the program can be loaded and run by a processor to implement the above method for identifying whether a pedestrian's hand is holding an object. For ease of explanation, only the parts related to the embodiment of the present invention are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present invention. The computer-readable storage medium can be a storage device formed by various electronic devices. Optionally, the computer-readable storage medium in the embodiment of the present invention is a non-temporary computer-readable storage medium.
[0060] Further, it should be understood that since the setting of each module is only for illustrating the functional units of the device of the present invention, the physical devices corresponding to these modules may be the processor itself, or a part of the software in the processor, a part of the hardware, or a part of the combination of software and hardware. Therefore, the number of each module in the figure is only schematic.
[0061] Those skilled in the art will appreciate that the modules in the device can be adaptively split or merged. Such splitting or merging of specific modules will not cause the technical solution to deviate from the principle of the present invention, and therefore, the technical solutions after splitting or merging will fall within the protection scope of the present invention.
[0062] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.
Claims
1. A method for identifying whether a pedestrian holds an object in his hand, characterized in that: include: Obtain a historical pedestrian image sample set containing pedestrian hand regions; Obtaining a pedestrian hand region image of each sample in the historical pedestrian image sample set from the historical pedestrian image sample set using a pedestrian key point model, including: Inputting the historical pedestrian image sample set into the pedestrian key point model to obtain pedestrian key point information, wherein the pedestrian key point information includes wrist key points and elbow key points; Calculating the distance from the wrist key point to the elbow key point; Based on the distance from the wrist key point to the elbow key point, determine the side length of a square centered on the wrist key point; Determine the pedestrian hand area based on the side length of the square and the wrist key point; splicing the pedestrian hand regions to obtain a pedestrian hand region image of each sample in the historical pedestrian image sample set; Using the pedestrian hand region image of each sample in the historical pedestrian image sample set and the teacher model to train the student model to obtain a trained student model; The pedestrian image to be identified is identified based on the pedestrian key point model and the trained student model to obtain a recognition result.
2. The method for identifying whether a pedestrian holds an object in his hand according to claim 1, characterized in that: The student model is trained using the pedestrian hand region image of each sample in the historical pedestrian image sample set and the teacher model, and the trained student model includes: Inputting the hand region image of each sample in the historical pedestrian image sample set into the teacher model and the student model to obtain a first output vector and a second output vector respectively; determining a training error based on the first output vector and the second output vector; The student model is trained based on the gradient descent method and the training error to obtain a trained student model.
3. The method for identifying whether a pedestrian holds an object in his hand according to claim 2, characterized in that: Determining a training error based on the first output vector and the second output vector includes: A first error and a second error are calculated based on the first output vector and the second output vector, respectively. The calculation formulas of the first error and the second error are: l2=ylogx+(1-y)log(1-x) (2) Wherein, l1 is the first error, l2 is the second error, z = {z0, z1, z2, z3, z4} is the first output vector, z0 and z1 are the horizontal coordinate and vertical coordinate of the upper left corner of the hand area image of the pedestrian's hand holding the object output by the teacher model, z2 and z3 are the horizontal coordinate and vertical coordinate of the lower right corner of the hand area image of the pedestrian's hand holding the object output by the teacher model, z4 is the confidence value output by the teacher model, k = {k0, k1, k2, k3, k4} is the second output vector, k0 and k1 are the horizontal coordinate and vertical coordinate of the upper left corner of the hand area image of the pedestrian's hand holding the object output by the student model, k2 and k3 are the horizontal coordinate and vertical coordinate of the lower right corner of the hand area image of the pedestrian's hand holding the object output by the student model, k4 is the confidence value output by the student model; A training error is determined based on the first error and the second error.
4. The method for identifying whether a pedestrian holds an object in his hand according to claim 3, characterized in that: Determining a training error based on the first error and the second error includes: taking a sum of the first error and the second error as the training error.
5. The method for identifying whether a pedestrian holds an object in his hand according to claim 2, characterized in that: Training a student model based on the gradient descent method and the training error to obtain a trained student model includes: judging whether the training error meets a preset condition, and if so, taking the current student model as a trained student model; if not, adjusting the weight parameters of the student model based on the gradient descent method, and updating the training error based on the teacher model and the student model after adjusting the weight parameters, until the updated training error meets the preset condition, and taking the student model after adjusting the weight parameters as the trained student model.
6. The method for identifying whether a pedestrian holds an object in his hand according to claim 1, characterized in that: Based on the pedestrian key point model and the trained student model, the pedestrian image to be identified is identified, and the identification result obtained includes: Inputting the pedestrian image to be identified into the pedestrian key point model to obtain a pedestrian hand area image; The pedestrian hand region image is input into the trained student model to obtain a recognition result.
7. A device for identifying whether a pedestrian is holding an object, characterized in that: include: A first acquisition module is configured to acquire a historical pedestrian image sample set containing a pedestrian hand region; The second acquisition module is configured to use the pedestrian key point model to acquire the pedestrian hand area image of each sample in the historical pedestrian image sample set from the historical pedestrian image sample set, including: inputting the historical pedestrian image sample set into the pedestrian key point model to obtain pedestrian key point information, wherein the pedestrian key point information includes a wrist key point and an elbow key point; calculating the distance from the wrist key point to the elbow key point; determining the side length of a square centered on the wrist key point based on the distance from the wrist key point to the elbow key point; determining the pedestrian hand area based on the square side length and the wrist key point; splicing the pedestrian hand area to obtain the pedestrian hand area image of each sample in the historical pedestrian image sample set; A training module is configured to train a student model using a pedestrian hand region image of each sample in the historical pedestrian image sample set and a teacher model to obtain a trained student model; The recognition module is configured to recognize the pedestrian image to be recognized based on the pedestrian key point model and the trained student model to obtain a recognition result.
8. An electronic device comprising a processor and a storage device, wherein the storage device is suitable for storing a plurality of program codes, characterized in that: The program code is suitable for being loaded and run by the processor to execute the method for identifying whether a pedestrian holds an object in his hand according to any one of claims 1 to 6.
9. A computer-readable storage medium storing a plurality of program codes, characterized in that: The program code is suitable for being loaded and run by a processor to execute the method for identifying whether a pedestrian holds an object in his hand according to any one of claims 1 to 6.
Citation Information
Patent Citations
Real-time access behavior detection method and system based on container scene
CN110796051A
Pedestrian head lowering abnormal behavior detection method based on human body articulation points
CN111611912A
Behavior recognition method and device and computer equipment
CN113065474A
Gesture recognition method and system based on knowledge distillation and attention mechanism
CN113449610A
Visual object instance segmentation using foreground-specialized model imitation
US20210407090A1
