Method and device for determining relative distance between man and window, electronic equipment and storage medium
By identifying the location of the human body and windows in the construction site image and calculating their relative distances, the safety hazards caused by uninstalled windows are solved, and real-time monitoring and early warning of construction site safety is achieved.
Patent Information
- Application Number
- CN202411908740.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-05-09
AI Technical Summary
At the construction site, uninstalled window openings pose safety hazards to construction workers, especially when working at high altitudes or carrying heavy objects, which may lead to falls or objects falling.
The pre-trained object detection model recognizes the location of the human body and window in the image of the construction site, obtains detection frame information, and determines the depth information of the human body and window through the monocular depth estimation calculation method, and then calculates the relative distance between the two. When the distance is less than the preset threshold, a security risk warning is triggered.
Real-time monitoring of the distance between human bodies and windows at the construction site is achieved, and construction personnel are warned in advance to avoid potential safety accidents and ensure the safety and order of the construction site.
Smart Images

Figure CN119963483A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of security monitoring, and more specifically, to a method, device, electronic device and storage medium for determining the relative distance between a person and a window. Background Art
[0002] In the current decoration scene, we often encounter the situation that some windows have not been installed due to construction sequence or design considerations. These unclosed window openings are like invisible traps on the construction site, which bring considerable safety hazards to the construction workers who are busy on various working surfaces. Especially when working at high altitude or carrying heavy objects, once the construction workers accidentally approach the edges of these uninstalled windows, there is a high possibility of falling or falling objects, which not only threatens personal life safety, but also may affect the progress of the entire project and the safety of the surrounding environment. Therefore, in order to ensure the safety and order of the construction site, it is particularly important to effectively monitor the distance between people and windows. Summary of the invention
[0003] One purpose of the present disclosure is to provide a method for determining the relative distance between a person and a window, which can monitor the distance between a person and a window through images of a construction site so as to provide subsequent prompts and avoid the occurrence of safety accidents.
[0004] According to a first aspect of the present disclosure, a method for determining a relative distance between a person and a window is provided, comprising:
[0005] Recognize the target image through the pre-trained target detection model, and obtain detection frame information of a first detection frame and a second detection frame, wherein the first detection frame is used to mark the area corresponding to the human body in the target image, and the second detection frame is used to mark the area corresponding to the window in the target image;
[0006] Determine depth information of a human body and a window in the target image respectively;
[0007] The relative distance between the human body and the window is determined according to the detection frame information and the depth information.
[0008] Optionally, respectively determining depth information of a human body and a window in the target image includes:
[0009] Determining the depth information of each pixel in the target image by a monocular depth estimation algorithm;
[0010] Using the average depth information of each pixel in the first detection frame as the depth information of the human body in the image;
[0011] The average depth information of each pixel in the second detection frame is used as the depth information of the window in the image.
[0012] Optionally, the detection frame information of the first detection frame and the second detection frame includes coordinates of center points of the first detection frame and the second detection frame; and determining the relative distance between the human body and the window according to the detection frame information and the depth information includes:
[0013] Determine a first vector representing a position of a human body and a second vector representing a position of a window according to coordinates of center points of the first detection frame and the second detection frame and depth information of a human body and a window in the target image;
[0014] A cosine distance between the first vector and the second vector is determined.
[0015] Optionally, after determining the relative distance between the human body and the window according to the detection frame information and the depth information, the method further includes:
[0016] Determining whether the relative distance is less than a preset distance threshold;
[0017] When the relative distance is less than a preset distance threshold, a security risk prompt is triggered to remind the user to take necessary safety measures.
[0018] Optionally, the detection frame information of the second detection frame also includes a pixel height H of the second detection frame. window and pixel width W window ;
[0019] The preset distance threshold T is:
[0020]
[0021] Where k is the adjustment coefficient.
[0022] Optionally, before respectively determining the depth information of the human body and the window in the target image, the method further includes:
[0023] The brightness and contrast of the target image are adjusted, wherein the adjusted brightness L adjusted for:
[0024] L adjusted =α·L+β
[0025] Adjusted contrast
[0026]
[0027] Among them, α, β, and γ are preset parameters, L is the brightness value of the target image before adjustment, and L max is the maximum brightness of the target image before adjustment, L min is the minimum brightness value in the target image before adjustment.
[0028] Optionally, the target image is an image captured at a first preset period in the target image, and after determining the relative distance between the human body and the window according to the detection frame information and the depth information, the method further includes:
[0029] Determine the position change relationship between the human body and the window according to the relative distance between the human body and the window in the target image and the relative distance of the target image in the previous cycle;
[0030] When the position change relationship is far away, intercepting a target image in the target image at a second preset period, wherein the second preset period is greater than the first preset period;
[0031] In a case where the position change relationship is close, a target image is captured in the target image at a third preset period, wherein the third preset period is smaller than the first preset period.
[0032] According to a second aspect of the present disclosure, a device for determining a relative distance between a person and a window is provided, comprising:
[0033] A recognition module, configured to recognize a target image through a pre-trained target detection model, and obtain detection frame information of a first detection frame and a second detection frame, wherein the first detection frame is used to mark an area corresponding to a human body in the target image, and the second detection frame is used to mark an area corresponding to a window in the target image;
[0034] A first determination module is used to respectively determine depth information of a human body and a window in the target image;
[0035] The second determination module is used to determine the relative distance between the human body and the window according to the detection frame information and the depth information.
[0036] According to a third aspect of the present disclosure, an electronic device is provided, including a processor and a memory, wherein the memory stores computer instructions, and when the computer instructions are executed by the processor, the steps of any one of the methods described in the first aspect are implemented.
[0037] According to a fourth aspect of the present disclosure, there is provided a storage medium on which computer instructions are stored, and when the computer instructions are executed by a processor, the steps of any one of the methods described in the first aspect are implemented.
[0038] One technical effect of the present disclosure is that a method for determining the relative distance between a person and a window is provided. The detection information of a person and a window can be obtained in a target image through a pre-trained target detection model, and the depth information of the person and the window in the image can be obtained at the same time. The relative distance between the person and the window can be further determined based on the information. In this way, the distance between the person and the window can be monitored through images of the construction site so that prompts can be given later to avoid the occurrence of safety accidents.
[0039] Other features and advantages of the embodiments of the present disclosure will become apparent from the following detailed description of exemplary embodiments of the present disclosure with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The accompanying drawings, which constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain the principles of the embodiments of the present disclosure.
[0041] Figure 1 is a flow chart of a method for determining a relative distance between a person and a window according to an embodiment;
[0042] Figure 2 Schematic diagram of a device for determining the relative distance between a person and a window according to an embodiment
[0043] Figure 3 is a schematic structural diagram of an electronic device according to an embodiment; DETAILED DESCRIPTION
[0044] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention unless otherwise specifically stated.
[0045] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.
[0046] Techniques and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the techniques and equipment should be considered part of the specification.
[0047] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0048] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0049] The present application embodiment discloses a method for determining the relative distance between a person and a window, such as Figure 1 As shown, it includes steps S11 to S13.
[0050] Step S11, identifying the target image through a pre-trained target detection model, and obtaining detection frame information of a first detection frame and a second detection frame, wherein the first detection frame is used to mark the area corresponding to the human body in the target image, and the second detection frame is used to mark the area corresponding to the window in the target image.
[0051] In an example, the target detection model can be a target detection model such as YOLO, SSD, R-CNN, etc. The target detection model is a multi-task target detection model, and training data can be acquired in advance to train it to recognize various objects such as human bodies and windows in images.
[0052] In an embodiment of the present application, the target image may be an image of a home improvement site to be monitored, and the image may be an image taken by an ordinary monocular camera, or an image captured from an image taken by a camera.
[0053] In this embodiment, after the target image is input into the pre-trained target detection model, the target detection model can monitor the human body and window areas in the image respectively, obtain a first detection frame of the human body and a second detection frame of the window, and the detection frame information of these detection frames. The number of the first detection frame and the second detection frame can be one or more.
[0054] In an example of this embodiment, the detection frame information of the first detection frame and the second detection frame may include pixel coordinate information of the center point of the detection frame, height and width information of the detection frame, or position coordinate information of the detection frame boundary, etc.
[0055] Step S12, respectively determining the depth information of the human body and the window in the target image.
[0056] In this embodiment, the depth of the target image can be estimated based on a monocular depth estimation algorithm to obtain the depth value of each pixel. In this embodiment, the depth information of the human body and the window in the target image can be determined based on the detection frame information obtained in step S11. For example, the depth value of the center point of the first detection frame can be determined as the depth information of the human body, and the depth value of the center point of the second detection frame can be determined as the depth information of the window.
[0057] Step S13, determining the relative distance between the human body and the window according to the detection frame information and the depth information.
[0058] In an example of the present embodiment, the detection frame information of the first detection frame and the second detection frame includes the coordinates of the center points of the first detection frame and the second detection frame, and the relative distance between the human body and the window is determined according to the detection frame information and the depth information, including: determining a first vector representing the position of the human body and a second vector representing the position of the window according to the coordinates of the center points of the first detection frame and the second detection frame and the depth information of the human body and the window in the target image, and determining the cosine distance between the first vector and the second vector.
[0059] In the embodiment of the present application, after obtaining the coordinates of the center points of the first detection frame and the second detection frame and the depth information of the human body and the window, the vectors representing the position of the human body and the window can be determined based on the above information. It can be further expressed as (X p , Y p , D p ), where X p , Y p are the horizontal and vertical coordinates of the center point of the first detection frame, respectively, p is the depth information of the human body. Similarly, the second vector representing the window position It can be expressed as (X w , X w , D w ), X w , Y w are the horizontal and vertical coordinates of the center point of the second detection frame, respectively, w The depth information of the window.
[0060] After determining the first vector and the second vector, the cosine distance between the first vector and the second vector can be calculated. In this example, since the first vector and the second vector represent the positions of the human body and the window respectively, the actual distance between the two in space can be determined through the cosine distance. When the cosine distance is closer to 0, it means that the relative distance between the human body and the window is closer.
[0061] In one example, the cosine distance cosθ is determined by:
[0062]
[0063] In this example, a method for determining the relative distance between a person and a window is provided. Through a pre-trained target detection model, the detection frame information of the human body and the window can be obtained in the target image, and the depth information of the human body and the window in the image can be obtained. Based on this information, the relative distance between the human body and the window can be further determined. In this way, the distance between the human body and the window can be monitored through the image of the construction site, so that prompts can be given later to avoid the occurrence of safety accidents.
[0064] In an example of the present embodiment, the depth information of a human body and a window in a target image are determined respectively, including: determining the depth information of each pixel in the target image through a monocular depth estimation algorithm; taking the average depth information of each pixel in a first detection frame as the depth information of the human body in the image; and taking the average depth information of each pixel in a second detection frame as the depth information of the window in the image.
[0065] In this embodiment, the depth of the target image can be estimated based on a monocular depth estimation algorithm to obtain the depth value of each pixel. In this embodiment, the depth information of the human body and the window in the target image can be determined based on the detection frame information obtained in step S11, and the average value of the depth value of each pixel in the first detection frame can be determined, and the average value is determined as the depth information of the human body. At the same time, the average value of the depth value of each pixel in the second detection frame can also be determined, and the average value is determined as the depth information of the window.
[0066] In another example, when determining the window depth information, the pixels in the second detection frame whose brightness value is less than the threshold value can be first determined, and then, when calculating the window depth information, only the average depth value of this part of pixels is calculated. In this way, the problem of inaccurate window depth information caused by the depth value of some overly bright scenes or glass parts not being the actual window depth value can be avoided.
[0067] In an example of this embodiment, after determining the relative distance between the human body and the window based on the detection frame information and the depth information, the method also includes: determining whether the relative distance is less than a preset distance threshold; when the relative distance is less than the preset distance threshold, triggering a security risk prompt to remind the user to take necessary safety measures.
[0068] In this example, after determining the relative distance between the human body and the window in the image, it can be further determined whether a prompt is needed to avoid danger based on the relative distance. When the relative distance between the human body and the window is less than the preset distance threshold, it means that the user is relatively close to the window. At this time, voice or indicator lights can be used to remind the on-site personnel that they are close to the window and need to pay attention to safety. When the relative distance between the human body and the window is greater than or equal to the preset distance threshold, no prompt is required.
[0069] In this example, ordinary cameras can be used to detect construction safety in home improvement scenes. The images obtained from camera monitoring can be used to identify the relative distance between on-site personnel and windows, and judgments can be made based on thresholds to provide safety risk warnings and ensure the safety of on-site personnel.
[0070] In an example of this embodiment, the detection frame information of the second detection frame also includes the pixel height H of the second detection frame. windowand pixel width W window ; The preset distance threshold T is:
[0071]
[0072] Wherein, k is the adjustment coefficient. The specific value of k can be flexibly set based on the actual scene requirements. In this example, in order to adapt to the different safety levels brought by different window sizes, this embodiment introduces a dynamic threshold adjustment mechanism. This mechanism sets a dynamic safety distance threshold for the physical characteristics of each window, such as width, height, etc. The set threshold T is proportional to the height and width of the window. In other words, the larger the height and width of the window, the greater the possibility of on-site personnel falling from the window. Therefore, it is necessary to increase the distance that triggers the safety risk prompt to prompt the on-site personnel of the safety risk as early as possible. Similarly, the smaller the height and width of the window, the smaller the possibility of on-site personnel falling from the window. Therefore, the corresponding threshold setting can be set to a relatively small value. Only when the personnel are relatively close to the window, the prompt is given to avoid excessive tension on-site personnel and affect construction.
[0073] In an example of this embodiment, before respectively determining the depth information of the human body and the window in the target image, the method further includes:
[0074] The brightness and contrast of the target image are adjusted, where the adjusted brightness L adjusted for:
[0075] L adjusted =α·L+β
[0076] Adjusted contrast
[0077]
[0078] Among them, α, β, and γ are preset parameters, L is the brightness value of the target image before adjustment, and L max is the maximum brightness of the target image before adjustment, L min is the minimum brightness value in the target image before adjustment.
[0079] In this embodiment, considering that the illumination of the scene corresponding to the target image may change strongly, the brightness and contrast of the target image may be adjusted before determining the depth information of the human body and the window in the target image, so as to obtain more accurate depth information later. In this example, the brightness value of each pixel in the target image is obtained and adjusted. Specifically, the values of preset parameters such as α, β, and γ may be set according to actual adjustment requirements, thereby improving the robustness of depth estimation under complex lighting conditions.
[0080] In an example of the present embodiment, the target image is an image captured in a target image with a first preset period. After determining the relative distance between the human body and the window based on the detection frame information and the depth information, the method further includes: determining the position change relationship between the human body and the window based on the relative distance between the human body and the window in the target image and the relative distance of the target image in the previous period; when the position change relationship is far away, capturing the target image in the target image with a second preset period, wherein the second preset period is greater than the first preset period; when the position change relationship is close, capturing the target image in the target image with a third preset period, wherein the third preset period is less than the first preset period.
[0081] The target image may be an image captured by a camera in real time. In this example, the target image may be captured periodically in a preset cycle in the target image, so as to determine the relative distance between the human body and the window through the target image. In this example, the relative distance between the human body and the window in the target image of this cycle may be compared with the relative distance in the target image of the previous cycle to determine the relative motion relationship between the human body and the window. When the human body is far away from the window, the target image may be captured at a larger cycle and the relative distance may be determined, thereby reducing the amount of data processing while ensuring safety. When the human body is close to the window, the target image may be captured at a smaller cycle and the relative distance between the person and the window in the image may be detected, thereby ensuring that a safety reminder can be given to the user as soon as possible when the user approaches, thereby enhancing the user's safety.
[0082] The present application also provides a device 100 for determining the relative distance between a person and a window. Figure 2 As shown, it includes: an identification module 101, which is used to identify the target image through a pre-trained target detection model, and obtain detection frame information of a first detection frame and a second detection frame, wherein the first detection frame is used to mark the area corresponding to the human body in the target image, and the second detection frame is used to mark the area corresponding to the window in the target image; a first determination module 102, which is used to respectively determine the depth information of the human body and the window in the target image; a second determination module 103, which is used to determine the relative distance between the human body and the window according to the detection frame information and the depth information.
[0083] Optionally, the first determination module is specifically used to: determine the depth information of each pixel in the target image through a monocular depth estimation algorithm; use the average depth information of each pixel in the first detection frame as the depth information of the human body in the image; and use the average depth information of each pixel in the second detection frame as the depth information of the window in the image.
[0084] Optionally, the detection frame information of the first detection frame and the second detection frame includes the coordinates of the center points of the first detection frame and the second detection frame; the second determination module is specifically used to: determine a first vector representing the position of the human body and a second vector representing the position of the window according to the coordinates of the center points of the first detection frame and the second detection frame and the depth information of the human body and the window in the target image; determine the cosine distance between the first vector and the second vector.
[0085] Optionally, the device also includes: a prompt module, used to determine whether the relative distance is less than a preset distance threshold; when the relative distance is less than the preset distance threshold, trigger a security risk prompt to remind the user to take necessary safety measures.
[0086] Optionally, the detection frame information of the second detection frame also includes the pixel height H of the second detection frame. window and pixel width W window ;
[0087] The preset distance threshold T is:
[0088]
[0089] Where k is the adjustment coefficient.
[0090] Optionally, the device further comprises: an adjustment module, configured to adjust the brightness and contrast of the target image, wherein the adjusted brightness L adjusted for:
[0091] L adjusted =α·L+β
[0092] Adjusted contrast
[0093]
[0094] Among them, α, β, and γ are preset parameters, L is the brightness value of the target image before adjustment, and L max is the maximum brightness of the target image before adjustment, L min is the minimum brightness value in the target image before adjustment.
[0095] Optionally, the target image is an image captured in the target image with a first preset period, and the device also includes: a period adjustment module, used to determine the position change relationship between the human body and the window based on the relative distance between the human body and the window in the target image and the relative distance of the target image in the previous period; when the position change relationship is far away, the target image is captured in the target image with a second preset period, wherein the second preset period is greater than the first preset period; when the position change relationship is close, the target image is captured in the target image with a third preset period, wherein the third preset period is less than the first preset period.
[0096] like Figure 3 As shown, an embodiment of the present application further provides an electronic device 200, including a processor 201 and a memory 202, wherein the memory 202 stores computer instructions, and when the computer instructions are executed by the processor 201, the steps of any method in the embodiment of the method for determining the relative distance between a person and a window are implemented.
[0097] An embodiment of the present application also provides a storage medium on which computer instructions are stored. When the computer instructions are executed by a processor, any one of the above-mentioned embodiments for determining the relative distance between a person and a window is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0098] Each embodiment in the present disclosure is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and equipment embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0099] The above describes specific embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0100] The embodiments of the present disclosure may be systems, methods and / or computer program products. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the embodiments of the present disclosure.
[0101] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0102] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0103] The computer program instructions for performing the operation of the embodiments of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of a computer-readable program instruction, and the electronic circuit may execute a computer-readable program instruction, thereby realizing various aspects of the embodiments of the present disclosure.
[0104] Various aspects of the embodiments of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0105] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0106] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0107] The flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of an instruction, and a part of a module, a program segment or an instruction contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of the boxes in the block diagram and / or the flowchart can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. It is well known to those skilled in the art that it is equivalent to implement it by hardware, implement it by software, and implement it by combining software and hardware.
[0108] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for determining the relative distance between a person and a window, characterized in that: include: Recognize the target image through the pre-trained target detection model, and obtain detection frame information of a first detection frame and a second detection frame, wherein the first detection frame is used to mark the area corresponding to the human body in the target image, and the second detection frame is used to mark the area corresponding to the window in the target image; Determine depth information of a human body and a window in the target image respectively; The relative distance between the human body and the window is determined according to the detection frame information and the depth information.
2. According to the method of claim 1, the step of respectively determining the depth information of the human body and the window in the target image comprises: Determining the depth information of each pixel in the target image by a monocular depth estimation algorithm; Using the average depth information of each pixel in the first detection frame as the depth information of the human body in the image; The average depth information of each pixel in the second detection frame is used as the depth information of the window in the image.
3. The method according to claim 2, characterized in that The detection frame information of the first detection frame and the second detection frame includes coordinates of center points of the first detection frame and the second detection frame; and determining the relative distance between the human body and the window according to the detection frame information and the depth information includes: Determine a first vector representing the position of the human body and a second vector representing the position of the window according to the coordinates of the center points of the first detection frame and the second detection frame and the depth information of the human body and the window in the target image A cosine distance between the first vector and the second vector is determined.
4. The method according to claim 3, characterized in that: After determining the relative distance between the human body and the window according to the detection frame information and the depth information, the method further includes: Determining whether the relative distance is less than a preset distance threshold; When the relative distance is less than a preset distance threshold, a security risk prompt is triggered to remind the user to take necessary safety measures.
5. The method according to claim 4, characterized in that The detection frame information of the second detection frame also includes the pixel height H of the second detection frame. window and pixel width W window ; The preset distance threshold T is: Where k is the adjustment coefficient.
6. The method according to any one of claims 1 to 5, characterized in that: Before respectively determining the depth information of the human body and the window in the target image, the method further includes: The brightness and contrast of the target image are adjusted, wherein the adjusted brightness L adjusted for: L adjusted =α·L+β Adjusted contrast Among them, α, β, and γ are preset parameters, L is the brightness value of the target image before adjustment, and L max is the maximum brightness of the target image before adjustment, L min is the minimum brightness value in the target image before adjustment.
7. The method according to claim 6, characterized in that The target image is an image captured at a first preset period in the target image. After determining the relative distance between the human body and the window according to the detection frame information and the depth information, the method further includes: Determine the position change relationship between the human body and the window according to the relative distance between the human body and the window in the target image and the relative distance of the target image in the previous cycle; When the position change relationship is far away, intercepting a target image in the target image at a second preset period, wherein the second preset period is greater than the first preset period; In a case where the position change relationship is close, a target image is captured in the target image at a third preset period, wherein the third preset period is smaller than the first preset period.
8. A device for determining the relative distance between a person and a window, characterized in that: include: A recognition module, configured to recognize a target image through a pre-trained target detection model, and obtain detection frame information of a first detection frame and a second detection frame, wherein the first detection frame is used to mark an area corresponding to a human body in the target image, and the second detection frame is used to mark an area corresponding to a window in the target image; A first determination module is used to respectively determine depth information of a human body and a window in the target image; The second determination module is used to determine the relative distance between the human body and the window according to the detection frame information and the depth information.
9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer instructions, and when the computer instructions are executed by the processor, the steps of the method described in any one of claims 1 to 7 are implemented.
10. A storage medium, characterized in that: Computer instructions are stored thereon, and when the computer instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.