US-12620253-B2 - Method for recognizing human body area in image, electronic device, and storage medium
Abstract
A method for recognizing human body area in image, an electronic device and a storage medium are provided. In the method, a human body area corresponding to a person in an image is recognized and the human body area is divided into a plurality of target areas according to a height of the human body area and a preset height ratio. A plurality of widths corresponding to the plurality of the target areas are acquired, and a first target width change relationship is determined. When the first target width change relationship does not match a preset standard width change relationship, the human body area is determined to be incomplete. The method can improve an accuracy of a human body area in an image recognition.
Inventors
- WAN-JHEN LEE
- CHIN-PIN KUO
Assignees
- HON HAI PRECISION INDUSTRY CO., LTD.
Dates
- Publication Date
- 20260505
- Application Date
- 20230214
- Priority Date
- 20221210
Claims (14)
- 1 . A method for recognizing a human body area in an image, the method is applied in an electronic device, the electronic device is applied in a vehicle, the electronic device communicates with a camera, the method comprising: training a preset neural network model based on one or more of a long-short term memory (LSTM), a recurrent neural network (RNN) and a convolutional neural network (CNN); recognizing, by the preset neural network model, a human body area corresponding to a person in an image acquired by the camera; dividing the human body area into a plurality of target areas according to a height of the human body area and a preset height ratio, comprising: dividing the human body area into a first target area, a second target area and a third target area according to the height of the human body area and the preset height ratio; wherein a height of the first target area is less than a height of the second target area and a height of the third target area; the height of the second target area is larger than the height of the third target area; acquiring a plurality of widths corresponding to the plurality of the target areas, and determining a first target width change relationship; in response that the first target width change relationship is determined to not match a preset standard width change relationship, determining the human body area is incomplete, comprising: acquiring a width of the first target area, a width of the second target area and a width of the third target area; in response that the width of the first target area is greater than or equal to the width of the second target area, and the width of the first target area is greater than the width of the third target area, determining the first target width change relationship does not match the preset standard width change relationship; repairing the human body area by using a preset depth learning model; dividing the repaired human body area into a plurality of expected areas according to a height of the repaired human body area and the preset height ratio; acquiring a plurality of widths corresponding to the plurality of the expected areas, and determining a second target width change relationship; in response to the second target width change relationship is determined to match the standard width change relationship, determining that the repaired human body area is a recognition result of the person in the image; controlling the vehicle according to the recognition result of the person in the image.
- 2 . The method according to claim 1 , after determining that the human body area is incomplete, the method further comprising: in response to the second target width change relationship is determined not matching the standard width change relationship, determining the human body area is a recognition result of the person in the image.
- 3 . The method according to claim 1 , wherein the standard width change relationship is determined by: acquiring test images of a plurality of testers; inputting each test image into a preset recognition model to obtain a human body area of each tester; dividing the human body area of each tester, taking an area corresponding to a head of each tester as a first test area, taking an area corresponding to an upper body of each tester as a second test area, and taking an area corresponding to a lower body of each tester as a third test area; acquiring a width of the first test area, a width of the second target area and a width of the third test area; determining the standard width change relationship, based on the width of the first test area, the width of the second target area and the width of the third test area.
- 4 . The method according to claim 1 , wherein dividing the repaired human body area into a plurality of expected areas according to a height of the repaired human body area and the preset height ratio comprises: dividing the repaired human body area into a first expected area, a second expected area and a third expected area according to the height of the repaired human body area and the preset height ratio; wherein a height of the first expected area is less than a height of the second expected area and a height of the third expected area; and the height of the second expected area is larger than the height of the third expected area.
- 5 . The method according to claim 4 , further comprising: acquiring a width of the first expected area, a width of the second expected area and a width of the third expected area; in response that the width of the first expected area is less than the width of the second expected area, and the width of the second expected area is greater than the width of the third expected area, determining that the second target width change relationship matches the preset standard width change relationship.
- 6 . An electronic device, comprising: a storage device and a processor, the storage device stores at least one computer-readable instruction, which when executed by the processor causes the processor to: train a preset neural network model based on one or more of a long-short term memory (LSTM), a recurrent neural network (RNN) and a convolutional neural network (CNN); recognize, by the preset neural network model, a human body area corresponding to a person in an image acquired by the camera; divide the human body area into a plurality of target areas according to a height of the human body area and a preset height ratio, comprising: divide the human body area into a first target area, a second target area and a third target area according to the height of the human body area and the preset height ratio; wherein a height of the first target area is less than a height of the second target area and a height of the third target area; the height of the second target area is larger than the height of the third target area; acquire a plurality of widths corresponding to the plurality of the target areas, and determine a first target width change relationship; in response that the first target width change relationship is determined to not match a preset standard width change relationship, determine the human body area is incomplete, comprising: acquire a width of the first target area, a width of the second target area and a width of the third target area; in response that the width of the first target area is greater than or equal to the width of the second target area, and the width of the first target area is greater than the width of the third target area, determine the first target width change relationship does not match the preset standard width change relationship; repair the human body area; divide the repaired human body area into a plurality of expected areas according to a height of the repaired human body area and the preset height ratio; acquire a plurality of widths corresponding to the plurality of the expected areas, and determining a second target width change relationship; in response to the second target width change relationship is determined to match the standard width change relationship, determine that the repaired human body area is a recognition result of the person in the image; control the vehicle according to the recognition result of the person in the image.
- 7 . The electronic device according to claim 6 , after determining that the human body area is incomplete, the processor further to: in response to the second target width change relationship is determined not matching the standard width change relationship, determine the human body area is a recognition result of the person in the image.
- 8 . The electronic device according to claim 6 , wherein the standard width change relationship is determined by: acquiring test images of a plurality of testers; inputting each test image into a preset recognition model to obtain a human body area of each tester; dividing the human body area of each tester, taking an area corresponding to a head of each tester as a first test area, taking an area corresponding to an upper body of each tester as a second test area, and taking an area corresponding to a lower body of each tester as a third test area; acquiring a width of the first test area, a width of the second target area and a width of the third test area; determining the standard width change relationship, based on the width of the first test area, the width of the second target area and the width of the third test area.
- 9 . The electronic device according to claim 6 , wherein dividing the repaired human body area into a plurality of expected areas according to a height of the repaired human body area and the preset height ratio comprises: dividing the repaired human body area into a first expected area, a second expected area and a third expected area according to the height of the repaired human body area and the preset height ratio; wherein a height of the first expected area is less than a height of the second expected area and a height of the third expected area; the height of the second expected area is larger than the height of the third expected area.
- 10 . The electronic device according to claim 9 , the processor further to: acquire a width of the first expected area, a width of the second expected area and a width of the third expected area; in response that the width of the first expected area is less than the width of the second expected area, and the width of the second expected area is greater than the width of the third expected area, determine the second target width change relationship matches the preset standard width change relationship.
- 11 . A non-transitory storage medium having stored thereon at least one computer-readable instructions that, when the at least one computer-readable instructions are executed by a processor to implement a method for recognizing human body area in image, which comprises: training a preset neural network model based on one or more of a long-short term memory (LSTM), a recurrent neural network (RNN) and a convolutional neural network (CNN); recognizing, by the preset neural network model, a human body area corresponding to a person in an image acquired by the camera; dividing the human body area into a plurality of target areas according to a height of the human body area and a preset height ratio, comprising: dividing the human body area into a first target area, a second target area and a third target area according to the height of the human body area and the preset height ratio; wherein a height of the first target area is less than a height of the second target area and a height of the third target area; the height of the second target area is larger than the height of the third target area; acquiring a plurality of widths corresponding to the plurality of the target areas, and determining a first target width change relationship; in response that the first target width change relationship is determined to not match a preset standard width change relationship, determining the human body area is incomplete, comprising: acquiring a width of the first target area, a width of the second target area and a width of the third target area; in response that the width of the first target area is greater than or equal to the width of the second target area, and the width of the first target area is greater than the width of the third target area, determining the first target width change relationship does not match the preset standard width change relationship; repairing the human body area; dividing the repaired human body area into a plurality of expected areas according to a height of the repaired human body area and the preset height ratio; acquiring a plurality of widths corresponding to the plurality of the expected areas, and determining a second target width change relationship; in response to the second target width change relationship is determined to match the standard width change relationship, determining that the repaired human body area is a recognition result of the person in the image; controlling the vehicle according to the recognition result of the person in the image.
- 12 . The non-transitory storage medium according to claim 11 , after determining that the human body area is incomplete, wherein the method further comprises: in response to the second target width change relationship is determined not matching the standard width change relationship, determining the human body area is a recognition result of the person in the image.
- 13 . The non-transitory storage medium according to claim 11 , wherein the standard width change relationship is determined by: acquiring test images of a plurality of testers; inputting each test image into a preset recognition model to obtain a human body area of each tester; dividing the human body area of each tester, taking an area corresponding to a head of each tester as a first test area, taking an area corresponding to an upper body of each tester as a second test area, and taking an area corresponding to a lower body of each tester as a third test area; acquiring a width of the first test area, a width of the second target area and a width of the third test area; determining the standard width change relationship, based on the width of the first test area, the width of the second target area and the width of the third test area.
- 14 . The non-transitory storage medium according to claim 11 , wherein dividing the repaired human body area into a plurality of expected areas according to a height of the repaired human body area and the preset height ratio comprises: dividing the repaired human body area into a first expected area, a second expected area and a third expected area according to the height of the repaired human body area and the preset height ratio; wherein a height of the first expected area is less than a height of the second expected area and a height of the third expected area; the height of the second expected area is larger than the height of the third expected area.
Description
FIELD The present application relates to a technical field of image recognition, specifically a method for recognizing human body area in image, an electronic device and a storage medium. BACKGROUND In a process of vehicle driving, pedestrians, being viewed as one of the many vehicle obstacles, need to be accurately recognized and avoided to avoid danger to pedestrians. Usually, target detection technologies, that is, neural network models, are used to detect pedestrians. However, training the neural network models requires a lot of computing power and computation time, and the training of the neural network models can only be conducted periodic. Therefore, if the training and updating of the neural network models is insufficient, it may lead to inaccurately recognize pedestrians on the roads, and result in traffic accidents. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 shows a schematic structural diagram of an electronic device in one embodiment of the present disclosure. FIG. 2 shows a flowchart of a method for recognizing human body area in image provided in an embodiment of the present disclosure. FIG. 3 shows a schematic diagram of dividing a human body area provided in an embodiment of the present disclosure. FIG. 4 shows a schematic diagram of dividing a human body area provided in another embodiment of the present disclosure. FIG. 5 shows a schematic diagram of a width of a target area provided in an embodiment of the present disclosure. FIG. 6 shows a flowchart of a method for repairing an incomplete human body area provided in an embodiment of the present disclosure. FIG. 7 shows a schematic diagram of an repaired human body area provided in an embodiment of the present disclosure. DETAILED DESCRIPTION The accompanying drawings combined with the detailed description illustrate the embodiments of the present disclosure hereinafter. It is noted that embodiments of the present disclosure and mapped features of the embodiments can be combined, when there is no conflict. Various details are described in the following descriptions for a better understanding of the present disclosure, however, the present disclosure may also be implemented in other ways other than those described herein. The scope of the present disclosure is not to be limited by the specific embodiments disclosed below. Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present disclosure belongs. The terms used herein in the present disclosure are only for the purpose of describing specific embodiments and are not intended to limit the present disclosure. In order to solve a technical problem of inaccurate human body area recognition in image based pedestrian recognition, and better understand a method for recognizing human body area in image, an electronic device and a storage medium provided in an embodiment of the present disclosure, an application scenario of the method for recognizing human body area in image of is described below. FIG. 1 is a schematic structural diagram of an electronic device provided in an embodiment of the present disclosure. The method for recognizing human body area in image provided in an embodiment of the present disclosure is applied to an electronic device 1, which includes, but is not limited to, a storage device 11, at least one processor 12, and a camera 13. The storage device 11, the at least one processor 12 and the camera 13 are connected to each other through a communication bus 10. The camera 13 can be an on-board camera of a vehicle, a camera of an external vehicle, such as a camera or a tachograph, to capture images or videos in front of a vehicle. In an embodiment of the present disclosure, the electronic device 1 can be applied to vehicles, for example, an on-board device in a vehicle (for example, a vehicle machine), or an independent on-board device (for example, a computer, a laptop, a mobile phone, etc.). The electronic device 1 can communicate and interact with the on-board device to achieve a control of the vehicle. The storage device 11 stores computer-readable instructions, for example, recognizing pedestrian programs, and the computer-readable instructions can be executed on the at least one processor 12. The processor 12 executes the computer-readable instructions to implement the steps in the embodiment of the method for recognizing human body area in image, such as in steps in block S21-S24 shown in FIG. 2, or in steps in block S61-S66 shown in FIG. 6. For example, the computer-readable instructions can be divided into one or more modules/units, and the one or more modules/units are stored in the storage device 11 and executed by the at least one processor 12. The one or more modules/units can be a series of computer-readable instruction segments capable of performing specific functions, and the instruction segments are used to describe execution processes of the compu