Disclosure of Invention
The invention aims to provide an elevator human recognition method, and particularly provides an elevator human recognition method which is based on artificial intelligence similarity comparison and high in recognition rate.
In order to achieve the purpose, the invention adopts the following technical scheme: an elevator human detection identification method based on artificial intelligence similarity comparison comprises the following steps:
s11, firstly, a camera in the elevator is used for collecting images of the elevator in an unmanned state, and the images are stored as background images.
S12, calculating average structural similarity between the real-time image acquired by the camera in the elevator and the background image, if the average structural similarity is larger than a certain threshold value, judging the image as the background image, namely judging that the elevator is in an unmanned state, and otherwise, entering the next step.
And S13, if the average structural similarity between the real-time image and the background image in the step S12 is not larger than a certain threshold value, calling an object detection model to perform human body detection with a lower threshold value to obtain a plurality of suspected human body area coordinates.
And S14, respectively calculating the average structure similarity of the plurality of suspected human body area coordinates obtained in the step S13 and the sub-images of the corresponding positions in the background image, excluding the suspected human body area coordinates with the average structure similarity larger than a certain threshold value, recording the remaining suspected human body area coordinates as human body area coordinates, judging that the elevator is occupied when the human body area coordinates exist, and judging that the elevator is in an unoccupied state when the suspected human body area coordinates are excluded.
Further, before step S11, the method further includes:
and S10, calculating an average gray value of the real-time image acquired by the camera in the elevator, judging that the elevator is in a light-off state if the average gray value is lower than a certain threshold value, judging that the elevator is in an unmanned state, and entering S11-S14 if the average gray value is not lower than the threshold value.
Specifically, the background image in step S11 is an image captured by the camera in a state where the elevator is lighted and no person is present.
Further, the background image in step S11 is re-collected and updated every unit time for comparison with the real-time image, where the unit time is preferably 1min to 30 min.
The invention has the advantages that: the method comprises the steps of firstly carrying out primary screening on the average structural similarity calculated by the real-time image and the background image, then carrying out primary detection on a human body region by using an object detection model, and finally carrying out secondary screening on the average structural similarity calculated by the human body region preliminarily detected and the background image corresponding to the human body region again so as to determine whether a person exists in the elevator. Not only need not to increase infrared sensor, can also effectively improve people and feel the exactness of discernment, ensure the safe high-efficient management of elevator.
Detailed Description
Embodiment 1, referring to fig. 1, a method for identifying an elevator human based on artificial intelligence similarity comparison includes the following steps:
s11, firstly, a camera in the elevator is used for collecting images of the elevator in an unmanned state, and the images are stored as background images.
S12, calculating average structural similarity between the real-time image acquired by the camera in the elevator and the background image, if the average structural similarity is larger than a certain threshold value, judging the image as the background image, namely judging that the elevator is in an unmanned state, and otherwise, entering the next step.
And S13, if the average structural similarity between the real-time image and the background image in the step S12 is not larger than a certain threshold value, calling an object detection model to perform human body detection with a lower threshold value to obtain a plurality of suspected human body area coordinates.
And S14, respectively calculating the average structure similarity of the plurality of suspected human body area coordinates obtained in the step S13 and the sub-images of the corresponding positions in the background image, excluding the suspected human body area coordinates with the average structure similarity larger than a certain threshold value, recording the remaining suspected human body area coordinates as human body area coordinates, judging that the elevator is occupied when the human body area coordinates exist, and judging that the elevator is in an unoccupied state when the suspected human body area coordinates are excluded.
In the embodiment, the average structural similarity is calculated by the real-time image collected by the camera and the elevator background image in an unmanned state, the larger the value of the average structural similarity is, the more similar the real-time image and the background image are, when the average structural similarity is larger than a certain threshold value, the real-time image can be judged to be consistent with the background image, i.e., no person is in the elevator, and on the contrary, when the average structural similarity does not exceed the threshold value, the human body detection of step S13 is performed on the real-time image, wherein the human body detection is to detect the real-time image by using an object detection model, in particular to detect the human body by using the SSD MobileNet-based object detection model, when the object detection model is used for detecting the human body, if a higher threshold value is set for detecting the human body, the situation that the elevator is judged to be unmanned due to the presence of people is easy to occur, and a larger potential safety hazard exists; after human body detection is carried out by using the object detection model, a plurality of suspected human body area coordinates are obtained, then the suspected human body area coordinates are screened for the second time, namely, the average structural similarity of the coordinates of a plurality of suspected human body areas and the subimages at the corresponding positions on the background image is calculated, if the average structural similarity between the image of the suspected human body area coordinates and the sub-image of the corresponding position on the background image is larger than a certain threshold value, the suspected human body area coordinate is actually the background image and is not the real human body area coordinate, only when the average structural similarity between the suspected human body area coordinate and the background image does not exceed the threshold value, the suspected human body area coordinate is confirmed as the real human body area coordinate, and at the moment, the person in the elevator can be judged, so that the efficiency and the accuracy of human body identification can be effectively improved, and the safety of the elevator is improved.
Embodiment 2, referring to fig. 2, a method for identifying an elevator human based on artificial intelligence similarity comparison includes the following steps:
and S10, calculating an average gray value of the real-time image acquired by the camera in the elevator, judging that the elevator is in a light-off state if the average gray value is lower than a certain threshold value, judging that the elevator is in an unmanned state, and entering S11-S14 if the average gray value is not lower than the threshold value.
S11, firstly, a camera in the elevator is used for collecting images of the elevator in an unmanned state, and the images are stored as background images.
S12, calculating average structural similarity between the real-time image acquired by the camera in the elevator and the background image, if the average structural similarity is larger than a certain threshold value, judging the image as the background image, namely judging that the elevator is in an unmanned state, and otherwise, entering the next step.
And S13, if the average structural similarity between the real-time image and the background image in the step S12 is not larger than a certain threshold value, calling an object detection model to perform human body detection with a lower threshold value to obtain a plurality of suspected human body area coordinates.
And S14, respectively calculating the average structure similarity of the plurality of suspected human body area coordinates obtained in the step S13 and the sub-images of the corresponding positions in the background image, excluding the suspected human body area coordinates with the average structure similarity larger than a certain threshold value, recording the remaining suspected human body area coordinates as human body area coordinates, judging that the elevator is occupied when the human body area coordinates exist, and judging that the elevator is in an unoccupied state when the suspected human body area coordinates are excluded.
Compared with the embodiment 1, the difference of the embodiment is that before the average structural similarity calculation is performed on the real-time image and the background image, the average gray value calculation is performed on the real-time image; because the elevator is a specific scene, the lighting lamp in the elevator car is triggered to be turned off or in an energy-saving mode when no person takes the elevator for a long time, the brightness in the elevator car is greatly reduced at the moment, the average gray value of the real-time image is lower at the moment, and the light-off state in the elevator at the moment can be judged by calculating the average gray value of the real-time image when the average gray value is lower than a certain threshold value, namely no person exists in the elevator. By calculating the average gray value of the real-time image, the real-time image in the elevator in a light-out state can be eliminated, and the human recognition efficiency is improved.
Of course, the background image used for the average structural similarity calculation with the real-time image, i.e., the background image in step S11, is an image captured by the camera in a state where there is a light in the elevator and no person is present.
Further, the background image in step S11 is re-collected and updated every unit time for comparison with the real-time image, where the unit time is preferably 1min to 30 min. The background image is refreshed at regular time, so that the image with a bright lamp in the elevator and in an unmanned state can be updated at regular time, the comparison error caused by the change of the elevator background is prevented, and the frequency of the refresh at regular time can be set according to the actual use condition of the elevator, generally 1-30 min, preferably 10 min; the time can also be extended appropriately according to needs, such as to 1h or 2h, and the like, without limitation.
It should be understood that the above-mentioned embodiments are merely preferred embodiments of the present invention, and not intended to limit the scope of the invention, therefore, all equivalent changes in the principle of the present invention should be included in the protection scope of the present invention.