Distance detection method and apparatus, readable storage medium, and electronic device

By using the learning machine's front-facing camera and a lightweight face detection model, the problem of the learning machine's distance sensor being unable to determine the user's distance has been solved, achieving accurate distance detection and close-range eye protection reminders, thus improving the user experience.

CN116682157BActive Publication Date: 2026-03-27NEW ORIENTAL EDUCATION & TECH GRP CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-31
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing distance sensors in learning machines cannot effectively determine the distance of the user or whether the user is in front of the learning machine, and require special permissions to activate, thus failing to implement the close-range eye protection reminder function.

Method used

Images are acquired using the front-facing camera of the learning machine. Lightweight face detection models such as Mobilenetv2 network are used for image compression and face detection to determine the size of the face detection box and calculate the distance between the face and the learning machine based on the pre-measured mapping relationship.

Benefits of technology

It achieves accurate user distance determination without consuming excessive computing resources, improves user experience, avoids the drawbacks of proximity sensors, and provides a close-range eye protection reminder function.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116682157B_ABST
    Figure CN116682157B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a distance detection method, device, readable storage medium and electronic equipment, the method comprising: adjusting the size of a to-be-detected image containing a face to a specified size as a target image through a front camera of a learning machine, determining the size of a face detection frame in the target image through a pre-trained face detection model, and determining the distance between the face and the learning machine according to a pre-measured mapping relationship between the size of the face detection frame and the distance; determining the size of the face detection frame in the target image through the face detection model, and then determining the distance between the face and the learning machine according to the size of the face detection frame from the mapping relationship between the size of the face detection frame and the distance, thereby avoiding the disadvantages of using a distance sensor of the learning machine to determine the distance of a user, and improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of computer, in particular, to a distance detection method and device, a readable storage medium and an electronic device. BACKGROUND

[0002] When a student uses a learning machine, if the distance between the student and the learning machine is too close, the student's eyes will be hurt, so when the distance between the student and the learning machine is too close, a "too close" reminder is needed, and sometimes it is necessary to supervise whether the user is in front of the learning machine. In related technologies, the distance sensor of the learning machine is used to determine the distance between the user and the learning machine or to determine whether the user is in front of the learning machine. However, using the distance sensor has some disadvantages, for example, many learning machines do not have a distance sensor, or have a distance sensor but need special permission to start, so that the near distance eye protection reminder function and the function of determining whether there is a user cannot be realized. SUMMARY

[0003] The purpose of the present disclosure is to provide a distance detection method, device, electronic device and readable storage medium to solve the problems caused by the existing use of distance sensor to determine the distance between the user and the learning machine or to determine whether the user is in front of the learning machine.

[0004] According to a first aspect of an embodiment of the present disclosure, a distance detection method is provided, comprising: obtaining a to-be-detected image by a front camera of a learning machine; adjusting the size of the to-be-detected image containing a face to a specified size as a target image; determining the size of a face detection frame in the target image by a pre-trained face detection model; and determining the distance between the face and the learning machine according to the mapping relationship between the pre-measured size of the face detection frame and the distance and the size of the face detection frame.

[0005] Optionally, the step of adjusting the size of the to-be-detected image containing a face to a specified size as a target image comprises: reducing the channel number of the to-be-detected image to obtain a first to-be-detected image; screening out the first to-be-detected image containing a face by the face detection model; and adjusting the size of the first to-be-detected image containing a face to the specified size as a target image.

[0006] Optionally, the determining the distance between the face and the learning machine according to the mapping relationship between the size of the face detection frame and the distance and the size of the face detection frame comprises: in a case that the face region in the target image is greater than a specified threshold or only part of the face region in the target image, performing edge padding on the target image to obtain a padded target image; inputting the padded target image and the target image before padding into the face detection model for detection; in a case that a face is detected in both the padded target image and the target image before padding, determining the distance between the face and the learning machine according to the size of the face detection frame in the target image before padding; in a case that a face is detected in the padded target image and no face is detected in the target image before padding, determining the distance between the face and the learning machine according to the size of the face detection frame in the padded target image.

[0007] Optionally, the determining the distance between the face and the learning machine according to the mapping relationship between the size of the face detection frame and the distance and the size of the face detection frame comprises: in a case that the face region in the target image is less than or equal to a specified threshold, determining the corresponding distance from the mapping relationship according to the size of the face detection frame in the target image, as the distance between the face and the learning machine.

[0008] Optionally, the backbone network of the face detection model is mobilenetv2; and the reducing the channel number of the to-be-detected image to obtain a first to-be-detected image comprises: reducing the channel number of the to-be-detected image by the mobilenetv2, and compressing the size of the to-be-detected image by a convolution layer to obtain the first to-be-detected image.

[0009] Optionally, the screening the first to-be-detected image containing a face by the face detection model comprises: acquiring a face category confidence of the first to-be-detected image according to the pre-trained face detection model; and screening the first to-be-detected image containing the face from the first to-be-detected image according to the face category confidence.

[0010] Optionally, the determining the size of the face detection frame in the target image by the pre-trained face detection model comprises: acquiring a face detection frame confidence in the target image according to the face detection model; determining a face detection frame position in the target image according to the face detection frame confidence; and determining the size of the face detection frame according to the face detection frame position.

[0011] According to a second aspect of the embodiments of the present disclosure, a distance detection apparatus is provided, comprising: an acquisition module configured to acquire a to-be-detected image obtained by a front camera of a learning machine; an adjustment module configured to adjust a size of the to-be-detected image containing a face to a specified size as a target image; a detection module configured to determine a size of a face detection frame in the target image by a pre-trained face detection model; and a processing module configured to determine a distance between the face and the learning machine according to a pre-measured mapping relationship between the size of the face detection frame and the distance and the size of the face detection frame.

[0012] According to a third aspect of the embodiments of the present disclosure, a non-transitory computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the steps of the distance detection method.

[0013] According to a fourth aspect of the embodiments of the present disclosure, an electronic device is provided, comprising: a memory storing a computer program; and a processor configured to execute the computer program in the memory to implement the steps of the distance detection method.

[0014] The technical solution provided by the embodiments of the present disclosure can have the following beneficial effects: the to-be-detected image obtained by the front camera of the learning machine is adjusted to a specified size as a target image containing a face, the size of the face detection frame in the target image is determined by a pre-trained face detection model, and the distance between the face and the learning machine is determined according to the pre-measured mapping relationship between the size of the face detection frame and the distance and the size of the face detection frame; the size of the face detection frame in the target image is determined by the face detection model, and then the distance between the face and the learning machine is determined from the mapping relationship between the size of the face detection frame and the distance according to the size of the face detection frame, thereby avoiding the disadvantages of using the distance sensor of the learning machine to determine the distance of the user and improving the user experience.

[0015] It should be understood that the general description above and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS

[0016] The accompanying drawings are used to provide a further understanding of the present disclosure, and constitute a part of the specification, and are used to explain the present disclosure together with the specific embodiments described below, but do not constitute a limitation of the present disclosure. In the drawings:

[0017] Figure 1 is a structural schematic diagram of a computer system shown by an exemplary embodiment of the present disclosure.

[0018] Figure 2 is a flowchart of a distance detection method shown by an exemplary embodiment of the present disclosure.

[0019] Figure 3 is a flowchart of sub-steps of step S102 shown by the exemplary embodiments of the present disclosure.

[0020] Figure 4 is a block diagram of a distance detection device shown by the exemplary embodiments of the present disclosure.

[0021] Figure 5 is a block diagram of an electronic device shown by the exemplary embodiments of the present disclosure. DETAILED DESCRIPTION

[0022] The specific embodiments of the present disclosure will be described below in detail with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely intended to illustrate and explain the present disclosure, and are not intended to limit the present disclosure.

[0023] The following description refers to the accompanying drawings. Wherever possible, the same reference numbers in different drawings refer to the same or similar elements. The embodiments described in the following exemplary embodiments are not meant to represent all embodiments consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0024] Figure 1 is a structural diagram of a computer system including the terminal 120 and the server 140, shown by the exemplary embodiments of the present disclosure.

[0025] The terminal 120 and the server 140 are connected to each other through a wired or wireless network.

[0026] The terminal 120 can include at least one of a smartphone, a tablet, and a smart learning machine.

[0027] The terminal 120 includes a display; the display can be used to display a learning video or a learning picture.

[0028] The terminal 120 comprises a first memory and a first processor. The first memory stores a first program, and the first program is invoked by the first processor to implement the distance detection method provided by the present disclosure. The first memory can include, but is not limited to, the following: Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), and Electric Erasable Programmable Read-Only Memory (EEPROM).

[0029] The first processor can be composed of one or more integrated circuit chips. Alternatively, the first processor can be a general-purpose processor, such as a Central Processing Unit (CPU) or a Network Processor (NP). For example, the trained face detection model in the terminal can be trained by the terminal; or trained by a server and obtained by the terminal from the server.

[0030] The server 140 comprises a second memory and a second processor. The second memory stores a second program, and the second program is invoked by the second processor to implement the distance detection method provided by the present disclosure. Alternatively, the second memory can include, but is not limited to, the following: RAM, ROM, PROM, EPROM, EEPROM. Alternatively, the second processor can be a general-purpose processor, such as a CPU or an NP.

[0031] The server can be a standalone physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and basic cloud computing services such as big data and artificial intelligence platforms. The terminal can be a smartphone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal and the server can be connected directly or indirectly through wired or wireless communication, and the present disclosure does not limit this.

[0032] In the related art, a distance sensor of a learning machine is used to determine the distance of a user or whether the user is in front of the learning machine. A Gaussian bracket learning machine uses such a distance sensor to detect the distance between the user and the learning machine. The front camera of such a learning machine is equipped with a mirror. When the learning machine is placed vertically, the mirror allows the learning machine to obtain the text picture on the desktop, thereby causing the distance sensor to misreact and prompting a pop-up window from the background, which interferes with normal learning.

[0033] To solve the above problems, the present disclosure provides a distance detection method. Please refer to Figure 2 , Figure 2 is a flowchart of a distance detection method according to an exemplary embodiment of the present disclosure. The method is executed by a computer device, for example, a learning machine terminal in the computer system shown in Figure 1 . Figure 2 The distance detection method shown in

[0034] In step S101, a to-be-detected image is obtained by a front camera of a learning machine.

[0035] For example, when a user uses a learning machine for learning, the learning machine can obtain a to-be-detected image of a front region through a front camera of the learning machine. The front region is the field of view of the front camera, and the to-be-detected image is an image containing the front region.

[0036] In step S102, the size of the to-be-detected image containing the face is adjusted to a specified size as a target image.

[0037] The distance warning algorithm based on the distance sensor in the related art is a background resident application of the learning machine that needs to be called frequently. Therefore, the overall process is relatively simple, and only needs to be judged according to the output value of the distance sensor. Considering the usability of the distance detection method, the judgment method of obtaining the to-be-detected image by the front camera also needs to be resident in the background of the learning machine. Therefore, a too complex face detection algorithm cannot be used, and a very lightweight face detection model is needed. The to-be-detected image is compressed to facilitate the learning machine to run in the background without consuming too much computing resource.

[0038] In order to reduce the consumption of computing resources, the to-be-detected image needs to be compressed to reduce the number of parameters that need to be calculated. The method of compressing the to-be-detected image will be described in detail in the sub-step of step S102. Please refer to Figure 3 , Figure 3 is a flowchart of a sub-step of step S102 according to an exemplary embodiment of the present disclosure.

[0039] In sub-step S1021, the number of channels of the to-be-detected image is reduced to obtain a first to-be-detected image.

[0040] In order to make the face detection model lightweight, the backbone network of the face detection model can adopt a mobilenetv2 network. The mobileNetV2 is a network that introduces a linear bottleneck and an inverted residual to improve the representation ability of the network on the basis of the mobileNetV1, and is a lightweight neural network.

[0041] Exemplarily, the mobilenetv2 network can be used to reduce the channel number of the to-be-detected image to obtain a first to-be-detected image. For example, the channel number of the to-be-detected image is reduced to 0.25 times of the original number by the mobilenetv2 to obtain a feature map. The size of the to-be-detected image before the channel number is reduced is 224*224, and the size of the feature map after the mobilenetv2 network is 14*14. In order to further compress the required computing resources, a convolutional layer is added in the face detection model. The convolutional layer is used to further compress the 14*14 feature map into a 7*7 feature map, and the feature map is taken as the first to-be-detected image.

[0042] It should be noted that the addition of the convolutional layer can reduce the number of parameters to be calculated and reduce the required computing resources.

[0043] In sub-step S1022, the first to-be-detected image containing the face is screened out by the face detection model.

[0044] The 7*7 first to-be-detected image is obtained through the above-mentioned mobilenetv2 network and convolutional layer. In this step, the first to-be-detected image containing the face is screened out by the output layer of the face detection model. The first to-be-detected image has two categories: containing the face and not containing the face.

[0045] Exemplarily, the face class confidence of the first to-be-detected image can be obtained through the output layer, and whether the first to-be-detected image contains the face is determined according to the face class confidence. When the face class confidence is greater than or equal to a specified threshold, it is considered that the first to-be-detected image contains the face. When the face class confidence is less than the specified threshold, it is considered that the first to-be-detected image does not contain the face. The specified threshold can be but is not limited to 0.8.

[0046] It should be noted that in the case where it is detected that the to-be-detected image does not contain the face, it can be determined that the user is not learning in front of the learning machine, and a warning of no one learning is issued.

[0047] In sub-step S1023, the size of the first to-be-detected image containing the face is adjusted to a specified size as a target image.

[0048] The size of the first to-be-detected image is adjusted to a specified size by the face detection model as a target image, wherein the specified size can be obtained based on empirical data or other feasible manners, which is not limited herein.

[0049] In step S103, the size of the face detection frame in the target image is determined by the pre-trained face detection model.

[0050] The manner of determining the size of the face detection frame in the target image includes: obtaining the face detection frame confidence in the target image according to the face detection model, determining the face detection frame position in the target image according to the face detection frame confidence, and determining the size of the face detection frame according to the face detection frame position. When the face in the target image is framed, one or more pre-selected frames are calculated. The position of the pre-selected frame can be determined by the coordinates (x0, y0) of the upper left corner and the coordinates (x1, y1) of the lower right corner of the pre-selected frame. The size ratio of each pre-selected frame can be 1*1, 1*1.2, and 1.2*1, respectively. The face detection frame is selected from the pre-selected frame according to the size of the face detection frame confidence. For example, the pre-selected frame with the maximum face detection frame confidence can be selected as the face detection frame. After the face detection frame is determined, the size of the face detection frame can be determined according to the coordinates of the upper left corner and the coordinates of the lower right corner of the face detection frame.

[0051] In the foregoing steps, each target image is adjusted to a specified size. In the case of a fixed target image size, the larger the face detection frame, the closer the face is to the learning machine, and the smaller the face detection frame, the farther the face is from the learning machine.

[0052] In step S104, the distance between the face and the learning machine is determined according to the pre-measured mapping relationship between the size of the face detection frame and the distance, and the size of the face detection frame.

[0053] The mapping relationship between the size of the face detection frame and the distance is pre-measured. For example, first, fix the learning machine, and calibrate the size of the face detection frame according to the distance of the face. In the case where the distance between the face and the learning machine is greater than or equal to the minimum distance threshold and less than the maximum distance threshold, calibrate the size of the face detection frame every specified distance. The minimum distance threshold can be, but is not limited to, 7 cm, the maximum distance threshold can be, but is not limited to, 100 cm, and the specified distance can be, but is not limited to, 1 cm, i.e., the distance between the face and the learning machine is taken every 1 cm from 7 cm to 100 cm, a total of 74 distance values, and the size of the face detection frame corresponding to each distance is calibrated, thereby obtaining the mapping relationship between the size of the face detection frame and the distance. After obtaining the mapping relationship between the size of the face detection frame and the distance, the distance between the face and the learning machine can be obtained based on the size of the face detection frame from the mapping relationship.

[0054] It should be noted that, in the case that the distance between the face and the learning machine is less than the minimum distance threshold, at this time the face is too close to the learning machine, and the face in the obtained target image can not be completely in the target image, for example, only the upper half or the lower half of the face in the target image, such a target image can greatly reduce the recall rate of the face detection model and cannot meet the needs of actual applications. Therefore, in the case that the face region in the target image is greater than a specified threshold or only part of the face region in the target image, the target image can be padded first to obtain a padded target image, for example, the pixels in the fixed-width regions of the top, bottom, left and right of the target image can be padded with 0 or 1 respectively. Experiments show that when the fixed width is one sixth of the width and height of the target image, that is, one sixth of the height of the target image is padded to the top and bottom edges of the target image, and one sixth of the width of the target image is padded to the left and right edges of the target image, in this case, the face detection model can achieve the highest recall rate. Then, the padded target image and the target image before padding are input into the face detection model for detection; in the case that the face is detected in both the padded target image and the target image before padding, the distance between the face and the learning machine is determined by the size of the face detection frame in the target image before padding, and in the case that the face is detected in the padded target image and not detected in the target image before padding, the distance between the face and the learning machine is determined by the size of the face detection frame in the padded target image.

[0055] In summary, the distance detection method provided by the present disclosure includes: adjusting the size of a to-be-detected image containing a face to a specified size as a target image through a front camera of a learning machine, determining the size of a face detection frame in the target image through a pre-trained face detection model, and determining the distance between the face and the learning machine according to a pre-measured mapping relationship between the size of the face detection frame and the distance and the size of the face detection frame; determining the size of the face detection frame in the target image through the face detection model, and then determining the distance between the face and the learning machine from the mapping relationship between the size of the face detection frame and the distance according to the size of the face detection frame, thereby avoiding the drawbacks of using a distance sensor of the learning machine to determine the distance of the user and improving the user experience.

[0056] Figure 4 is a distance detection device block diagram shown by an exemplary embodiment of the present disclosure. Referring to Figure 4 , the distance detection device 20 includes an acquisition module 201, an adjustment module 202, a detection module 203 and a processing module 204.

[0057] The acquisition module 201 is configured to acquire a to-be-detected image through a front camera of a learning machine;

[0058] The adjusting module 202 is configured to adjust a size of the to-be-detected image containing a face to a specified size as a target image.

[0059] The detecting module 203 is configured to determine a size of a face detection frame in the target image by using a pre-trained face detection model.

[0060] The processing module 204 is configured to determine the distance between the face and the learning machine according to a mapping relationship between the size of the face detection frame and the distance and the size of the face detection frame.

[0061] Optionally, the adjusting module 202 is further configured to reduce a channel number of the to-be-detected image to obtain a first to-be-detected image.

[0062] The first to-be-detected image containing the face is filtered out by using the face detection model.

[0063] The size of the first to-be-detected image containing the face is adjusted to the specified size as the target image.

[0064] Optionally, the processing module 204 is further configured to perform edge padding on the target image to obtain a padded target image, in a case where a face region in the target image is greater than a specified threshold or only a partial face region is in the target image.

[0065] The padded target image and the target image before padding are input into the face detection model for detection.

[0066] In a case where a face is detected in both the padded target image and the target image before padding, the distance between the face and the learning machine is determined according to the size of the face detection frame in the target image before padding.

[0067] In a case where a face is detected in the padded target image and no face is detected in the target image before padding, the distance between the face and the learning machine is determined according to the size of the face detection frame in the padded target image.

[0068] Optionally, the processing module 204 is further configured to, in a case where a face region in the target image is less than or equal to a specified threshold, determine a corresponding distance from the mapping relationship as the distance between the face and the learning machine according to the size of the face detection frame in the target image.

[0069] Optionally, the adjusting module 202 is further configured to reduce a channel number of the to-be-detected image by using the mobilenetv2 and compress the size of the to-be-detected image by using a convolution layer to obtain a first to-be-detected image.

[0070] Optionally, the adjusting module 202 is further configured to acquire a face category confidence of the first image to be detected according to the pre-trained face detection model.

[0071] According to the face category confidence, the first image to be detected containing a face is filtered out from the first image to be detected.

[0072] Optionally, the detecting module 203 is further configured to acquire a face bounding box confidence of the target image according to the face detection model.

[0073] According to the face bounding box confidence, a face bounding box position in the target image is determined.

[0074] According to the face bounding box position, a size of the face bounding box is determined.

[0075] As to the apparatus in the above-described embodiments, the specific manners in which various modules perform operations have been described in details in the embodiments of the method, and thus will not be described in details here.

[0076] Figure 5 is a block diagram of an electronic device according to an example embodiment. As shown in Figure 5 , the electronic device 400 can be a learning machine terminal as shown in Figure 1 , the electronic device 400 can include a processor 401 and a memory 402. The electronic device 400 can further include one or more of a multimedia component 403, an input / output (I / O) interface 404, and a communication component 405.

[0077] The processor 401 is configured to control overall operations of the electronic device 400 to complete all or part of the steps of the distance detection method described above. The memory 402 is configured to store various types of data to support operations of the electronic device 400, which can include, for example, instructions for operating any application or method on the electronic device 400, and application-related data, such as contact data, sent and received messages, pictures, audio, video, and the like. The memory 402 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic disk, or an optical disk. The multimedia component 403 can include a screen and an audio component. The screen can be, for example, a touch screen, and the audio component is configured to output and / or input audio signals. For example, the audio component can include a microphone configured to receive external audio signals. The received audio signals can be further stored in the memory 402 or transmitted through the communication component 405. The audio component also includes at least one speaker configured to output audio signals. The I / O interface 404 provides an interface between the processor 401 and other interface modules, which can be a keyboard, a mouse, a button, and the like. The buttons can be virtual buttons or physical buttons. The communication component 405 is configured to perform wired or wireless communication between the electronic device 400 and other devices. The wireless communication, such as Wi-Fi, Bluetooth, near field communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, and the like, or a combination of one or more of them, is not limited herein. Therefore, the corresponding communication component 405 can include a Wi-Fi module, a Bluetooth module, an NFC module, and the like.

[0078] In an exemplary embodiment, the electronic device 400 can be implemented by one or more Application Specific Integrated Circuit (ASIC), Digital Signal Processor (DSP), Digital Signal Processing Device (DSPD), Programmable Logic Device (PLD), Field Programmable Gate Array (FPGA), controller, microcontroller, microprocessor or other electronic elements for performing the distance detection method described above.

[0079] In another exemplary embodiment, a computer readable storage medium including program instructions is also provided, which, when executed by a processor, implement the steps of the distance detection method described above. For example, the computer readable storage medium can be the memory 402 described above including program instructions, which can be executed by the processor 401 of the electronic device 400 to complete the distance detection method described above.

[0080] In another exemplary embodiment, a computer readable storage medium including program instructions is also provided, which, when executed by a processor, implement the steps of the distance detection method described above. For example, the computer readable storage medium can be the memory 402 described above including program instructions, which can be executed by the processor 401 of the electronic device 400 to complete the distance detection method described above.

[0081] In another exemplary embodiment, a computer program product is also provided, which contains a computer program capable of being executed by a programmable device, and the computer program has code portions for performing the distance detection method described above when executed by the programmable device.

[0082] The preferred embodiments of the present disclosure are described in detail above with reference to the accompanying drawings, but the present disclosure is not limited to the specific details of the above-described embodiments. Within the technical concept of the present disclosure, various simple modifications can be made to the technical solutions of the present disclosure, and these simple modifications all belong to the protection scope of the present disclosure.

[0083] In addition, it should be noted that each specific technical feature described in the above specific embodiments can be combined in any appropriate manner without contradiction, and in order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.

[0084] Furthermore, the various embodiments of the present disclosure can be arbitrarily combined with each other unless they contradict each other, and it should be understood that the same should be construed as being included in the disclosure of the present disclosure.

Claims

1. A distance detection method characterized by, include: The image to be detected is obtained through the front-facing camera of the learning machine; Reduce the number of channels in the image to be detected to obtain a first image to be detected; The first image to be detected, containing a face, is selected using a face detection model. The size of the first image to be detected, which contains a human face, is adjusted to a specified size and used as the target image. The size of the face detection box in the target image is determined by a pre-trained face detection model; If the face region in the target image is larger than a specified threshold, or if only a portion of the face region is in the target image, edge filling is performed on the target image to obtain a filled target image. The filled target image and the unfilled target image are respectively input into the face detection model for detection; If a face is detected in both the filled target image and the unfilled target image, the distance between the face and the learning machine is determined by the size of the face detection box in the unfilled target image. If a face is detected in the filled target image, but no face is detected in the unfilled target image, the distance between the face and the learning machine is determined by the size of the face detection box in the filled target image. The backbone network of the face detection model is MobileNetv2; reducing the number of channels in the image to be detected to obtain the first image to be detected includes: The number of channels in the image to be detected is reduced by the Mobilenetv2, and the size of the image to be detected is compressed by a convolutional layer to obtain a first image to be detected.

2. The method of claim 1, wherein, The method further includes: If the face region in the target image is less than or equal to a specified threshold, the corresponding distance is determined from the mapping relationship based on the size of the face detection box in the target image, and is used as the distance between the face and the learning machine.

3. The method of claim 1, wherein, The step of filtering out the first image to be detected containing a face using the face detection model includes: The face category confidence score of the first image to be detected is obtained based on the pre-trained face detection model; The first image containing a face is selected from the first image to be detected based on the face category confidence score.

4. The method of claim 1, wherein, The step of determining the size of the face detection box in the target image using a pre-trained face detection model includes: The confidence scores of the face detection bounding boxes in the target image are obtained based on the face detection model. The position of the face detection box in the target image is determined based on the confidence score of the face detection box; The size of the face detection box is determined based on its position.

5. A distance detection device, characterized by include: The acquisition module is used to acquire the image to be detected through the front-facing camera of the learning machine; An adjustment module is used to reduce the number of channels in the image to be detected, thereby obtaining a first image to be detected; The face detection model is used to select a first image to be detected that contains a face; the size of the first image to be detected containing a face is adjusted to a specified size and used as the target image; The detection module is used to determine the size of the face detection box in the target image using a pre-trained face detection model; The processing module is configured to perform edge padding on the target image to obtain a padded target image, in a case where a face region in the target image is greater than a specified threshold or only a partial face region is in the target image. The padded target image and the target image before padding are respectively input into the face detection model for detection; in a case where a face is detected in both the padded target image and the target image before padding, the distance between the face and the learning machine is determined according to the size of a face detection frame in the target image before padding; in a case where a face is detected in the padded target image and no face is detected in the target image before padding, the distance between the face and the learning machine is determined according to the size of a face detection frame in the padded target image. The backbone network of the face detection model is mobilenetv2. The adjusting module is specifically configured to reduce the channel number of the to-be-detected image by using the mobilenetv2, and compress the size of the to-be-detected image by using a convolution layer to obtain a first to-be-detected image.

6. A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1-4.

7. An electronic device, comprising: Comprise: a memory having a computer program stored thereon; a processor configured to execute the computer program in the memory to implement the steps of the method in any one of claims 1-4.

Citation Information

Patent Citations

  • Face space positioning method, device and system and computer storage medium

    CN108875529A

  • Adaptive local face recognition method and system for security field

    CN113869169A

  • End-to-end expression detection method and system

    CN115798007A