WO2021042867A1 - 一种实现人脸检测的方法和装置 - Google Patents

一种实现人脸检测的方法和装置 Download PDF

Info

Publication number
WO2021042867A1
WO2021042867A1 PCT/CN2020/101092 CN2020101092W WO2021042867A1 WO 2021042867 A1 WO2021042867 A1 WO 2021042867A1 CN 2020101092 W CN2020101092 W CN 2020101092W WO 2021042867 A1 WO2021042867 A1 WO 2021042867A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
coordinate system
resolution
face detection
coordinate
Prior art date
Application number
PCT/CN2020/101092
Other languages
English (en)
French (fr)
Inventor
刘若鹏
栾琳
季春霖
杨亮
Original Assignee
西安光启未来技术研究院
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 西安光启未来技术研究院 filed Critical 西安光启未来技术研究院
Publication of WO2021042867A1 publication Critical patent/WO2021042867A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/161Detection; Localisation; Normalisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition

Definitions

  • the embodiment of the present invention relates to, but is not limited to, the field of face detection technology and monitoring, and particularly refers to a method and device for realizing face detection.
  • the embodiment of the present invention provides a method and device for realizing face detection, which can realize face detection on an image when the resolution of the face detection model is smaller than the resolution of the image.
  • the embodiment of the present invention provides a method for realizing face detection, including:
  • the obtained first coordinate information is converted into the second coordinate information of the face in the second image in the first coordinate system corresponding to the first image.
  • the splitting of the first image into N second images with a resolution less than or equal to the resolution of the face detection model includes any one or more of the following:
  • the first image is split into N1 second images; where N1 is greater than 1.
  • N1 When the ratio of the resolution of the first image to the resolution of the face detection model is greater than or equal to N1 and less than or equal to N2, split the first image into N2 second images; N2 is an integer greater than N1.
  • the splitting of the first image into N second images with a resolution less than or equal to the resolution of the face detection model includes any one or more of the following:
  • the ratio of the resolution of the first image to the resolution of the face detection model is greater than or equal to N1 and less than or equal to N2, the first image is split into N2 equal resolutions.
  • the second image is greater than or equal to N1 and less than or equal to N2.
  • the N2 is the square of the N1.
  • the N1 is 4, and the N2 is 16.
  • the splitting the first image into N2 second images includes:
  • the resolutions of the N second images are equal.
  • the conversion of the obtained first coordinate information into the second coordinate information of the face in the second image in the first coordinate system corresponding to the first image includes:
  • the first coordinate information is converted into the second coordinate information according to the conversion relationship between the first coordinate system and the second coordinate system.
  • the embodiment of the present invention provides a device for realizing face detection, including a processor and a computer-readable storage medium.
  • the computer-readable storage medium stores instructions. When the instructions are executed by the processor, Any of the above methods for realizing face detection.
  • the embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the aforementioned methods for realizing face detection are realized.
  • the embodiment of the present invention includes: when the resolution of the first image is greater than the resolution of the face detection model, splitting the first image into N first images with a resolution less than or equal to the resolution of the face detection model Two images; where N is an integer greater than 1; for each of the second images, obtain the first coordinate information of the face in the second image in the second coordinate system corresponding to the second image; The obtained first coordinate information is converted into the second coordinate information of the face in the second image in the first coordinate system corresponding to the first image.
  • the embodiment of the present invention adopts a face detection model with a resolution smaller than that of the first image to realize face detection on the first image without changing a more complex face detection model to realize face detection, thereby reducing the difficulty of software development, and , No need to upgrade the hardware.
  • Fig. 1 is a flowchart of a method for realizing face detection proposed by an embodiment of the present invention
  • FIG. 2 is a schematic diagram of a first coordinate system and a second coordinate system established by dividing the first image into quarters in an embodiment of the present invention
  • Fig. 3 is a schematic diagram of the first coordinate system and the second coordinate system established by dividing the first image by 16 equal time in the embodiment of the present invention
  • Fig. 4 is a schematic structural composition diagram of an apparatus for realizing face detection proposed by another embodiment of the present invention.
  • an embodiment of the present invention proposes a method for realizing face detection, including:
  • Step 100 When the resolution of the first image is greater than the resolution of the face detection model, split the first image into N second images with a resolution less than or equal to the resolution of the face detection model; Wherein, N is an integer greater than 1.
  • the resolution of the face detection model refers to the maximum resolution of an image that can be detected by the face detection model.
  • the first image may be a pre-stored image or an image in a continuous video stream.
  • the first image is mapped in the memory of the embedded system, and the first image can be split into N second images according to the address in the memory.
  • the resolutions of the N second images may be equal or unequal.
  • splitting the first image into N second images with a resolution less than or equal to the resolution of the face detection model includes any one or more of the following:
  • the first image is split into N1 second images; where N1 is greater than 1.
  • N2 is an integer greater than N1;
  • the ratio of the resolution of the first image to the resolution of the face detection model is greater than or equal to N1 and less than or equal to N2, the first image is split into N2 equal resolutions.
  • the second image is greater than or equal to N1 and less than or equal to N2.
  • N2 is the square of N1.
  • N1 is 4 and N2 is 16.
  • the values of N1 and N2 are not limited to 4 and 16, and other values are within the protection scope of the embodiment of the present invention.
  • N2 is the square of N1
  • first image when the first image is split into N2 second images, it can be directly split into N2 second images; or the first image can be split into N1 first.
  • Third images and then split each third image into N1 second images.
  • the resolutions of the N1 third images may be equal or unequal.
  • the method of splitting the first image in the embodiment of the present invention is not limited to the methods listed above, and the specific splitting method is not used to limit the protection scope of the embodiment of the present invention.
  • Step 101 For each of the second images, obtain first coordinate information of the face in the second image in the second coordinate system corresponding to the second image; convert the obtained first coordinate information into Second coordinate information of the face in the second image in the first coordinate system corresponding to the first image.
  • a face detection model is used to perform face detection on the second image to obtain first coordinate information of the face in the second image in the second coordinate system corresponding to the second image .
  • the first coordinate information of the human face in the second coordinate system corresponding to the second image refers to the first coordinate information of the rectangular frame in which the human face is located in the second coordinate system corresponding to the second image.
  • One coordinate information, the second coordinate information of the face in the first coordinate system corresponding to the first image also refers to the second coordinate of the rectangular frame in which the face is located in the first coordinate system corresponding to the first image information.
  • converting the obtained first coordinate information into the second coordinate information of the face in the second image in the first coordinate system corresponding to the first image includes:
  • the first coordinate information is converted into the second coordinate information according to the conversion relationship between the first coordinate system and the second coordinate system.
  • the conversion relationship between the first coordinate system and the second coordinate system may be based on the translation relationship between the first coordinate system and the second coordinate system, and the relationship between the first coordinate system and the second coordinate system.
  • the rotation relationship is determined.
  • the translation relationship can be determined according to the coordinate origin of the first coordinate system and the coordinate origin of the second coordinate system, and the rotation relationship can be determined according to the direction of the x-axis of the first coordinate system and the x-axis of the second coordinate system, and the direction of the first coordinate system.
  • the direction of the y-axis and the y-axis of the second coordinate system are determined.
  • the first image is split into four second images with equal resolution
  • the first image P is split into a second image P1, a second image P2, a second image P3, and a second image.
  • the second image P4 suppose that the first coordinate system is XOY, the second coordinate system corresponding to the second image P1 is X 1 O 1 Y 1 , and the second coordinate system corresponding to the second image P2 is X 2 O 2 Y 2 ,
  • the second coordinate system corresponding to the second image P3 is X 3 O 3 Y 3 , and the second coordinate system corresponding to the second image P4 is X 4 O 4 Y 4 ;
  • the resolution of the second image is (n ⁇ a) ⁇ (n ⁇ c) and the resolution of the face detection model is a ⁇ c.
  • the coordinate origin of the first coordinate system is the lower left corner of the first image P
  • the x-axis direction is parallel to the first direction of the first image P
  • the y-axis direction is parallel to the second direction of the first image P;
  • the coordinate origin of the second coordinate system corresponding to the second image P1 is the lower left corner of the second image P1, the x-axis direction is parallel to the first direction of the second image P1, and the y-axis direction is parallel to the second direction of the second image P1;
  • the coordinate origin of the second coordinate system corresponding to the second image P2 is the lower left corner of the second image P2, the x-axis direction is parallel to the first direction of the second image P2, and the y-axis direction is parallel to the second direction of the second image P2;
  • the coordinate origin of the second coordinate system corresponding to the second image P3 is the lower left corner of the second image P3, the x-axis direction is parallel to the first direction of the second image P3, and the y-axis direction is parallel to the second direction of the second image P3;
  • the coordinate origin of the second coordinate system corresponding to the second image P4 is the lower left corner of the second image P4, the x-axis direction is parallel to the first direction of the second image P4, and the y-axis direction is parallel to the second direction of the second image P4.
  • the conversion relationship between the first coordinate system and the second coordinate system corresponding to the second image P1 is:
  • (X, Y) is the coordinate of a point on the second image P1 or the second image P2 or the second image P3 or the second image P4 in the first coordinate system corresponding to the first image P
  • (X 1 , Y 1 ) is the coordinate of a point on the second image P1 in the second coordinate system corresponding to the second image P1
  • (X 2 , Y 2 ) is the second coordinate of a point on the second image P2 in the second image P2
  • the coordinates in the system (X 3 , Y 3 ) is the coordinates of a certain point on the second image P3 in the second coordinate system corresponding to the second image P3
  • (X 4 , Y 4 ) is a certain point on the second image P4
  • the first image is split into 16 second images with equal resolution
  • the first image P is split into a second image P11, a second image P12, a second image P13, Second image P14, second image P21, second image P22, second image P23, second image P24, second image P31, second image P32, second image P33, second image P34, second image P41
  • the first coordinate system is XOY
  • the second coordinate system corresponding to the second image P11 is X 11 O 11 Y 11
  • the second image P12 corresponds to
  • the second coordinate system is X 12 O 12 Y 12
  • the second coordinate system corresponding to the second image P13 is X 13 O 13 Y 13
  • the second coordinate system corresponding to the second image P14 is X 14 O 14 Y 14
  • the second coordinate system corresponding to the image P21 is X 21 O 21 Y 21 ,
  • the second coordinate system corresponding to the second image P24 is X 24 O 24 Y 24 ;
  • the second coordinate system corresponding to the second image P31 is X 31 O 31 Y 31
  • the second coordinate system corresponding to the second image P32 is X 32 O 32 Y 32
  • the second coordinate system corresponding to the second image P33 is X 33 O 33 Y 33
  • the second coordinate system corresponding to the second image P34 is X 34 O 34 Y 34
  • the second image P41 corresponds to the second coordinate system
  • the coordinate system is X 41 O 41 Y 41
  • the second coordinate system corresponding to the second image P42 is X 42 O 42 Y 42
  • the second coordinate system corresponding to the second image P43 is X 43 O 43 Y 43
  • the second image P44 The corresponding second coordinate system is X 44 O 44 Y 44 ;
  • the resolution of the second image is (n ⁇ a) ⁇ (n ⁇ c) and the resolution of the face detection model is a ⁇ c.
  • the coordinate origin of the first coordinate system is the lower left corner of the first image P
  • the x-axis direction is parallel to the first direction of the first image P
  • the y-axis direction is parallel to the second direction of the first image P;
  • the coordinate origin of the second coordinate system corresponding to the second image P11 is the lower left corner of the second image P11, the x-axis direction is parallel to the first direction of the second image P11, and the y-axis direction is parallel to the second direction of the second image P11;
  • the coordinate origin of the second coordinate system corresponding to the second image P12 is the lower left corner of the second image P12, the x-axis direction is parallel to the first direction of the second image P12, and the y-axis direction is parallel to the second direction of the second image P12;
  • the coordinate origin of the second coordinate system corresponding to the second image P13 is the lower left corner of the second image P13, the x-axis direction is parallel to the first direction of the second image P13, and the y-axis direction is parallel to the second direction of the second image P3;
  • the coordinate origin of the second coordinate system corresponding to the second image P14 is the lower left corner of the second image P14, the x-axis direction is parallel to the first direction of the second image P14, and the y-axis direction is parallel to the second direction of the second image P14;
  • the second image (P21, P22, P23, P24, P31, P32, P33, P34, P41, P42, P43, P44) respectively correspond to the coordinate origin, x-axis direction and y-axis direction of the second coordinate system Determine in the same way.
  • the conversion relationship between the first coordinate system and the second coordinate system corresponding to the second image P11 is:
  • the conversion relationship between the first coordinate system and the second coordinate system corresponding to the second image P12 is:
  • the conversion relationship between the first coordinate system and the second coordinate system corresponding to the second image P13 is:
  • the conversion relationship between the first coordinate system and the second coordinate system corresponding to the second image P14 is:
  • the conversion relationship between the first coordinate system and the second coordinate system corresponding to the second image P21 is:
  • the conversion relationship between the first coordinate system and the second coordinate system corresponding to the second image P24 is:
  • the conversion relationship between the first coordinate system and the second coordinate system corresponding to the second image P31 is:
  • the conversion relationship between the first coordinate system and the second coordinate system corresponding to the second image P32 is:
  • the conversion relationship between the first coordinate system and the second coordinate system corresponding to the second image P41 is:
  • (X, Y) is the coordinate of a point on the second image P1 or the second image P2 or the second image P3 or the second image P4 in the first coordinate system corresponding to the first image P
  • (X 11 , Y 11 ) is the coordinate of a certain point on the second image P1 in the second coordinate system corresponding to the second image P1
  • (X 12 , Y 12 ) is the second coordinate of a certain point on the second image P2 in the second image P2
  • the coordinates in the system, (X 13 , Y 13 ) are the coordinates of a certain point on the second image P3 in the second coordinate system corresponding to the second image P3
  • (X 14 , Y 14 ) are the coordinates of a certain point on the second image P4
  • the conversion relationship between the first coordinate system and the second coordinate system is not limited to this conversion relationship.
  • the conversion relationship between the first coordinate system and the second coordinate system depends on the first coordinate system and the second coordinate system.
  • the specific conversion relationship is not used to limit the protection scope of the embodiments of the present invention.
  • the embodiment of the present invention adopts a face detection model whose maximum resolution of an image that can be detected is smaller than that of the first image to realize face detection on the first image, and there is no need to replace a more complex face detection model to realize face detection, thereby Reduce the difficulty of software development, and no need to upgrade the hardware.
  • the existing face detection models need to input images with a resolution less than or equal to 1080P (that is, 1920 ⁇ 1080). Then, to realize face detection of the first image of a video stream with a resolution of 4K (that is, 3840 ⁇ 2160), the following methods can be used:
  • the second coordinate system based on the second image P1, the second image P2, the second image P3, and the second image P4 are respectively The first coordinate of the face of is converted into the second coordinate corresponding to the first coordinate system XOY of the first image P.
  • the existing face detection model needs to input an image with a resolution less than or equal to 1080P (that is, 1920 ⁇ 1080), then
  • 1080P that is, 1920 ⁇ 1080
  • the face detection of a video stream with a resolution of 5 million pixels can be implemented in the following ways:
  • the second coordinate system based on the second image P1, the second image P2, the second image P3, and the second image P4 are respectively The first coordinate of the face of is converted into the second coordinate corresponding to the first coordinate system XOY of the first image P.
  • Face detection in a video stream with a resolution of 8K pixels can be implemented in the following ways:
  • the first image is divided into four equal parts of the third image P1, the third image P2, the third image P3, and the third image P4, and the resolution of a single third image is still greater than 1920 ⁇ 1080, so ,
  • 16 equal divisions are used, that is, the third image P1 is divided into four equal parts into the second image P11, the second image P12, the second image P13, and the second image P14, and the third image P2
  • the second image P21, the second image P22, the second image P23, and the second image P24 are divided into four equal parts
  • the third image P3 is divided into four equal parts into the second image P31, the second image P32, the second image P33, and the second image P34.
  • the third image P4 is equally divided into the second image P41, the second image P42, the second image P43, and the second image P44.
  • the resolution of the single second image is 1920 ⁇ 1080, which is in line with the resolution smaller than that of the face detection model. Rate requirements;
  • a first coordinate system XOY is established for the first image
  • a third coordinate system X 1 O 1 Y 1 is established for the third image P1
  • a third coordinate system X 2 O 2 is established for the third image P2 Y 2
  • to establish a second coordinate system X 12 O 12 Y 12 to the second image P12 the establishment of the second coordinate system X 13 O 13 Y 13 to the second image P13
  • establishing a second coordinate system a second image P14 X 14 O 14 Y 14 establish a second coordinate system X 21 O 21 Y 21 for the second image P21
  • the second coordinate system based on the second image P11, the second image P12, the second image P13, and the second image P14 are respectively The first coordinate of the face of is converted into the third coordinate corresponding to the third coordinate system X 1 O 1 Y 1 of the third image P1;
  • Another embodiment of the present invention provides a device for realizing face detection, including a processor and a computer-readable storage medium, the computer-readable storage medium stores instructions, and when the instructions are executed by the processor , To implement any of the aforementioned methods for face detection.
  • Another embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the aforementioned methods for realizing face detection are realized.
  • FIG. 4 another embodiment of the present invention provides a device for realizing face detection, including:
  • the image splitting module 401 is configured to split the first image into N resolutions less than or equal to the resolution of the face detection model when the resolution of the first image is greater than the resolution of the face detection model The second image; where N is an integer greater than 1;
  • the face detection module 402 is configured to obtain the first coordinate information of the face in the second image in the second coordinate system corresponding to the second image for each of the second images;
  • the coordinate information is converted into second coordinate information of the face in the second image in the first coordinate system corresponding to the first image.
  • the resolution of the face detection model refers to the maximum resolution of an image that can be detected by the face detection model.
  • the first image may be a pre-stored image or an image in a continuous video stream.
  • the first image is mapped in the memory of the embedded system, and the first image can be split into N second images according to the address in the memory.
  • the resolutions of the N second images may be equal or unequal.
  • the image splitting module 401 is specifically configured to use any one or more of the following methods to split the first image into N second images with a resolution less than or equal to the resolution of the face detection model. image:
  • the first image is split into N1 second images; where N1 is greater than 1.
  • N2 is an integer greater than N1;
  • the ratio of the resolution of the first image to the resolution of the face detection model is greater than or equal to N1 and less than or equal to N2, the first image is split into N2 equal resolutions.
  • the second image is greater than or equal to N1 and less than or equal to N2.
  • N2 is the square of N1.
  • N1 is 4 and N2 is 16.
  • the values of N1 and N2 are not limited to 4 and 16, and other values are within the protection scope of the embodiment of the present invention.
  • N2 is the square of N1
  • the image splitting module 401 splits the first image into N2 second images, it can directly split into N2 second images; or first The image is split into N1 third images, and each third image is split into N1 second images.
  • the resolutions of the N1 third images may be equal or unequal.
  • the method of splitting the first image in the embodiment of the present invention is not limited to the methods listed above, and the specific splitting method is not used to limit the protection scope of the embodiment of the present invention.
  • the face detection module 402 uses a face detection model to perform face detection on the second image to obtain that the face in the second image is in the second coordinate system corresponding to the second image The first coordinate information.
  • the first coordinate information of the human face in the second coordinate system corresponding to the second image refers to the first coordinate information of the rectangular frame in which the human face is located in the second coordinate system corresponding to the second image.
  • One coordinate information, the second coordinate information of the face in the first coordinate system corresponding to the first image also refers to the second coordinate of the rectangular frame in which the face is located in the first coordinate system corresponding to the first image information.
  • the face detection module 402 is specifically configured to implement the conversion of the obtained first coordinate information into the first coordinate corresponding to the face in the second image in the first image in the following manner:
  • the first coordinate information is converted into the second coordinate information according to the conversion relationship between the first coordinate system and the second coordinate system.
  • the conversion relationship between the first coordinate system and the second coordinate system may be based on the translation relationship between the first coordinate system and the second coordinate system, and the relationship between the first coordinate system and the second coordinate system.
  • the rotation relationship is determined.
  • the translation relationship can be determined according to the coordinate origin of the first coordinate system and the coordinate origin of the second coordinate system, and the rotation relationship can be determined according to the direction of the x-axis of the first coordinate system and the x-axis of the second coordinate system, and the direction of the first coordinate system.
  • the direction of the y-axis and the y-axis of the second coordinate system are determined.
  • the first image is split into four second images with equal resolution
  • the first image P is split into a second image P1, a second image P2, a second image P3, and a second image.
  • the second image P4 suppose that the first coordinate system is XOY, the second coordinate system corresponding to the second image P1 is X 1 O 1 Y 1 , and the second coordinate system corresponding to the second image P2 is X 2 O 2 Y 2 ,
  • the second coordinate system corresponding to the second image P3 is X 3 O 3 Y 3 , and the second coordinate system corresponding to the second image P4 is X 4 O 4 Y 4 ;
  • the resolution of the second image is (n ⁇ a) ⁇ (n ⁇ c) and the resolution of the face detection model is a ⁇ c.
  • the coordinate origin of the first coordinate system is the lower left corner of the first image P
  • the x-axis direction is parallel to the first direction of the first image P
  • the y-axis direction is parallel to the second direction of the first image P;
  • the coordinate origin of the second coordinate system corresponding to the second image P1 is the lower left corner of the second image P1, the x-axis direction is parallel to the first direction of the second image P1, and the y-axis direction is parallel to the second direction of the second image P1;
  • the coordinate origin of the second coordinate system corresponding to the second image P2 is the lower left corner of the second image P2, the x-axis direction is parallel to the first direction of the second image P2, and the y-axis direction is parallel to the second direction of the second image P2;
  • the coordinate origin of the second coordinate system corresponding to the second image P3 is the lower left corner of the second image P3, the x-axis direction is parallel to the first direction of the second image P3, and the y-axis direction is parallel to the second direction of the second image P3;
  • the coordinate origin of the second coordinate system corresponding to the second image P4 is the lower left corner of the second image P4, the x-axis direction is parallel to the first direction of the second image P4, and the y-axis direction is parallel to the second direction of the second image P4.
  • the first coordinate system and the second coordinate system are in a parallel relationship.
  • the conversion relationship between the two is only related to the translation relationship between the first coordinate system and the second coordinate system.
  • the conversion relationship between the first coordinate system and the second coordinate system corresponding to the second image P1 is:
  • (X, Y) is the coordinate of a point on the second image P1 or the second image P2 or the second image P3 or the second image P4 in the first coordinate system corresponding to the first image P
  • (X 1 , Y 1 ) is the coordinate of a point on the second image P1 in the second coordinate system corresponding to the second image P1
  • (X 2 , Y 2 ) is the second coordinate of a point on the second image P2 in the second image P2
  • the coordinates in the system (X 3 , Y 3 ) is the coordinates of a certain point on the second image P3 in the second coordinate system corresponding to the second image P3
  • (X 4 , Y 4 ) is a certain point on the second image P4
  • the conversion relationship between the first coordinate system and the second coordinate system is not limited to this conversion relationship.
  • the conversion relationship between the first coordinate system and the second coordinate system depends on the first coordinate system and the second coordinate system.
  • the specific conversion relationship is not used to limit the protection scope of the embodiments of the present invention.
  • the embodiment of the present invention adopts a face detection model whose maximum resolution of an image that can be detected is smaller than that of the first image to realize face detection on the first image, and there is no need to replace a more complex face detection model to realize face detection, thereby Reduce the difficulty of software development, and no need to upgrade the hardware.
  • Such software may be distributed on a computer-readable medium, and the computer-readable medium may include a computer storage medium (or a non-transitory medium) and a communication medium (or a transitory medium).
  • the term computer storage medium includes volatile and non-volatile data implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Sexual, removable and non-removable media.
  • Computer storage media include but are not limited to RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or Any other medium used to store desired information and that can be accessed by a computer.
  • communication media usually contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as carrier waves or other transmission mechanisms, and may include any information delivery media. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Human Computer Interaction (AREA)
  • Multimedia (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

本发明实施例公开了一种实现人脸检测的方法和装置,包括:当第一图像的分辨率大于人脸检测模型的分辨率时,将所述第一图像拆分成N个分辨率小于或等于所述人脸检测模型的分辨率的第二图像;其中,N为大于1的整数;对于每一个所述第二图像,获得所述第二图像中的人脸在所述第二图像对应的第二坐标系中的第一坐标信息;将得到的第一坐标信息转换为所述第二图像中的人脸在所述第一图像对应的第一坐标系中的第二坐标信息。

Description

一种实现人脸检测的方法和装置 技术领域
本发明实施例涉及但不限于人脸检测技术和监控领域,尤指一种实现人脸检测的方法和装置。
背景技术
安防监控行业发展经历了从模拟到数字图像,再到数字高清图像演变。市场上通用监控摄像头的分辨率各种各样,有D1、720P、1080P、600万像素、4K、8K等等。近几年随着人类检测技术、人脸识别技术的兴起,无论是在头端做边缘计算还是在后端平台部署人脸检测与识别,都必然会涉及到人脸检测模型的分辨率的适配问题。
当前主流做人脸检测与识别的厂家只支持1080P并向下兼容,但是行业对摄像头的分辨率要求越来越高,如600万像素、4K等是发展趋势。在摄像头的分辨率越来越高的同时,如果人脸检测模型的分辨率小于图像的分辨率则无法对图像进行人脸检测。
发明内容
本发明实施例提供了一种实现人脸检测的方法和装置,能够在人脸检测模型的分辨率小于图像的分辨率的情况下实现对图像的人脸检测。
本发明实施例提供了一种实现人脸检测的方法,包括:
当第一图像的分辨率大于人脸检测模型的分辨率时,将所述第一图像拆分成N个分辨率小于或等于所述人脸检测模型的分辨率的第二图像;其中,N为大于1的整数;
对于每一个所述第二图像,获得所述第二图像中的人脸在所述第二图像对应的第二坐标系中的第一坐标信息;
将得到的第一坐标信息转换为所述第二图像中的人脸在所述第一图像对应的第一坐标系中的第二坐标信息。
在本发明实施例中,所述将第一图像拆分成N个分辨率小于或等于所述人脸检测模型的分辨率的第二图像包括以下任意一个或一个以上:
当所述第一图像的分辨率和所述人脸检测模型的分辨率的比值小于或等于N1时,将所述第一图像拆分成N1个所述第二图像;其中,N1为大于1的整数;
当所述第一图像的分辨率和所述人脸检测模型的分辨率的比值大于或等于N1,且小于或等于N2时,将所述第一图像拆分成N2个所述第二图像;N2为大于N1的整数。
在本发明实施例中,所述将第一图像拆分成N个分辨率小于或等于所述人脸检测模型的分辨率的第二图像包括以下任意一个或一个以上:
当所述第一图像的分辨率和所述人脸检测模型的分辨率的比值小于或等于N1时,将所述第一图像拆分成N1个分辨率相等的所述第二图像;
当所述第一图像的分辨率和所述人脸检测模型的分辨率的比值大于或等于N1,且小于或等于N2时,将所述第一图像拆分成N2个分辨率相等的所述第二图像。
在本发明实施例中,所述N2为所述N1的平方。
在本发明实施例中,所述N1为4,所述N2为16。
在本发明实施例中,当所述N2为所述N1的平方时,所述将第一图像拆分成N2个所述第二图像包括:
将所述第一图像拆分成N1个第三图像;
将每一个所述第三图像拆分成N1个第一图像。
在本发明实施例中,N个所述第二图像的分辨率相等。
在本发明实施例中,所述将得到的第一坐标信息转换为所述第二图像中的人脸在所述第一图像对应的第一坐标系中的第二坐标信息包括:
根据所述第一坐标系和所述第二坐标系之间的转换关系将所述第一坐标信息转换为所述第二坐标信息。
本发明实施例提供了一种实现人脸检测的装置,包括处理器和计算机可读存储介质,所述计算机可读存储介质中存储有指令,当所述指令被所述处理器执行时,实现上述任一种实现人脸检测的方法。
本发明实施例提供了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述任一种实现人脸检测的方法的步骤。
本发明实施例包括:当第一图像的分辨率大于人脸检测模型的分辨率时,将所述第一图像拆分成N个分辨率小于或等于所述人脸检测模型的分辨率的第二图像;其中,N为大于1的整数;对于每一个所述第二图像,获得所述第二图像中的人脸在所述第二图像对应的第二坐标系中的第一坐标信息;将得到的第一坐标信息转换为所述第二图像中的人脸在所述第一图像对应的第一坐标系中的第二坐标信息。本发明实施例采用分辨率小于第一图像的人脸检测模型实现了对第一图像的人脸检测,无需更换更复杂的人脸检测模型来实现人脸检测,从而降低了软件开发难度,并且,不需要对硬件进行升级。
本发明实施例的其它特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本发明实施例而了解。本发明实施例的目的和其他优点可通过在说明书、权利要求书以及附图中所特别指出的结构来实现和获得。
附图说明
附图用来提供对本发明实施例技术方案的进一步理解,并且构成说明书的一部分,与本发明实施例的实施例一起用于解释本发明实施例的技术方案,并不构成对本发明实施例技术方案的限制。
图1为本发明一个实施例提出的实现人脸检测的方法的流程图;
图2为本发明实施例中将第一图像四等分时建立的第一坐标系和第二坐标系的示意图;
图3为本发明实施例中将第一图像16等分时建立的第一坐标系和第二坐 标系的示意图;
图4为本发明另一个实施例提出的实现人脸检测的装置的结构组成示意图。
具体实施方式
下文中将结合附图对本发明实施例进行详细说明。需要说明的是,在不冲突的情况下,本发明中的实施例及实施例中的特征可以相互任意组合。
在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行。并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。
参见图1,本发明一个实施例提出了一种实现人脸检测的方法,包括:
步骤100、当第一图像的分辨率大于人脸检测模型的分辨率时,将所述第一图像拆分成N个分辨率小于或等于所述人脸检测模型的分辨率的第二图像;其中,N为大于1的整数。
在本发明实施例中,人脸检测模型的分辨率是指人脸检测模型所能检测的图像的最大分辨率。
在本发明实施例中,第一图像可以是预先存储的图像,也可以是连续视频流中的图像。当第一图像为连续视频流中的图像时,第一图像映射在嵌入式系统的内存中,可以在内存中根据地址将第一图像拆分成N个第二图像。
在本发明实施例中,N个第二图像的分辨率可以相等,也可以不相等。
在一个示例性实例中,将第一图像拆分成N个分辨率小于或等于所述人脸检测模型的分辨率的第二图像包括以下任意一个或一个以上:
当所述第一图像的分辨率和所述人脸检测模型的分辨率的比值小于或等于N1时,将所述第一图像拆分成N1个所述第二图像;其中,N1为大于1的整数;
当所述第一图像的分辨率和所述人脸检测模型的分辨率的比值大于或等于N1,且小于或等于N2时,将所述第一图像拆分成N2个所述第二图像; 其中,N2为大于N1的整数;
当所述第一图像的分辨率和所述人脸检测模型的分辨率的比值小于或等于N1时,将所述第一图像拆分成N1个分辨率相等的所述第二图像;
当所述第一图像的分辨率和所述人脸检测模型的分辨率的比值大于或等于N1,且小于或等于N2时,将所述第一图像拆分成N2个分辨率相等的所述第二图像。
在一个示例性实例中,N2为N1的平方。
在一个示例性实例中,N1为4,所述N2为16。当然,N1和N2的取值不仅仅局限于4和16,其他的取值均在本发明实施例的保护范围内。
需要说明的是,当N2为N1的平方时,在将第一图像拆分成N2个第二图像时,可以直接拆分成N2个第二图像;也可以先将第一图像拆分成N1个第三图像,再将每一个第三图像拆分成N1个第二图像。
其中,N1个第三图像的分辨率可以相等,也可以不相等。
本发明实施例对第一图像的拆分方式不仅仅局限于上述所列出的方式,具体的拆分方式不用于限定本发明实施例的保护范围。
步骤101、对于每一个所述第二图像,获得所述第二图像中的人脸在所述第二图像对应的第二坐标系中的第一坐标信息;将得到的第一坐标信息转换为所述第二图像中的人脸在所述第一图像对应的第一坐标系中的第二坐标信息。
在本发明实施例中,采用人脸检测模型对所述第二图像进行人脸检测得到所述第二图像中的人脸在所述第二图像对应的第二坐标系中的第一坐标信息。
在本发明实施例中,人脸在所述第二图像对应的第二坐标系中的第一坐标信息是指人脸所在的矩形框在所述第二图像对应的第二坐标系中的第一坐标信息,人脸在所述第一图像对应的第一坐标系中的第二坐标信息同样是指人脸所在的矩形框在所述第一图像对应的第一坐标系中的第二坐标信息。
在本发明实施例中,将得到的第一坐标信息转换为所述第二图像中的人 脸在所述第一图像对应的第一坐标系中的第二坐标信息包括:
根据所述第一坐标系和所述第二坐标系之间的转换关系将所述第一坐标信息转换为所述第二坐标信息。
在一个示例性实例中,第一坐标系和第二坐标系之间的转换关系可以根据第一坐标系和第二坐标系之间的平移关系,以及第一坐标系和第二坐标系之间的旋转关系来确定。
平移关系可以根据第一坐标系的坐标原点和第二坐标系的坐标原点来确定,旋转关系可以根据第一坐标系的x轴和第二坐标系的x轴的方向、以及第一坐标系的y轴和第二坐标系的y轴的方向来确定。
例如,如图2所示,当将第一图像拆分成4个分辨率相等的第二图像,即将第一图像P拆分成第二图像P1、第二图像P2、第二图像P3和第二图像P4时,假设,第一坐标系为XOY,第二图像P1对应的第二坐标系为X 1O 1Y 1,第二图像P2对应的第二坐标系为X 2O 2Y 2,第二图像P3对应的第二坐标系为X 3O 3Y 3,第二图像P4对应的第二坐标系为X 4O 4Y 4
假设,第一图像的分辨率为(n×a)×(n×c),人脸检测模型的分辨率为a×c,那么,第二图像的分辨率为
Figure PCTCN2020101092-appb-000001
其中,第一坐标系的坐标原点为第一图像P的左下角,x轴方向平行于第一图像P的第一方向,y轴方向平行于第一图像P的第二方向;
第二图像P1对应的第二坐标系的坐标原点为第二图像P1的左下角,x轴方向平行于第二图像P1的第一方向,y轴方向平行于第二图像P1的第二方向;
第二图像P2对应的第二坐标系的坐标原点为第二图像P2的左下角,x轴方向平行于第二图像P2的第一方向,y轴方向平行于第二图像P2的第二方向;
第二图像P3对应的第二坐标系的坐标原点为第二图像P3的左下角,x轴方向平行于第二图像P3的第一方向,y轴方向平行于第二图像P3的第二方向;
第二图像P4对应的第二坐标系的坐标原点为第二图像P4的左下角,x轴方向平行于第二图像P4的第一方向,y轴方向平行于第二图像P4的第二方向。
那么,由于第一坐标系和第二坐标系的x轴方向为平行关系,第一坐标系和第二坐标系的y轴方向也为平行关系,因此,第一坐标系和第二坐标系之间的转换关系仅与第一坐标系和第二坐标系之间的平移关系有关。从图2可以看出,第一坐标系和第二图像P1对应的第二坐标系的转换关系为:
Figure PCTCN2020101092-appb-000002
第一坐标系和第二图像P2对应的第二坐标系的转换关系为:X=X 2
Figure PCTCN2020101092-appb-000003
第一坐标系和第二图像P3对应的第二坐标系的转换关系为:X=X 3,Y=Y 3;第一坐标系和第二图像P4对应的第二坐标系的转换关系为:
Figure PCTCN2020101092-appb-000004
Y=Y 4
其中,(X,Y)为第二图像P1或第二图像P2或第二图像P3或第二图像P4上某一点在第一图像P对应的第一坐标系中的坐标,(X 1,Y 1)为第二图像P1上某一点在第二图像P1对应的第二坐标系中的坐标,(X 2,Y 2)为第二图像P2上某一点在第二图像P2对应的第二坐标系中的坐标,(X 3,Y 3)为第二图像P3上某一点在第二图像P3对应的第二坐标系中的坐标,(X 4,Y 4)为第二图像P4上某一点在第二图像P4对应的第二坐标系中的坐标。
又如,如图3所示,当将第一图像拆分成16个分辨率相等的第二图像,即将第一图像P拆分成第二图像P11、第二图像P12、第二图像P13、第二图像P14、第二图像P21、第二图像P22、第二图像P23、第二图像P24、第二图像P31、第二图像P32、第二图像P33、第二图像P34、第二图像P41、第二图像P42、第二图像P43、第二图像P44、时,假设,第一坐标系为XOY,第二图像P11对应的第二坐标系为X 11O 11Y 11,第二图像P12对应的第二坐标系为X 12O 12Y 12,第二图像P13对应的第二坐标系为X 13O 13Y 13,第二图像P14对应的第二坐标系为X 14O 14Y 14;第二图像P21对应的第二坐标系为X 21O 21Y 21,第二图像P22对应的第二坐标系为X 22O 22Y 22,第二图像P23对应的第二坐标系为X 23O 23Y 23,第二图像P24对应的第二坐标系为X 24O 24Y 24;第二图像P31对应的第二坐标系为X 31O 31Y 31,第二图像P32对应的第二坐标系为X 32O 32Y 32, 第二图像P33对应的第二坐标系为X 33O 33Y 33,第二图像P34对应的第二坐标系为X 34O 34Y 34;第二图像P41对应的第二坐标系为X 41O 41Y 41,第二图像P42对应的第二坐标系为X 42O 42Y 42,第二图像P43对应的第二坐标系为X 43O 43Y 43,第二图像P44对应的第二坐标系为X 44O 44Y 44
假设,第一图像的分辨率为(n×a)×(n×c),人脸检测模型的分辨率为a×c,那么,第二图像的分辨率为
Figure PCTCN2020101092-appb-000005
其中,第一坐标系的坐标原点为第一图像P的左下角,x轴方向平行于第一图像P的第一方向,y轴方向平行于第一图像P的第二方向;
第二图像P11对应的第二坐标系的坐标原点为第二图像P11的左下角,x轴方向平行于第二图像P11的第一方向,y轴方向平行于第二图像P11的第二方向;
第二图像P12对应的第二坐标系的坐标原点为第二图像P12的左下角,x轴方向平行于第二图像P12的第一方向,y轴方向平行于第二图像P12的第二方向;
第二图像P13对应的第二坐标系的坐标原点为第二图像P13的左下角,x轴方向平行于第二图像P13的第一方向,y轴方向平行于第二图像P3的第二方向;
第二图像P14对应的第二坐标系的坐标原点为第二图像P14的左下角,x轴方向平行于第二图像P14的第一方向,y轴方向平行于第二图像P14的第二方向;
以此类推,第二图像(P21、P22、P23、P24、P31、P32、P33、P34、P41、P42、P43、P44)分别对应的第二坐标系的坐标原点、x轴方向和y轴方向采用相同的方式确定。
那么,由于第一坐标系和第二坐标系的x轴方向为平行关系,第一坐标系和第二坐标系的y轴方向也为平行关系,因此,第一坐标系和第二坐标系之间的转换关系仅与第一坐标系和第二坐标系之间的平移关系有关。从图3可以看出,
第一坐标系和第二图像P11对应的第二坐标系的转换关系为:
Figure PCTCN2020101092-appb-000006
第一坐标系和第二图像P12对应的第二坐标系的转换关系为:
Figure PCTCN2020101092-appb-000007
第一坐标系和第二图像P13对应的第二坐标系的转换关系为:
Figure PCTCN2020101092-appb-000008
第一坐标系和第二图像P14对应的第二坐标系的转换关系为:
Figure PCTCN2020101092-appb-000009
第一坐标系和第二图像P21对应的第二坐标系的转换关系为:
Figure PCTCN2020101092-appb-000010
第一坐标系和第二图像P22对应的第二坐标系的转换关系为:X=X 2
Figure PCTCN2020101092-appb-000011
第一坐标系和第二图像P23对应的第二坐标系的转换关系为:X=X 3
Figure PCTCN2020101092-appb-000012
第一坐标系和第二图像P24对应的第二坐标系的转换关系为:
Figure PCTCN2020101092-appb-000013
第一坐标系和第二图像P31对应的第二坐标系的转换关系为:
Figure PCTCN2020101092-appb-000014
第一坐标系和第二图像P32对应的第二坐标系的转换关系为:
Figure PCTCN2020101092-appb-000015
第一坐标系和第二图像P33对应的第二坐标系的转换关系为:
Figure PCTCN2020101092-appb-000016
Y=Y 3;第一坐标系和第二图像P34对应的第二坐标系的转换关系为:
Figure PCTCN2020101092-appb-000017
Y=Y 4
第一坐标系和第二图像P41对应的第二坐标系的转换关系为:
Figure PCTCN2020101092-appb-000018
第一坐标系和第二图像P42对应的第二坐标系的转换关系为:X=X 2
Figure PCTCN2020101092-appb-000019
第一坐标系和第二图像P43对应的第二坐标系的转换关系为:X=X 3,Y=Y 3;第一坐标系和第二图像P44对应的第二坐标系的转换关系为:
Figure PCTCN2020101092-appb-000020
Y=Y 4
其中,(X,Y)为第二图像P1或第二图像P2或第二图像P3或第二图像P4上某一点在第一图像P对应的第一坐标系中的坐标,(X 11,Y 11)为第二图像P1上某一点在第二图像P1对应的第二坐标系中的坐标,(X 12,Y 12) 为第二图像P2上某一点在第二图像P2对应的第二坐标系中的坐标,(X 13,Y 13)为第二图像P3上某一点在第二图像P3对应的第二坐标系中的坐标,(X 14,Y 14)为第二图像P4上某一点在第二图像P4对应的第二坐标系中的坐标。
当然,第一坐标系和第二坐标系之间的转换关系不仅仅局限于这种转换关系,第一坐标系和第二坐标系之间的转换关系取决于第一坐标系和第二坐标系的建立方式,具体的转换关系不用于限定本发明实施例的保护范围。
本发明实施例采用所能检测的图像的最大分辨率小于第一图像的人脸检测模型实现了对第一图像的人脸检测,无需更换更复杂的人脸检测模型来实现人脸检测,从而降低了软件开发难度,并且,不需要对硬件进行升级。
实施例一
假设监控摄像机头端为4K像素的摄像机且头端的硬件支持人工智能(AI,Artificial Intelligence)计算,已有的人脸检测模型中需要输入分辨率小于或等于1080P(即1920×1080)的图像,那么要实现分辨率为4K(即3840×2160)视频流的第一图像的人脸检测,可以采用以下方式实现:
1)由于n=2,因此,将第一图像四等分成第二图像P1、第二图像P2、第二图像P3、第二图像P4;
2)如图2所示,为第一图像建立第一坐标系,分别为第二图像P1、第二图像P2、第二图像P3、第二图像P4建立对应的第二坐标系;
3)令a=1920,c=1080;n=2;那么,
A.第二图像P1对应的第二坐标系X 1O 1Y 1与第一坐标系XOY之间的转换关系为:X=X 1+1920;Y=Y 1+1080;
B.第二图像P2对应的第二坐标系X 2O 2Y 2与第一坐标系XOY之间的转换关系为:X=X 2;Y=Y 2+1080;
C.第二图像P3对应的第二坐标系X 3O 3Y 3与第一坐标系XOY之间的转换关系为:X=X 3;Y=Y 3
D.第二图像P4对应的第二坐标系X 4O 4Y 4与第一坐标系XOY之间的转换关系为:X=X 4+1920;Y=Y 4
4)将四等分后的第二图像P1、第二图像P2、第二图像P3、第二图像P4逐一送至分辨率为1920×1080人脸检测模型做人脸检测,输出基于各自第二坐标系的人脸的第一坐标。
5)根据步骤3)的第一坐标系和第二坐标系之间的转换关系,分别把基于第二图像P1、第二图像P2、第二图像P3、第二图像P4各自的第二坐标系的人脸的第一坐标转换成对应在第一图像P的第一坐标系XOY中的第二坐标。
6)每帧图像按上述方法实现人脸检测并打框,那么就实现了分辨率为4K的摄像头连续实时视频流里的人脸检测功能。
实施例二
假设监控摄像机头端为500万像素(3072×1728)摄像机且头端硬件支持AI计算,已有的人脸检测模型中需要输入分辨率小于或等于1080P(即1920×1080)的图像,那么要实现分辨率为500万像素的视频流的人脸检测,可以采用以下方式实现:
1)由于n=1.6,因此,将第一图像四等分成第二图像P1、第二图像P2、第二图像P3、第二图像P4;
2)如图2所示,为第一图像建立第一坐标系,分别为第二图像P1、第二图像P2、第二图像P3、第二图像P4建立对应的第二坐标系;
3)令a=1920,c=1080;n=1.6;那么,
A.第二图像P1对应的第二坐标系X 1O 1Y 1与第一坐标系XOY之间的转换关系为:X=X 1+1920;Y=Y 1+1080;
B.第二图像P2对应的第二坐标系X 2O 2Y 2与第一坐标系XOY之间的转换关系为:X=X 2;Y=Y 2+1080;
C.第二图像P3对应的第二坐标系X 3O 3Y 3与第一坐标系XOY之间的转换关系为:X=X 3;Y=Y 3
D.第二图像P4对应的第二坐标系X 4O 4Y 4与第一坐标系XOY之间的转换关系为:X=X 4+1920;Y=Y 4
4)将四等分后的第二图像P1、第二图像P2、第二图像P3、第二图像P4 逐一送至分辨率为1920×1080人脸检测模型做人脸检测,输出基于各自第二坐标系的人脸的第一坐标。
5)根据步骤3)的第一坐标系和第二坐标系之间的转换关系,分别把基于第二图像P1、第二图像P2、第二图像P3、第二图像P4各自的第二坐标系的人脸的第一坐标转换成对应在第一图像P的第一坐标系XOY中的第二坐标。
6)每帧图像按上述方法实现人脸检测并打框,那么就实现了分辨率为500万像素的摄像头连续实时视频流里的人脸检测功能。
实施例三
假设监控摄像机头端为8K像素(7680×4320)摄像机且头端硬件支持AI计算,已有的人脸检测模型中需要输入分辨率小于或等于1080P(即1920×1080)的图像,那么要实现分辨率为8K像素的视频流的人脸检测可以采用以下方式实现:
1),由于n>2,将第一图像四等分成第三图像P1、第三图像P2、第三图像P3、第三图像P4后单幅第三图像的分辨率仍然大于1920×1080,因此,应当采用更多等分的方法,本例采用16等分,即将第三图像P1四等分成第二图像P11、第二图像P12、第二图像P13、第二图像P14,将第三图像P2四等分成第二图像P21、第二图像P22、第二图像P23、第二图像P24,将第三图像P3四等分成第二图像P31、第二图像P32、第二图像P33、第二图像P34,将第三图像P4四等分成第二图像P41、第二图像P42、第二图像P43、第二图像P44后单幅第二图像的分辨率为1920×1080,符合小于人脸检测模型的分辨率的要求;
2)如图3所示,为第一图像建立第一坐标系XOY,为第三图像P1建立第三坐标系X 1O 1Y 1,为第三图像P2建立第三坐标系X 2O 2Y 2,为第三图像P3建立第三坐标系X 3O 3Y 3,为第三图像P4建立第三坐标系X 4O 4Y 4,为第二图像P11建立第二坐标系X 11O 11Y 11,为第二图像P12建立第二坐标系X 12O 12Y 12,为第二图像P13建立第二坐标系X 13O 13Y 13,为第二图像P14建立第二坐标系X 14O 14Y 14,为第二图像P21建立第二坐标系X 21O 21Y 21,为第二图像P22建立第二坐标系X 22O 22Y 22,为第二图像P23建立第二坐标系X 23O 23Y 23,为第二图 像P24建立第二坐标系X 24O 24Y 24,为第二图像P31建立第二坐标系X 31O 31Y 31,为第二图像P32建立第二坐标系X 32O 32Y 32,为第二图像P33建立第二坐标系X 33O 33Y 33,为第二图像P34建立第二坐标系X 34O 34Y 34,为第二图像P41建立第二坐标系X 41O 41Y 41,为第二图像P42建立第二坐标系X 42O 42Y 42,为第二图像P43建立第二坐标系X 43O 43Y 43,为第二图像P44建立第二坐标系X 44O 44Y 44
3)令a=1920,c=1080;n=2;那么,对于第三图像P1,
A.第二图像P11对应的第二坐标系X 11O 11Y 11与第三坐标系X 1O 1Y 1之间的转换关系为:X 1=X 11+1920;Y 1=Y 11+1080;
B.第二图像P12对应的第二坐标系X 12O 12Y 12与第三坐标系X 1O 1Y 1之间的转换关系为:X 1=X 12;Y 1=Y 12+1080;
C.第二图像P13对应的第二坐标系X 13O 13Y 13与第三坐标系X 1O 1Y 1之间的转换关系为:X=X 3;Y=Y 3
D.第二图像P14对应的第二坐标系X 14O 14Y 14与第三坐标系X 1O 1Y 1之间的转换关系为:X 1=X 14+1920;Y 1=Y 14
4)将四等分后的第二图像P11、第二图像P12、第二图像P13、第二图像P14逐一送至分辨率为1920×1080人脸检测模型做人脸检测,输出基于各自第二坐标系的人脸的第一坐标;
5)根据步骤3)的第二坐标系和第三坐标系之间的转换关系,分别把基于第二图像P11、第二图像P12、第二图像P13、第二图像P14各自的第二坐标系的人脸的第一坐标转换成对应在第三图像P1的第三坐标系X 1O 1Y 1中的第三坐标;
6)对于第三图像P2、第三图像P3、第四图像P4同样采用步骤3)到步骤5)的方式得出对应的人脸在对应的第三坐标系中的第三坐标;
7)将人脸在对应的第三坐标系中的第三坐标转换为人脸在第一坐标系中的第二坐标
8)每帧图像按上述方法实现人脸检测并打框,那么就实现了分辨率为8K的摄像头连续实时视频流里的人脸检测功能。
本发明另一个实施例提出了一种实现人脸检测的装置,包括处理器和计算机可读存储介质,所述计算机可读存储介质中存储有指令,当所述指令被所述处理器执行时,实现上述任一种实现人脸检测的方法。
本发明另一个实施例提出了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述任一种实现人脸检测的方法的步骤。
参见图4,本发明另一个实施例提出了一种实现人脸检测的装置,包括:
图像拆分模块401,用于当第一图像的分辨率大于人脸检测模型的分辨率时,将所述第一图像拆分成N个分辨率小于或等于所述人脸检测模型的分辨率的第二图像;其中,N为大于1的整数;
人脸检测模块402,用于对于每一个所述第二图像,获得所述第二图像中的人脸在所述第二图像对应的第二坐标系中的第一坐标信息;将得到的第一坐标信息转换为所述第二图像中的人脸在所述第一图像对应的第一坐标系中的第二坐标信息。
在本发明实施例中,人脸检测模型的分辨率是指人脸检测模型所能检测的图像的最大分辨率。
在本发明实施例中,第一图像可以是预先存储的图像,也可以是连续视频流中的图像。当第一图像为连续视频流中的图像时,第一图像映射在嵌入式系统的内存中,可以在内存中根据地址将第一图像拆分成N个第二图像。
在本发明实施例中,N个第二图像的分辨率可以相等,也可以不相等。
在一个示例性实例中,图像拆分模块401具体用于采用以下任意一个或一个以上方式实现将第一图像拆分成N个分辨率小于或等于所述人脸检测模型的分辨率的第二图像:
当所述第一图像的分辨率和所述人脸检测模型的分辨率的比值小于或等于N1时,将所述第一图像拆分成N1个所述第二图像;其中,N1为大于1的整数;
当所述第一图像的分辨率和所述人脸检测模型的分辨率的比值大于或等 于N1,且小于或等于N2时,将所述第一图像拆分成N2个所述第二图像;其中,N2为大于N1的整数;
当所述第一图像的分辨率和所述人脸检测模型的分辨率的比值小于或等于N1时,将所述第一图像拆分成N1个分辨率相等的所述第二图像;
当所述第一图像的分辨率和所述人脸检测模型的分辨率的比值大于或等于N1,且小于或等于N2时,将所述第一图像拆分成N2个分辨率相等的所述第二图像。
在一个示例性实例中,N2为N1的平方。
在一个示例性实例中,N1为4,所述N2为16。当然,N1和N2的取值不仅仅局限于4和16,其他的取值均在本发明实施例的保护范围内。
需要说明的是,当N2为N1的平方时,图像拆分模块401在将第一图像拆分成N2个第二图像时,可以直接拆分成N2个第二图像;也可以先将第一图像拆分成N1个第三图像,再将每一个第三图像拆分成N1个第二图像。
其中,N1个第三图像的分辨率可以相等,也可以不相等。
本发明实施例对第一图像的拆分方式不仅仅局限于上述所列出的方式,具体的拆分方式不用于限定本发明实施例的保护范围。
在本发明实施例中,人脸检测模块402采用人脸检测模型对所述第二图像进行人脸检测得到所述第二图像中的人脸在所述第二图像对应的第二坐标系中的第一坐标信息。
在本发明实施例中,人脸在所述第二图像对应的第二坐标系中的第一坐标信息是指人脸所在的矩形框在所述第二图像对应的第二坐标系中的第一坐标信息,人脸在所述第一图像对应的第一坐标系中的第二坐标信息同样是指人脸所在的矩形框在所述第一图像对应的第一坐标系中的第二坐标信息。
在本发明实施例中,人脸检测模块402具体用于采用以下方式实现所述将得到的第一坐标信息转换为所述第二图像中的人脸在所述第一图像对应的第一坐标系中的第二坐标信息:
根据所述第一坐标系和所述第二坐标系之间的转换关系将所述第一坐标 信息转换为所述第二坐标信息。
在一个示例性实例中,第一坐标系和第二坐标系之间的转换关系可以根据第一坐标系和第二坐标系之间的平移关系,以及第一坐标系和第二坐标系之间的旋转关系来确定。
平移关系可以根据第一坐标系的坐标原点和第二坐标系的坐标原点来确定,旋转关系可以根据第一坐标系的x轴和第二坐标系的x轴的方向、以及第一坐标系的y轴和第二坐标系的y轴的方向来确定。
例如,如图2所示,当将第一图像拆分成4个分辨率相等的第二图像,即将第一图像P拆分成第二图像P1、第二图像P2、第二图像P3和第二图像P4时,假设,第一坐标系为XOY,第二图像P1对应的第二坐标系为X 1O 1Y 1,第二图像P2对应的第二坐标系为X 2O 2Y 2,第二图像P3对应的第二坐标系为X 3O 3Y 3,第二图像P4对应的第二坐标系为X 4O 4Y 4
假设,第一图像的分辨率为(n×a)×(n×c),人脸检测模型的分辨率为a×c,那么,第二图像的分辨率为
Figure PCTCN2020101092-appb-000021
其中,第一坐标系的坐标原点为第一图像P的左下角,x轴方向平行于第一图像P的第一方向,y轴方向平行于第一图像P的第二方向;
第二图像P1对应的第二坐标系的坐标原点为第二图像P1的左下角,x轴方向平行于第二图像P1的第一方向,y轴方向平行于第二图像P1的第二方向;
第二图像P2对应的第二坐标系的坐标原点为第二图像P2的左下角,x轴方向平行于第二图像P2的第一方向,y轴方向平行于第二图像P2的第二方向;
第二图像P3对应的第二坐标系的坐标原点为第二图像P3的左下角,x轴方向平行于第二图像P3的第一方向,y轴方向平行于第二图像P3的第二方向;
第二图像P4对应的第二坐标系的坐标原点为第二图像P4的左下角,x轴方向平行于第二图像P4的第一方向,y轴方向平行于第二图像P4的第二方 向。
那么,由于第一坐标系和第二坐标系的x轴方向为平行关系,第一坐标系和第二坐标系的y轴方向也为平行关系,因此,第一坐标系和第二坐标系之间的转换关系仅与第一坐标系和第二坐标系之间的平移关系有关。从图2可以看出,第一坐标系和第二图像P1对应的第二坐标系的转换关系为:
Figure PCTCN2020101092-appb-000022
第一坐标系和第二图像P2对应的第二坐标系的转换关系为:X=X 2
Figure PCTCN2020101092-appb-000023
第一坐标系和第二图像P3对应的第二坐标系的转换关系为:X=X 3,Y=Y 3;第一坐标系和第二图像P4对应的第二坐标系的转换关系为:
Figure PCTCN2020101092-appb-000024
Y=Y 4
其中,(X,Y)为第二图像P1或第二图像P2或第二图像P3或第二图像P4上某一点在第一图像P对应的第一坐标系中的坐标,(X 1,Y 1)为第二图像P1上某一点在第二图像P1对应的第二坐标系中的坐标,(X 2,Y 2)为第二图像P2上某一点在第二图像P2对应的第二坐标系中的坐标,(X 3,Y 3)为第二图像P3上某一点在第二图像P3对应的第二坐标系中的坐标,(X 4,Y 4)为第二图像P4上某一点在第二图像P4对应的第二坐标系中的坐标。
当然,第一坐标系和第二坐标系之间的转换关系不仅仅局限于这种转换关系,第一坐标系和第二坐标系之间的转换关系取决于第一坐标系和第二坐标系的建立方式,具体的转换关系不用于限定本发明实施例的保护范围。
本发明实施例采用所能检测的图像的最大分辨率小于第一图像的人脸检测模型实现了对第一图像的人脸检测,无需更换更复杂的人脸检测模型来实现人脸检测,从而降低了软件开发难度,并且,不需要对硬件进行升级。
本领域普通技术人员可以理解,上文中所公开方法中的全部或某些步骤、系统、装置中的功能模块/单元可以被实施为软件、固件、硬件及其适当的组合。在硬件实施方式中,在以上描述中提及的功能模块/单元之间的划分不一定对应于物理组件的划分;例如,一个物理组件可以具有多个功能,或者一个功能或步骤可以由若干物理组件合作执行。某些组件或所有组件可以被实施为由处理器,如数字信号处理器或微处理器执行的软件,或者被实施为硬 件,或者被实施为集成电路,如专用集成电路。这样的软件可以分布在计算机可读介质上,计算机可读介质可以包括计算机存储介质(或非暂时性介质)和通信介质(或暂时性介质)。如本领域普通技术人员公知的,术语计算机存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、程序模块或其他数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质。计算机存储介质包括但不限于RAM、ROM、EEPROM、闪存或其他存储器技术、CD-ROM、数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读指令、数据结构、程序模块或者诸如载波或其他传输机制之类的调制数据信号中的其他数据,并且可包括任何信息递送介质。
虽然本发明实施例所揭露的实施方式如上,但所述的内容仅为便于理解本发明实施例而采用的实施方式,并非用以限定本发明实施例。任何本发明实施例所属领域内的技术人员,在不脱离本发明实施例所揭露的精神和范围的前提下,可以在实施的形式及细节上进行任何的修改与变化,但本发明实施例的专利保护范围,仍须以所附的权利要求书所界定的范围为准。

Claims (10)

  1. 一种实现人脸检测的方法,包括:
    当第一图像的分辨率大于人脸检测模型的分辨率时,将所述第一图像拆分成N个分辨率小于或等于所述人脸检测模型的分辨率的第二图像;其中,N为大于1的整数;
    对于每一个所述第二图像,获得所述第二图像中的人脸在所述第二图像对应的第二坐标系中的第一坐标信息;
    将得到的第一坐标信息转换为所述第二图像中的人脸在所述第一图像对应的第一坐标系中的第二坐标信息。
  2. 根据权利要求1所述的方法,其特征在于,其中,所述将第一图像拆分成N个分辨率小于或等于所述人脸检测模型的分辨率的第二图像包括以下任意一个或一个以上:
    当所述第一图像的分辨率和所述人脸检测模型的分辨率的比值小于或等于N1时,将所述第一图像拆分成N1个所述第二图像;其中,N1为大于1的整数;
    当所述第一图像的分辨率和所述人脸检测模型的分辨率的比值大于或等于N1,且小于或等于N2时,将所述第一图像拆分成N2个所述第二图像;N2为大于N1的整数。
  3. 根据权利要求1所述的方法,其特征在于,其中,所述将第一图像拆分成N个分辨率小于或等于所述人脸检测模型的分辨率的第二图像包括以下任意一个或一个以上:
    当所述第一图像的分辨率和所述人脸检测模型的分辨率的比值小于或等于N1时,将所述第一图像拆分成N1个分辨率相等的所述第二图像;
    当所述第一图像的分辨率和所述人脸检测模型的分辨率的比值大于或等于N1,且小于或等于N2时,将所述第一图像拆分成N2个分辨率相等的所述第二图像。
  4. 根据权利要求2或3所述的方法,其特征在于,其中,所述N2为所述N1的平方。
  5. 根据权利要求2或3所述的方法,其特征在于,其中,所述N1为4,所述N2为16。
  6. 根据权利要求2所述的方法,其特征在于,其中,当所述N2为所述N1的平方时,所述将第一图像拆分成N2个所述第二图像包括:
    将所述第一图像拆分成N1个第三图像;
    将每一个所述第三图像拆分成N1个第一图像。
  7. 根据权利要求1所述的方法,其特征在于,其中,N个所述第二图像的分辨率相等。
  8. 根据权利要求1所述的方法,其特征在于,所述将得到的第一坐标信息转换为所述第二图像中的人脸在所述第一图像对应的第一坐标系中的第二坐标信息包括:
    根据所述第一坐标系和所述第二坐标系之间的转换关系将所述第一坐标信息转换为所述第二坐标信息。
  9. 一种实现人脸检测的装置,包括处理器和计算机可读存储介质,所述计算机可读存储介质中存储有指令,其特征在于,当所述指令被所述处理器执行时,实现如权利要求1~8任一项所述的实现人脸检测的方法。
  10. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1~8任一项所述的实现人脸检测的方法的步骤。
PCT/CN2020/101092 2019-09-06 2020-07-09 一种实现人脸检测的方法和装置 WO2021042867A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910842231.X 2019-09-06
CN201910842231.XA CN112464692A (zh) 2019-09-06 2019-09-06 一种实现人脸检测的方法和装置

Publications (1)

Publication Number Publication Date
WO2021042867A1 true WO2021042867A1 (zh) 2021-03-11

Family

ID=74807115

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/101092 WO2021042867A1 (zh) 2019-09-06 2020-07-09 一种实现人脸检测的方法和装置

Country Status (2)

Country Link
CN (1) CN112464692A (zh)
WO (1) WO2021042867A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101648208B1 (ko) * 2015-09-08 2016-08-12 김동기 고해상도 영상을 이용한 객체 인식 및 추적 방법 및 장치
CN109858472A (zh) * 2019-04-09 2019-06-07 武汉领普科技有限公司 一种嵌入式实时人形检测方法和装置
CN110033475A (zh) * 2019-03-29 2019-07-19 北京航空航天大学 一种高分辨率纹理生成的航拍图运动物体检测与消除方法
CN110866476A (zh) * 2019-11-06 2020-03-06 南京信息职业技术学院 一种基于自动标注和迁移学习的密集堆垛目标检测方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101648208B1 (ko) * 2015-09-08 2016-08-12 김동기 고해상도 영상을 이용한 객체 인식 및 추적 방법 및 장치
CN110033475A (zh) * 2019-03-29 2019-07-19 北京航空航天大学 一种高分辨率纹理生成的航拍图运动物体检测与消除方法
CN109858472A (zh) * 2019-04-09 2019-06-07 武汉领普科技有限公司 一种嵌入式实时人形检测方法和装置
CN110866476A (zh) * 2019-11-06 2020-03-06 南京信息职业技术学院 一种基于自动标注和迁移学习的密集堆垛目标检测方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ADAM VAN ETTEN: "You Only Look Twice: Rapid Multi-Scale Object Detection In Satellite Imagery", ARXIV.ORG, CORNELL UNIVERSITY LIBRARY, 201 OLIN LIBRARY CORNELL UNIVERSITY ITHACA, NY 14853, 24 May 2018 (2018-05-24), 201 Olin Library Cornell University Ithaca, NY 14853, XP080881845 *

Also Published As

Publication number Publication date
CN112464692A (zh) 2021-03-09

Similar Documents

Publication Publication Date Title
US11373275B2 (en) Method for generating high-resolution picture, computer device, and storage medium
US11663691B2 (en) Method and apparatus for restoring image
KR102149187B1 (ko) 전자 장치와, 그의 제어 방법
CN107566688B (zh) 一种基于卷积神经网络的视频防抖方法、装置及图像对齐装置
US20170099435A1 (en) Image Generation Method Based On Dual Camera Module And Dual Camera Apparatus
BR112021007094A2 (pt) método de processamento de imagem, aparelho, e dispositivo
WO2021175180A1 (zh) 视线确定方法、装置、电子设备和计算机可读存储介质
BR112021007087A2 (pt) método e aparelho de processamento de imagem, e dispositivo
WO2019041842A1 (zh) 一种图像处理方法及装置、存储介质和计算机设备
KR20210061258A (ko) 기준 이미지 프레임의 동적 선택을 위한 시스템 및 방법
US9317909B2 (en) Image subsystem including image feature detection hardware component and image processing system including the same
US9398217B2 (en) Video stabilization using padded margin pixels
US20200167896A1 (en) Image processing method and device, display device and virtual reality display system
US10929982B2 (en) Face pose correction based on depth information
US10497396B2 (en) Detecting and correcting whiteboard images while enabling the removal of the speaker
US20160252730A1 (en) Image generating system, image generating method, and information storage medium
US20220086382A1 (en) Method controlling image sensor parameters
WO2023075493A1 (en) Method and apparatus for three-dimensional scene reconstruction and dense depth map
WO2018058476A1 (zh) 一种图像校正方法及装置
JP2019526875A (ja) 投影画像構築方法及び装置
CN106548117B (zh) 一种人脸图像处理方法和装置
CN112714263B (zh) 视频生成方法、装置、设备及存储介质
JP2016167681A (ja) 画像生成装置および画像生成方法
WO2018219274A1 (zh) 降噪处理方法、装置、存储介质及终端
WO2021042867A1 (zh) 一种实现人脸检测的方法和装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20861572

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20861572

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 20861572

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 24/10/2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20861572

Country of ref document: EP

Kind code of ref document: A1