CN108021669B - Image classification method and apparatus, electronic device, computer-readable storage medium - Google Patents

Image classification method and apparatus, electronic device, computer-readable storage medium Download PDF

Info

Publication number
CN108021669B
CN108021669B CN201711270284.6A CN201711270284A CN108021669B CN 108021669 B CN108021669 B CN 108021669B CN 201711270284 A CN201711270284 A CN 201711270284A CN 108021669 B CN108021669 B CN 108021669B
Authority
CN
China
Prior art keywords
face
level
image
level face
recognition
Prior art date
Legal status (The legal status 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 status listed.)
Expired - Fee Related
Application number
CN201711270284.6A
Other languages
Chinese (zh)
Other versions
CN108021669A (en
Inventor
陈德银
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201711270284.6A priority Critical patent/CN108021669B/en
Publication of CN108021669A publication Critical patent/CN108021669A/en
Application granted granted Critical
Publication of CN108021669B publication Critical patent/CN108021669B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/51Indexing; Data structures therefor; Storage structures
    • 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/172Classification, e.g. identification

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Human Computer Interaction (AREA)
  • Health & Medical Sciences (AREA)
  • Multimedia (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

本申请涉及一种图像分类方法和装置、电子设备、计算机可读存储介质,根据人脸面积的大小从图像中获取满足预设条件的第一级人脸,对第一级人脸进行人脸识别,得到第一级人脸所对应的人脸类别。再获取图像中的第二级人脸,对第二级人脸进行人脸识别,得到第二级人脸所对应的人脸类别,第二级人脸为图像中除去第一级人脸之外的人脸。最后,根据第一级人脸所对应的人脸类别和第二级人脸所对应的人脸类别,将图像分入对应的人脸类别。如此得到的人脸类别会比较准确,不会出现大量并不重要的人脸类别,提高分类结果的有效性,更加贴合用户实际需求。最终,将图像分入对应的人脸类别。

Figure 201711270284

The present application relates to an image classification method and device, an electronic device, and a computer-readable storage medium. The first-level face that meets preset conditions is obtained from an image according to the size of the face area, and the first-level face is classified into the first-level face. Recognition to get the face category corresponding to the first-level face. Then obtain the second-level face in the image, perform face recognition on the second-level face, and obtain the face category corresponding to the second-level face, and the second-level face is the first-level face in the image. outside face. Finally, according to the face category corresponding to the first-level face and the face category corresponding to the second-level face, the images are classified into corresponding face categories. The face categories obtained in this way will be more accurate, and there will not be a large number of unimportant face categories, which will improve the effectiveness of the classification results and better meet the actual needs of users. Finally, the images are classified into corresponding face categories.

Figure 201711270284

Description

图像分类方法和装置、电子设备、计算机可读存储介质Image classification method and apparatus, electronic device, computer-readable storage medium

技术领域technical field

本申请涉及计算机技术领域,特别是涉及一种图像分类方法和装置、电子设备、计算机可读存储介质。The present application relates to the field of computer technology, and in particular, to an image classification method and apparatus, an electronic device, and a computer-readable storage medium.

背景技术Background technique

随着电子设备的普及和移动互联网的迅速发展,电子设备的用户使用量越来越大。而相册功能已经成为电子设备的常用应用之一,属于用户使用频率极高的应用。电子设备的相册中都储存了大量的图像,传统的电子设备相册有提供各种图像浏览和分类的功能,例如根据人脸特征进行个人图像分类就是目前比较流行的一种图像展示方式。然而传统的图像分类方式,会产生较多无用分类,造成资源的浪费,不贴合用户实际需求。With the popularization of electronic devices and the rapid development of the mobile Internet, the number of users of electronic devices is increasing. The photo album function has become one of the commonly used applications of electronic devices, and is an application that is frequently used by users. A large number of images are stored in the photo albums of electronic devices. The traditional photo albums of electronic devices provide various image browsing and classification functions. For example, personal image classification based on facial features is a popular image display method at present. However, the traditional image classification method will generate many useless classifications, resulting in waste of resources, which does not meet the actual needs of users.

发明内容SUMMARY OF THE INVENTION

本申请实施例提供一种图像分类方法和装置、电子设备、计算机可读存储介质,可以提高分类结果的有效性,更加贴合用户实际需求。Embodiments of the present application provide an image classification method and apparatus, electronic device, and computer-readable storage medium, which can improve the effectiveness of classification results and better meet the actual needs of users.

一种图像分类方法,包括:An image classification method comprising:

根据人脸面积的大小从图像中获取满足预设条件的第一级人脸,对所述第一级人脸进行人脸识别,得到所述第一级人脸所对应的人脸类别;According to the size of the face area, a first-level face that satisfies a preset condition is obtained from an image, and face recognition is performed on the first-level face to obtain a face category corresponding to the first-level face;

获取所述图像中的第二级人脸,对所述第二级人脸进行人脸识别,得到所述第二级人脸所对应的人脸类别,所述第二级人脸为所述图像中除去第一级人脸之外的人脸;Obtain the second-level face in the image, perform face recognition on the second-level face, and obtain the face category corresponding to the second-level face, and the second-level face is the The faces in the image except the first-level faces;

根据所述第一级人脸所对应的人脸类别和所述第二级人脸所对应的人脸类别,将所述图像分入对应的人脸类别。The images are classified into corresponding face categories according to the face categories corresponding to the first-level faces and the face categories corresponding to the second-level faces.

一种图像分类装置,所述装置包括:An image classification device, the device includes:

第一级人脸识别模块,用于根据人脸面积的大小从图像中获取满足预设条件的第一级人脸,对所述第一级人脸进行人脸识别,得到所述第一级人脸所对应的人脸类别;The first-level face recognition module is used to obtain a first-level face that meets preset conditions from an image according to the size of the face area, perform face recognition on the first-level face, and obtain the first-level face The face category corresponding to the face;

第二级人脸识别模块,用于获取所述图像中的第二级人脸,对所述第二级人脸进行人脸识别,得到所述第二级人脸所对应的人脸类别,所述第二级人脸为所述图像中除去第一级人脸之外的人脸;The second-level face recognition module is used to obtain the second-level face in the image, perform face recognition on the second-level face, and obtain the face category corresponding to the second-level face, The second-level human face is a human face other than the first-level human face in the image;

图像分类模块,用于根据所述第一级人脸所对应的人脸类别和所述第二级人脸所对应的人脸类别,将所述图像分入对应的人脸类别。The image classification module is configured to classify the images into corresponding face categories according to the face categories corresponding to the first-level faces and the face categories corresponding to the second-level faces.

一种电子设备,包括存储器及处理器,所述存储器中储存有计算机程序,所述指令被所述处理器执行时,使得所述处理器执行如上所述的图像分类方法的步骤。An electronic device includes a memory and a processor, wherein a computer program is stored in the memory, and when the instructions are executed by the processor, the processor causes the processor to execute the steps of the image classification method as described above.

一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如上所述的图像分类方法的步骤。A computer-readable storage medium having a computer program stored thereon, the computer program implementing the steps of the image classification method as described above when executed by a processor.

上述图像分类方法和装置、电子设备、计算机可读存储介质,首先,根据人脸面积的大小从图像中获取满足预设条件的第一级人脸,对第一级人脸进行人脸识别,得到第一级人脸所对应的人脸类别。再获取图像中的第二级人脸,对第二级人脸进行人脸识别,得到第二级人脸所对应的人脸类别,第二级人脸为图像中除去第一级人脸之外的人脸。最后,根据第一级人脸所对应的人脸类别和第二级人脸所对应的人脸类别,将图像分入对应的人脸类别。对图像中的人脸进行分级提取,其中在提取第一级人脸时按照人脸面积从大到小的顺序依次进行提取,且所提取出的第一级人脸需要满足预设条件,因此,提取第一级人脸的条件非常严格,对第一级人脸进行人脸识别,得到第一级人脸所对应的人脸类别。再继续从图像中获取第二级人脸,再对第二级人脸进行人脸识别,得到第二级人脸所对应的人脸类别。如此得到的人脸类别会比较准确,不会出现大量并不重要的人脸类别,提高分类结果的有效性,更加贴合用户实际需求。最终,将图像分入对应的人脸类别。The above-mentioned image classification method and device, electronic device, and computer-readable storage medium, first, obtain a first-level face that satisfies a preset condition from an image according to the size of the face area, and perform face recognition on the first-level face, Get the face category corresponding to the first-level face. Then obtain the second-level face in the image, perform face recognition on the second-level face, and obtain the face category corresponding to the second-level face, and the second-level face is the first-level face in the image. outside face. Finally, according to the face category corresponding to the first-level face and the face category corresponding to the second-level face, the images are classified into corresponding face categories. The faces in the image are extracted in stages, and the first-level faces are extracted in descending order of face area, and the extracted first-level faces need to meet preset conditions, so , the conditions for extracting the first-level face are very strict, and face recognition is performed on the first-level face to obtain the face category corresponding to the first-level face. Then continue to obtain the second-level face from the image, and then perform face recognition on the second-level face to obtain the face category corresponding to the second-level face. The face categories obtained in this way will be more accurate, and there will not be a large number of unimportant face categories, which will improve the effectiveness of the classification results and better meet the actual needs of users. Finally, the images are classified into corresponding face categories.

附图说明Description of drawings

为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only These are some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.

图1A为一个实施例中图像分类方法的应用场景图;1A is an application scenario diagram of an image classification method in one embodiment;

图1B为一个实施例中电子设备的内部结构图;1B is an internal structure diagram of an electronic device in one embodiment;

图2为一个实施例中图像分类方法的流程图;2 is a flowchart of an image classification method in one embodiment;

图3为一个实施例中从图像中按照人脸面积从大到小的顺序获取第一级人脸方法的流程图;3 is a flow chart of a method for obtaining a first-level face from an image in descending order of face area;

图4为一个实施例中得到第二级人脸对应的人脸类别方法的流程图;4 is a flowchart of a method for obtaining a face category corresponding to a second-level face in one embodiment;

图5为一个实施例中得到第二级人脸对应的人脸类别的方法的流程图;5 is a flowchart of a method for obtaining a face category corresponding to a second-level face in one embodiment;

图6为一个实施例中得到第二级人脸对应的人脸类别及第三级人脸方法的流程图;6 is a flowchart of a method for obtaining a face category corresponding to a second-level face and a third-level face method in one embodiment;

图7为一个实施例中得到第三级人脸对应的人脸类别方法的流程图;7 is a flowchart of a method for obtaining a face category corresponding to a third-level face in one embodiment;

图8为一个实施例中图像分类装置的结构示意图;8 is a schematic structural diagram of an image classification apparatus in an embodiment;

图9为图8中第一级人脸识别模块的结构示意图;Fig. 9 is the structural representation of the first-level face recognition module in Fig. 8;

图10为图8中第二级人脸识别模块的结构示意图;Fig. 10 is the structural representation of the second-level face recognition module in Fig. 8;

图11为图8中又一第二级人脸识别模块的结构示意图;11 is a schematic structural diagram of another second-level face recognition module in FIG. 8;

图12为一个实施例中提供的电子设备相关的手机的部分结构的框图。FIG. 12 is a block diagram of a partial structure of a mobile phone related to an electronic device provided in an embodiment.

具体实施方式Detailed ways

为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.

图1A为一个实施例中图像处理方法的应用场景图,如图1A所示,该应用环境包括电子设备110、服务器120。终端110和服务器120之间通过网络进行连接。在电子设备110中存储有图像,上述图像可存储于电子设备110内存中,也可存储于电子设备110内置SD(Secure Digital Memory Card,安全数码卡)卡中。电子设备110可根据人脸面积的大小从图像中获取满足预设条件的第一级人脸,对第一级人脸进行人脸识别,得到第一级人脸所对应的人脸类别。获取图像中的第二级人脸,对第二级人脸进行人脸识别,得到第二级人脸所对应的人脸类别,第二级人脸为图像中除去第一级人脸之外的人脸。根据第一级人脸所对应的人脸类别和第二级人脸所对应的人脸类别,将图像分入对应的人脸类别。当然上述图像分类方法也可以由电子设备110向服务器120发起图像分类的请求,在服务器120上完成图像分类,服务器120在将图像分类的结果发送至电子设备110。FIG. 1A is an application scenario diagram of an image processing method in an embodiment. As shown in FIG. 1A , the application environment includes an electronic device 110 and a server 120 . The terminal 110 and the server 120 are connected through a network. An image is stored in the electronic device 110 , and the image may be stored in the internal memory of the electronic device 110 or in an SD (Secure Digital Memory Card, Secure Digital Memory Card) card built in the electronic device 110 . The electronic device 110 can obtain a first-level face that meets a preset condition from an image according to the size of the face area, perform face recognition on the first-level face, and obtain a face category corresponding to the first-level face. Obtain the second-level face in the image, perform face recognition on the second-level face, and obtain the face category corresponding to the second-level face, and the second-level face is the image except the first-level face. face. According to the face category corresponding to the first-level face and the face category corresponding to the second-level face, the images are classified into corresponding face categories. Of course, in the above image classification method, the electronic device 110 can also initiate an image classification request to the server 120 , and the image classification is completed on the server 120 , and the server 120 sends the image classification result to the electronic device 110 .

图1B为一个实施例中电子设备的内部结构示意图。如图1B所示,该电子设备包括通过系统总线连接的处理器、存储器和网络接口。其中,该处理器用于提供计算和控制能力,支撑整个电子设备的运行。存储器用于存储数据、程序等,存储器上存储至少一个计算机程序,该计算机程序可被处理器执行,以实现本申请实施例中提供的适用于电子设备的图像分类方法。存储器可包括磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等非易失性存储介质,或随机存储记忆体(Random-Access-Memory,RAM)等。例如,在一个实施例中,存储器包括非易失性存储介质及内存储器。非易失性存储介质存储有操作系统和计算机程序。该计算机程序可被处理器所执行,以用于实现以下各个实施例所提供的一种图像分类方法。内存储器为非易失性存储介质中的操作系统计算机程序提供高速缓存的运行环境。网络接口可以是以太网卡或无线网卡等,用于与外部的电子设备进行通信。该电子设备可以是手机、平板电脑或者个人数字助理或穿戴式设备等。FIG. 1B is a schematic diagram of the internal structure of an electronic device in one embodiment. As shown in FIG. 1B , the electronic device includes a processor, a memory, and a network interface connected through a system bus. Among them, the processor is used to provide computing and control capabilities to support the operation of the entire electronic device. The memory is used for storing data, programs, etc., and at least one computer program is stored in the memory, and the computer program can be executed by the processor to implement the image classification method applicable to the electronic device provided in the embodiments of the present application. The memory may include a non-volatile storage medium such as a magnetic disk, an optical disk, and a read-only memory (Read-Only Memory, ROM), or a random-access-memory (Random-Access-Memory, RAM) and the like. For example, in one embodiment, the memory includes a non-volatile storage medium and internal memory. The nonvolatile storage medium stores an operating system and a computer program. The computer program can be executed by the processor to implement an image classification method provided by the following embodiments. Internal memory provides a cached execution environment for operating system computer programs in non-volatile storage media. The network interface can be an Ethernet card or a wireless network card, etc., and is used to communicate with external electronic devices. The electronic device may be a mobile phone, a tablet computer, a personal digital assistant or a wearable device, and the like.

在一个实施例中,如图2所示,提供了一种图像分类方法,以该方法应用于图1A中的电子设备为例进行说明,包括:In one embodiment, as shown in FIG. 2, an image classification method is provided, and the method is applied to the electronic device in FIG. 1A as an example for description, including:

步骤202,根据人脸面积的大小从图像中获取满足预设条件的第一级人脸,对第一级人脸进行人脸识别,得到第一级人脸所对应的人脸类别。Step 202: Obtain a first-level face that meets a preset condition from an image according to the size of the face area, perform face recognition on the first-level face, and obtain a face category corresponding to the first-level face.

电子设备从本地或云端的相册获取待分类的图像,再从待分类图像中根据人脸面积的大小从图像中获取满足预设条件的第一级人脸。待分类的图像包括单人图像和多人合影图像。单人图像中只有一张人脸,多人合影图像中包括多张人脸。其中,对于多人合影图像根据图像中人脸的面积大小顺序,从大到小依次判断人脸是否符合预设条件,若是,则该符合条件的人脸即为第一级人脸。第一级人脸指的是每张图像中核心人物的人脸。在对每张图像初次提取第一级第一级人脸时,每张图像只提取出一张人脸作为第一级人脸。根据人脸识别算法对获取的每张图像的第一级人脸进行人脸识别,得到每张图像的第一级人脸所对应的人脸类别。人脸类别指的是第一级人脸识别结果所对应的人物身份。具体地,对第一级人脸进行人脸识别之后,得出该第一级人脸对应的身份是张三,即得到该第一级人脸所对应的人脸类别就是张三。The electronic device obtains the images to be classified from the local or cloud album, and then obtains the first-level faces that meet the preset conditions from the images according to the size of the face area from the images to be classified. The images to be classified include single-person images and multi-person group photo images. There is only one face in a single-person image, and multiple faces are included in a group photo image. Among them, for a group photo image of multiple people, according to the order of the area size of the faces in the image, it is judged from large to small whether the faces meet the preset conditions, and if so, the faces that meet the conditions are the first-level faces. The first-level face refers to the face of the core person in each image. When extracting the first-level first-level face for each image for the first time, only one face is extracted from each image as the first-level face. Perform face recognition on the acquired first-level face of each image according to the face recognition algorithm, and obtain the face category corresponding to the first-level face of each image. The face category refers to the identity of the person corresponding to the first-level face recognition result. Specifically, after performing face recognition on the first-level face, it is obtained that the identity corresponding to the first-level face is Zhang San, that is, the face category corresponding to the first-level face is obtained as Zhang San.

步骤204,获取图像中的第二级人脸,对第二级人脸进行人脸识别,得到第二级人脸所对应的人脸类别,第二级人脸为图像中除去第一级人脸之外的人脸。Step 204: Acquire the second-level face in the image, perform face recognition on the second-level face, and obtain the face category corresponding to the second-level face, where the second-level face is the first-level person removed from the image. face other than face.

从待分类图像中获取每张图像的第一级人脸之后,获取图像中的第二级人脸。其中,第二级人脸为图像中除去第一级人脸之外的人脸。对于单人图像就不存在除去第一级人脸之外的人脸,但是对于多人合影图像则会存在除去第一级人脸之外的人脸。After the first-level face of each image is obtained from the images to be classified, the second-level face in the image is obtained. Among them, the second-level face is the face in the image except the first-level face. For a single-person image, there are no faces except the first-level face, but for a group photo image of multiple people, there are faces other than the first-level face.

对图像中的第二级人脸进行处理,分别计算图像中的第二级人脸的清晰度,判断第二级人脸的清晰度是否满足预设条件。若是,则对满足清晰度预设条件的第二级人脸进行人脸识别,得到述第二级人脸所对应的人脸类别。若图像中第二级人脸的清晰度未达到可以识别出人脸对应的身份的清晰度阈值,则继续在相册中的其他图像中寻找与第二级人脸相似的第一级人脸,若寻找到与第二级人脸相似的第一级人脸,则将第二级人脸分入第一级人脸所对应的人脸类别。若未寻找到与第二级人脸相似的第一级人脸,则在相册中的其他图像中寻找与第二级人脸相似的人脸,计算与第二级人脸相似的人脸出现的次数。若次数达到了设定阈值,则对第二级人脸进行人脸识别,得到第二级人脸所对应的人脸类别,若次数未达到了设定阈值,则将第二级人脸标识为第三级人脸。The second-level face in the image is processed, the clarity of the second-level face in the image is calculated respectively, and it is judged whether the clarity of the second-level face meets a preset condition. If so, perform face recognition on the second-level face that satisfies the preset definition condition, and obtain the face category corresponding to the second-level face. If the clarity of the second-level face in the image does not reach the clarity threshold that can identify the identity corresponding to the face, continue to search for the first-level face similar to the second-level face in other images in the album. If a first-level face similar to the second-level face is found, the second-level face is classified into a face category corresponding to the first-level face. If the first-level face similar to the second-level face is not found, look for a face similar to the second-level face in other images in the album, and calculate the appearance of the face similar to the second-level face. number of times. If the number of times reaches the set threshold, face recognition is performed on the second-level face, and the face category corresponding to the second-level face is obtained. If the number of times does not reach the set threshold, the second-level face is identified. For the third-level face.

步骤206,根据第一级人脸所对应的人脸类别和第二级人脸所对应的人脸类别,将图像分入对应的人脸类别。Step 206: Classify the images into corresponding face categories according to the face categories corresponding to the first-level faces and the face categories corresponding to the second-level faces.

由上面的步骤对图像中的第一级人脸和第二级人脸进行了人脸分类,对于能够进行分类的都分入了对应的人脸类别。然后,根据图像中的第一级人脸和第二级人脸所能分入的人脸类别,将图像分入对应的人脸类别。具体地,如果一张图像的第一级人脸和第二级人脸分别分入了3个类别,则该图像将会同时出现在这3个类别中。例如,一张图像包括了3张人脸,分别是张三、李四和王五。其中,假设这张图像的第一级人脸是张三,得到第一级人脸所对应的人脸类别是张三。假设除去第一级人脸之外的第二级人脸因为清晰度满足预设条件,所以也进行了人脸识别,分入了对应的人脸类别中,分别为李四和王五的分类。那么对该图像进行了分类之后,最终将会在张三图集中显示这张图像,也会在李四图集中显示这张图像,当然还会在王五图集中显示这张图像。因为这3个身份对应的人脸都满足一定的条件并进行了人脸识别,分入了对应的人脸类别中。The first-level face and the second-level face in the image are classified by the above steps, and those that can be classified are classified into corresponding face categories. Then, according to the face categories that the first-level face and the second-level face in the image can be classified into, the image is classified into the corresponding face category. Specifically, if the first-level face and the second-level face of an image are classified into 3 categories respectively, the image will appear in these 3 categories at the same time. For example, an image includes 3 faces, namely Zhang San, Li Si and Wang Wu. Among them, it is assumed that the first-level face of this image is Zhang San, and the face category corresponding to the obtained first-level face is Zhang San. Assume that the second-level faces except the first-level faces are also recognized because their clarity meets the preset conditions, and they are classified into the corresponding face categories, which are the classification of Li Si and Wang Wu. . Then after the image is classified, it will eventually be displayed in the Zhang San atlas, the Li Si atlas, and of course in the Wang Wu atlas. Because the faces corresponding to these three identities all meet certain conditions and undergo face recognition, they are classified into the corresponding face categories.

在本实施例中,首先,根据人脸面积的大小从图像中获取满足预设条件的第一级人脸,对第一级人脸进行人脸识别,得到第一级人脸所对应的人脸类别。再获取图像中的第二级人脸,对第二级人脸进行人脸识别,得到第二级人脸所对应的人脸类别,第二级人脸为图像中除去第一级人脸之外的人脸。最后,根据第一级人脸所对应的人脸类别和第二级人脸所对应的人脸类别,将图像分入对应的人脸类别。对图像中的人脸进行分级提取,其中在提取第一级人脸时按照人脸面积从大到小的顺序依次进行提取,且所提取出的第一级人脸需要满足预设条件,因此,提取第一级人脸的条件非常严格,对第一级人脸进行人脸识别,得到第一级人脸所对应的人脸类别。再继续从图像中获取第二级人脸,再对第二级人脸进行人脸识别,得到第二级人脸所对应的人脸类别。如此得到的人脸类别会比较准确,不会出现大量并不重要的人脸类别,提高分类结果的有效性,更加贴合用户实际需求。最终,将图像分入对应的人脸类别。In this embodiment, first, a first-level face that satisfies a preset condition is obtained from an image according to the size of the face area, and face recognition is performed on the first-level face to obtain the person corresponding to the first-level face. face category. Then obtain the second-level face in the image, perform face recognition on the second-level face, and obtain the face category corresponding to the second-level face, and the second-level face is the first-level face in the image. outside face. Finally, according to the face category corresponding to the first-level face and the face category corresponding to the second-level face, the images are classified into corresponding face categories. The faces in the image are extracted in stages, and the first-level faces are extracted in descending order of face area, and the extracted first-level faces need to meet preset conditions, so , the conditions for extracting the first-level face are very strict, and face recognition is performed on the first-level face to obtain the face category corresponding to the first-level face. Then continue to obtain the second-level face from the image, and then perform face recognition on the second-level face to obtain the face category corresponding to the second-level face. The face categories obtained in this way will be more accurate, and there will not be a large number of unimportant face categories, which will improve the effectiveness of the classification results and better meet the actual needs of users. Finally, the images are classified into corresponding face categories.

在一个实施例中,如图3所示,根据人脸面积的大小从图像中获取满足预设条件的第一级人脸,包括:In one embodiment, as shown in FIG. 3 , the first-level face that satisfies a preset condition is obtained from the image according to the size of the face area, including:

步骤302,从多人合影图像中获取人脸面积最大的人脸,判断人脸是否符合预设条件。Step 302: Obtain the face with the largest face area from the multi-person group photo image, and determine whether the face meets the preset condition.

从多人合影图像中获取人脸面积最大的人脸,再判断人脸是否符合预设条件。预设条件包括但不限于以下:判断人脸面积最大的人脸的拍摄角度和焦点,判断拍摄角度是否是正脸,判断拍摄焦点是否为该人脸面积最大的人脸,判断该人脸面积最大的人脸是否离镜头最近。Obtain the face with the largest face area from the multi-person group photo image, and then determine whether the face meets the preset conditions. The preset conditions include but are not limited to the following: determine the shooting angle and focus of the face with the largest face area, determine whether the shooting angle is a frontal face, determine whether the shooting focus is the face with the largest face area, and determine whether the face has the largest face area. whether the face is closest to the camera.

步骤304,若是,则将人脸面积最大的人脸作为多人合影图像的第一级人脸。Step 304, if yes, take the face with the largest face area as the first-level face of the group photo image.

步骤306,若否,则继续从多人合影图像中依次获取人脸面积大小次之的人脸,判断人脸是否符合预设条件,重复执行直到人脸达到最小阈值或获取到第一级人脸为止。Step 306, if not, then continue to sequentially obtain the face with the second largest face area from the group photo image, determine whether the face meets the preset conditions, and repeat the execution until the face reaches the minimum threshold or the first-level person is obtained. until the face.

若判断结果为同时满足上述预设条件,则说明人脸面积最大的人脸应该是核心人物对应的人脸,于是将人脸面积最大的人脸作为多人合影图像的第一级人脸,并进行标记为第一级人脸。If the judgment result is that the above preset conditions are met at the same time, it means that the face with the largest face area should be the face corresponding to the core character, so the face with the largest face area is used as the first-level face of the multi-person group photo image. And mark it as the first-level face.

若判断结果为不满足上述预设条件,则说明人脸面积最大的人脸不是核心人物对应的人脸即第一级人脸,则继续从多人合影图像中获取人脸面积大小次之的人脸,判断人脸是否符合预设条件,若判断结果为同时满足上述预设条件,则说明人脸面积次之的人脸应该是第一级人脸,于是将人脸面积次之的人脸作为多人合影图像的第一级人脸,并进行标记为第一级人脸。If the judgment result is that the above preset conditions are not met, it means that the face with the largest face area is not the face corresponding to the core character, that is, the first-level face, and then continue to obtain the face area of the second group from the group photo image. face, to judge whether the face meets the preset conditions, if the judgment result is that the above preset conditions are met at the same time, it means that the face with the second face area should be the first-level face, so the person with the second face area The face is used as the first-level face of the multi-person group photo image, and is marked as the first-level face.

若人脸面积次之的人脸还不符合预设条件,则说明人脸面积次之的人脸还不是第一级人脸。继续从多人合影图像中获取人脸面积大小再次之的人脸,重复执行直到人脸达到最小阈值或获取到第一级人脸为止。即预设了一个人脸面积的最小阈值,若在人脸面积大于该最小阈值的人脸中,还是未找到符合预设条件的人脸,那么就对这张图像停止获取第一级人脸。If the face with the second face area does not meet the preset condition, it means that the face with the second face area is not the first-level face. Continue to obtain the face with the next face area from the multi-person group photo image, and repeat the execution until the face reaches the minimum threshold or the first-level face is obtained. That is, a minimum threshold of face area is preset. If there is no face that meets the preset conditions among the faces whose face area is larger than the minimum threshold, then stop acquiring the first-level face for this image. .

本申请实施例中,因为相比于单人图像,从多人合影图像中比较难确定第一级人脸,所以按照人脸面积从大到小的顺序依次判断是否能够作为第一级人脸,这样不会遗漏第一级人脸。且设置了预设条件,只有满足这些预设条件的人脸才能成为第一级人脸,这样获取的第一级人脸的结果就更加准确。In the embodiment of the present application, since it is more difficult to determine the first-level face from the multi-person group photo image compared with the single-person image, it is determined whether the first-level face can be used as the first-level face according to the face area in descending order. , so that the first-level face is not missed. And preset conditions are set, and only the faces that meet these preset conditions can become the first-level faces, so that the obtained results of the first-level faces are more accurate.

在一个实施例中,步骤302从多人合影图像中获取人脸面积最大的人脸,判断人脸是否符合预设条件,包括:从多人合影图像中获取人脸面积最大的人脸,判断人脸的角度和焦点是否符合预设条件。In one embodiment, step 302 obtains the face with the largest face area from the multi-person group photo image, and determines whether the face meets the preset condition, including: obtaining the face with the largest face area from the multi-person group photo image, determining Whether the angle and focus of the face meet the preset conditions.

本申请实施例中,从多人合影图像中获取人脸面积最大的人脸,再判断人脸是否符合预设条件。预设条件包括但不限于以下:判断人脸面积最大的人脸的拍摄角度和焦点,判断拍摄角度是否是正脸,判断拍摄焦点是否为该人脸面积最大的人脸,判断该人脸面积最大的人脸是否离镜头最近。只有满足这些预设条件的人脸才能成为第一级人脸,这样获取的第一级人脸的结果就更加准确。In the embodiment of the present application, the face with the largest face area is obtained from the group photo image of multiple people, and then it is determined whether the face meets the preset condition. The preset conditions include but are not limited to the following: determine the shooting angle and focus of the face with the largest face area, determine whether the shooting angle is a frontal face, determine whether the shooting focus is the face with the largest face area, and determine whether the face has the largest face area. whether the face is closest to the camera. Only the faces that meet these preset conditions can become the first-level faces, so that the obtained results of the first-level faces are more accurate.

在一个实施例中,如图4所示,步骤204获取图像中的第二级人脸,对第二级人脸进行人脸识别,得到第二级人脸所对应的人脸类别,包括:In one embodiment, as shown in FIG. 4 , step 204 obtains the second-level face in the image, performs face recognition on the second-level face, and obtains the face category corresponding to the second-level face, including:

步骤402,获取图像中的第二级人脸。Step 402, acquiring the second-level face in the image.

因为第二级人脸为图像中除去第一级人脸之外的人脸,所以从多人合影图像中获取每张图像的第一级人脸之后,获取每张图像中的除去第一级人脸之外的人脸,即为获取了图像中的第二级人脸。Because the second-level face is the face except the first-level face in the image, after obtaining the first-level face of each image from the multi-person group photo image, the first-level face in each image is obtained. The face other than the human face means that the second-level face in the image is obtained.

步骤404,分别计算图像中的第二级人脸的清晰度。Step 404, respectively calculating the sharpness of the second-level face in the image.

步骤406,判断第二级人脸的清晰度是否满足预设条件。Step 406, judging whether the clarity of the second-level face meets a preset condition.

步骤408,若是,则对满足清晰度预设条件的第二级人脸进行人脸识别,得到述第二级人脸所对应的人脸类别。Step 408: If yes, perform face recognition on the second-level face that meets the preset definition condition, and obtain the face category corresponding to the second-level face.

对从多人合影图像中获取到的第二级人脸分别进行计算清晰度,判断第二级人脸的清晰度是否满足预设条件。预设条件可以是达到可以识别出人脸对应的身份的清晰度阈值,例如,对一张第二级人脸可以识别出人脸所对应的人物身份即为清晰度满足预设条件。当然,预设条件也可以是其他具体的清晰度阈值,超过该清晰度阈值,即为清晰度满足预设条件。对于单人图像,不需要提取第一级人脸,单人图像中的人脸可以视为第二级人脸,采用对第二级人脸进行处理的方法进行处理,因此首先直接对单人图像中的人脸进行判断清晰度。Calculate the sharpness of the second-level faces obtained from the multi-person group photo images, respectively, and determine whether the sharpness of the second-level faces satisfies a preset condition. The preset condition may be a threshold of clarity that can identify the identity corresponding to the face. For example, for a second-level face, the identity of the person corresponding to the face can be identified, that is, the clarity meets the preset condition. Of course, the preset condition may also be other specific sharpness thresholds, and if the sharpness threshold exceeds the sharpness threshold, the sharpness satisfies the preset condition. For a single-person image, it is not necessary to extract the first-level face. The face in the single-person image can be regarded as the second-level face, and the method of processing the second-level face is used for processing. Therefore, the single-person face is directly processed first. Determine the sharpness of the faces in the image.

判断第二级人脸的清晰度是否满足预设条件,若满足该预设条件,则对满足清晰度预设条件的第二级人脸进行人脸识别,得到述第二级人脸所对应的人脸类别。Determine whether the clarity of the second-level face satisfies the preset condition, and if the preset condition is met, perform face recognition on the second-level face that meets the preset clarity condition, and obtain the corresponding second-level face face category.

本申请实施例中,对第二级人脸采用清晰度这个条件去判断是否需要进行人脸识别并进行分类。因为采用清晰度这个条件去对第二级人脸进行筛选,只有清晰度满足预设条件的第二级人脸才会被进行识别,并进行分类,所以筛选条件比较严格,筛选出的人脸类别就比较少,从而大大地减少了次要人脸的人脸分类,提高分类结果的有效性,更加贴合用户实际需求。In the embodiment of the present application, the condition of clarity is used for the second-level face to determine whether face recognition and classification are required. Because the condition of clarity is used to screen the second-level faces, only the second-level faces whose clarity meets the preset conditions will be recognized and classified, so the screening conditions are relatively strict, and the screened faces There are fewer categories, thus greatly reducing the face classification of secondary faces, improving the validity of the classification results, and more in line with the actual needs of users.

在一个实施例中,如图5所示,方法还包括:In one embodiment, as shown in Figure 5, the method further includes:

步骤410,当判断出第二级人脸的清晰度不满足预设条件时,则在相册中的其他图像中寻找与第二级人脸相似的第一级人脸。Step 410, when it is determined that the clarity of the second-level face does not meet the preset condition, search for a first-level face similar to the second-level face in other images in the album.

若图像中第二级人脸的清晰度未达到预设条件,则继续在相册中的其他图像中寻找与第二级人脸相似的第一级人脸。例如,单人图像或多人合影图像中所提取出的第一级人脸,如果该第一级人脸与图像中的第二级人脸相似,则可以将该图像中的第二级人脸分入该第一级人脸对应的人脸类别中。相似的概念,可以定义为人脸特征的相似度达到了设定阈值。例如,人脸特征的相似度达到了80%即定义为相似。当然,也可以设置其他合理的数值。If the definition of the second-level face in the image does not meet the preset condition, continue to search for the first-level face similar to the second-level face in other images in the album. For example, a first-level face extracted from a single-person image or a group photo image of multiple people, if the first-level face is similar to the second-level face in the image, the second-level person in the image can be The face is classified into the face category corresponding to the first-level face. The concept of similarity can be defined as the similarity of facial features reaching a set threshold. For example, when the similarity of facial features reaches 80%, it is defined as similar. Of course, other reasonable values can also be set.

步骤412,若寻找到与第二级人脸相似的第一级人脸,则将第二级人脸分入第一级人脸所对应的人脸类别。Step 412: If a first-level face similar to the second-level face is found, classify the second-level face into a face category corresponding to the first-level face.

若在相册中的其他图像中寻找到与第二级人脸相似的第一级人脸,例如,找到一张第一级人脸,该第二级人脸与该第一级人脸的相似度达到了90%,那么就是找到了与第二级人脸相似的第一级人脸,将第二级人脸分入第一级人脸所对应的人脸类别。If a first-level face similar to the second-level face is found in other images in the album, for example, a first-level face is found, and the second-level face is similar to the first-level face If the degree reaches 90%, then the first-level face that is similar to the second-level face is found, and the second-level face is classified into the face category corresponding to the first-level face.

在本实施例中,将能够在相册中的其他图像中寻找到与第二级人脸相似的第一级人脸的第二级人脸,分入了该第一级人脸对应的类别中。以第一级人脸为分类标准,这样就不会产生特别多其他人脸分类,有助于提高对图像进行人脸分类的准确性。In this embodiment, the second-level face that can find the first-level face similar to the second-level face in other images in the album is classified into the category corresponding to the first-level face . The first-level face is used as the classification standard, so that there will not be too many other face classifications, which helps to improve the accuracy of face classification for images.

在一个实施例中,如图6所示,在在相册中的其他图像中寻找与第二级人脸相似的第一级人脸之后,包括:In one embodiment, as shown in FIG. 6 , after searching for a first-level face similar to a second-level face in other images in the album, it includes:

步骤602,若未寻找到与第二级人脸相似的第一级人脸,则在相册中的其他图像中寻找与第二级人脸相似的人脸。Step 602: If the first-level face similar to the second-level face is not found, search for a face similar to the second-level face in other images in the album.

若在相册中的其他图像中未寻找到与第二级人脸相似的第一级人脸,则在相册中的其他图像中寻找与第二级人脸相似的人脸,该人脸可以不是第一级人脸。相似的概念,可以定义为人脸特征的相似度达到了设定阈值。例如,人脸特征的相似度达到了80%即定义为相似。当然,也可以设置其他合理的数值。若在相册中的其他图像中的所有人脸中寻找与该第二级人脸相似度达到了80%的人脸。If no first-level face similar to the second-level face is found in other images in the album, look for a face similar to the second-level face in other images in the album. The face may not be First class face. The concept of similarity can be defined as the similarity of facial features reaching a set threshold. For example, when the similarity of facial features reaches 80%, it is defined as similar. Of course, other reasonable values can also be set. If all the faces in the other images in the album are searched for a face whose similarity with the second-level face reaches 80%.

步骤604,计算与第二级人脸相似的人脸出现的次数。Step 604: Count the appearance times of faces similar to the second-level faces.

计算从相册中的其他图像中的所有人脸中寻找与该第二级人脸相似度达到了80%的人脸出现的次数。Count the number of occurrences of finding a face that is 80% similar to the second-level face from all the faces in other images in the album.

步骤606,若次数达到了设定阈值,则对第二级人脸进行人脸识别,得到第二级人脸所对应的人脸类别。Step 606, if the number of times reaches the set threshold, perform face recognition on the second-level face, and obtain the face category corresponding to the second-level face.

若计算相似人脸出现的次数达到了设定阈值,则从这些相似人脸中选一张最清晰的人脸,并对该最清晰的人脸进行人脸识别,得出该最清晰的人脸对应的身份,该身份便是这一类的相似人脸所对应的人脸类别,即是该第二级人脸所对应的人脸类别。预设次数可以设置为5次,当然,在其他实施例中,也可以设置为其他合理的次数,例如3次、4次、6次、10次等。If the counted number of occurrences of similar faces reaches the set threshold, select a clearest face from these similar faces, and perform face recognition on the clearest face to obtain the clearest face. The corresponding identity, the identity is the face category corresponding to this type of similar face, that is, the face category corresponding to the second-level face. The preset number of times can be set to 5 times, of course, in other embodiments, it can also be set to other reasonable times, such as 3 times, 4 times, 6 times, 10 times and so on.

步骤608,若次数未达到了设定阈值,则将第二级人脸标识为第三级人脸。Step 608, if the number of times does not reach the set threshold, identify the second-level face as the third-level face.

若计算相似人脸出现的次数未达到设定阈值,则暂时将该第二级人脸标识为第三级人脸。该第三级人脸包含所有未分入人脸类别的人脸。If the counted number of appearances of similar faces does not reach the set threshold, the second-level face is temporarily identified as a third-level face. The third-level face includes all faces that are not classified into face categories.

在本实施例中,将不能够在相册中的其他图像中寻找到与第二级人脸相似的第一级人脸的第二级人脸,却能够在相册中找到相似人脸,且相似人脸出现的次数达到了设定阈值的第二级人脸,从这些相似人脸中提取出最清晰的人脸进行人脸识别并得到人脸类别。对满足上述条件的第二级人脸也得到了人脸类别,且对同时不满足上述两个条件来进行人脸分类的第二级人脸,归入了第三级人脸中,以备后续再次对第三级人脸进行分类。通过一层一层的筛选,将符合条件的第二级人脸都进行了人脸分类,这样保证了分类结果的准确性、完整性。In this embodiment, the second-level face that is similar to the first-level face and the second-level face cannot be found in other images in the album, but similar faces can be found in the album, and they are similar For the second-level face whose number of times of face appearance reaches the set threshold, the clearest face is extracted from these similar faces for face recognition and the face category is obtained. The face category is also obtained for the second-level face that meets the above conditions, and the second-level face that does not meet the above two conditions for face classification is classified into the third-level face for preparation. Subsequently, the third-level face is classified again. Through layer-by-layer screening, all eligible second-level faces are classified, which ensures the accuracy and completeness of the classification results.

在一个实施例中,如图7所示,在将第二级人脸标识为第三级人脸之后,包括:In one embodiment, as shown in FIG. 7 , after identifying the second-level human face as the third-level human face, it includes:

步骤702,计算相册中第三级人脸与属于不同人脸类别的第一级人脸出现在同一张图像上的次数。Step 702: Calculate the number of times that the third-level face in the album and the first-level face belonging to different face categories appear on the same image.

经过上述分类之后,第三级人脸都是未分入人脸类别的人脸。在相册中的所有图像中分别计算每一张第三级人脸与属于不同人脸类别的第一级人脸出现在同一张图像上的次数,即计算相同身份的第三级人脸与不同身份的第一级人脸一起合影的次数。例如,计算身份为A的第三级人脸与不同身份的第一级人脸一起合影的次数,具体为,假设相册中的第一级人脸有张三、李四和王五等10个第一级人脸。那么计算身份为A的第三级人脸与这10个第一级人脸中的任何之一合影的次数。相册中有一张图像是A与张三、李四和王五四人的合影,那么身份为A的第三级人脸与不同身份的第一级人脸一起合影的次数就为3次。若相册中还有一张图像是A与张三俩人的合影,一张图像是A与王五俩人的合影。那么此时身份为A的第三级人脸与不同身份的第一级人脸一起合影的次数就为5次。After the above classification, the third-level faces are all faces that are not classified into the face category. In all the images in the album, the number of times that each third-level face and the first-level face belonging to different face categories appear on the same image are calculated respectively, that is, the third-level face with the same identity and the different The number of times the first-level faces of the identity were grouped together. For example, to count the number of times the third-level face with identity A took photos with first-level faces of different identities, specifically, assuming that there are 10 first-level faces in the album, including Zhang San, Li Si and Wang Wu, etc. First class face. Then count the number of times the third-level face with identity A takes a photo with any one of these 10 first-level faces. There is an image in the album that is a group photo of A with Zhang San, Li Si, and Wang Wusi, so the number of times that the third-level face with identity A and the first-level face of different identities are taken together is 3 times. If there is another image in the album that is a group photo of A and Zhang San, and another image is a group photo of A and Wang Wu. Then, at this time, the number of times the third-level face with identity A and the first-level face with different identities take photos together is 5 times.

步骤704,判断次数是否达到设定阈值。Step 704, judging whether the number of times reaches the set threshold.

设定阈值,可以是设置了相册中第三级人脸与属于不同人脸类别的第一级人脸出现在同一张图像上的次数最低为5次,当然,在其他实施例中,也可以设置为其他合理的次数,例如3次、4次、6次、7次、8次、9次、10次等。To set the threshold, it can be set that the number of times that the third-level face in the album and the first-level face belonging to different face categories appear on the same image is at least 5 times. Of course, in other embodiments, it can also be Set to other reasonable times, such as 3 times, 4 times, 6 times, 7 times, 8 times, 9 times, 10 times, etc.

步骤706,若是,则对第三级人脸进行人脸识别,得到第三级人脸所对应的人脸类别。Step 706, if yes, perform face recognition on the third-level face to obtain the face category corresponding to the third-level face.

步骤708,若否,则保持为第三级人脸。Step 708, if not, keep the third-level face.

判断第三级人脸与属于不同人脸类别的第一级人脸出现在同一张图像上的次数是否达到了设定阈值(例如5次),若达到了5次则对第三级人脸进行人脸识别,得到第三级人脸所对应的人脸类别。Determine whether the number of times the third-level face and the first-level face belonging to different face categories appear on the same image has reached a set threshold (for example, 5 times), and if it reaches 5 times, the third-level face Perform face recognition to obtain the face category corresponding to the third-level face.

在本实施例中,身份为A的第三级人脸与不同身份的第一级人脸一起合影的次数超过设定阈值,就会对身份为A的第三级人脸进行人脸识别,得到第三级人脸所对应的人脸类别。若未达到了5次则保持为疑似路人人脸。等待下次相册中新增图像时候,再对第三级人脸重新计算与属于不同人脸类别的第一级人脸出现在同一张图像上的次数。如此,便对第三级人脸进行了分类,使得第三级人脸也有机会进行人脸分类,得到对应的人脸类别。这样就有效避免了只对每张图像中的第一级人脸和第二级人脸进行人脸识别,保证了方案的完整性和整体性,提高了最终对图像进行分类的分类结果的准确性、有效性。In this embodiment, if the number of times that the third-level face with identity A and the first-level face with different identities take a group photo together exceeds the set threshold, face recognition will be performed on the third-level face with identity A, Get the face category corresponding to the third-level face. If it does not reach 5 times, it will remain as a suspected passerby's face. Wait for the next time when an image is added to the album, and then recalculate the number of times that the third-level face appears on the same image as the first-level face belonging to a different face category. In this way, the third-level face is classified, so that the third-level face also has the opportunity to perform face classification to obtain the corresponding face category. This effectively avoids face recognition only on the first-level face and the second-level face in each image, ensures the integrity and integrity of the scheme, and improves the accuracy of the final image classification result. sex, effectiveness.

在一个实施例中,还提供了一种图像分类方法,以该方法应用于图1A中的电子设备为例进行说明,具体为:In one embodiment, an image classification method is also provided, which is described by taking the method applied to the electronic device in FIG. 1A as an example, specifically:

(1)判断待分类的图像中有几张人脸。(1) Determine how many faces are in the image to be classified.

(2)若图片中只有一张人脸,则跳至第(3)步开始执行,若图像中有多张人脸,即为多人合影图像,则从多人合影图像中获取人脸面积最大的人脸,判断人脸的角度和焦点是否符合预设条件;若是,则将人脸面积最大的人脸作为多人合影图像的第一级人脸。若否,则继续从多人合影图像中获取人脸面积大小次之的人脸,判断人脸是否符合预设条件,重复执行直到人脸面积达到最小阈值或获取到第一级人脸为止。(2) If there is only one face in the picture, skip to step (3) to start execution. If there are multiple faces in the image, that is, a group photo image, then obtain the face area from the multi-person group photo image. For the largest face, it is judged whether the angle and focus of the face meet the preset conditions; If not, continue to obtain the second-largest face from the multi-person group photo image, determine whether the face meets the preset conditions, and repeat the execution until the face area reaches the minimum threshold or the first-level face is obtained.

(3)获取图像中的第二级人脸;分别计算图像中的第二级人脸的清晰度;判断第二级人脸的清晰度是否满足预设条件;若是,则对满足清晰度预设条件的第二级人脸进行人脸识别,得到述第二级人脸所对应的人脸类别。(3) Obtain the second-level face in the image; calculate the clarity of the second-level face in the image respectively; judge whether the clarity of the second-level face meets the preset condition; Perform face recognition on the conditional second-level face to obtain the face category corresponding to the second-level face.

(4)当判断出第二级人脸的清晰度不满足预设条件时,则在相册中的其他图像中寻找与第二级人脸相似的第一级人脸;若寻找到与第二级人脸相似的第一级人脸,则将第二级人脸分入第一级人脸所对应的人脸类别。(4) When it is judged that the clarity of the second-level face does not meet the preset conditions, search for a first-level face similar to the second-level face in other images in the album; If the first-level faces are similar to the first-level faces, the second-level faces are classified into the face categories corresponding to the first-level faces.

(5)若未寻找到与第二级人脸相似的第一级人脸,则在相册中的其他图像中寻找与第二级人脸相似的人脸;计算与第二级人脸相似的人脸出现的次数;若次数达到了设定阈值,则对第二级人脸进行人脸识别,得到第二级人脸所对应的人脸类别;若次数未达到了设定阈值,则将第二级人脸标识为第三级人脸。(5) If the first-level face similar to the second-level face is not found, search for a face similar to the second-level face in other images in the album; calculate the face similar to the second-level face The number of face appearances; if the number of times reaches the set threshold, face recognition is performed on the second-level face, and the face category corresponding to the second-level face is obtained; if the number of times does not reach the set threshold, the The second-level face is identified as the third-level face.

(6)计算相册中第三级人脸与属于不同人脸类别的第一级人脸出现在同一张图像上的次数;判断次数是否达到设定阈值;若是,则对第三级人脸进行人脸识别,得到第三级人脸所对应的人脸类别;若否,则保持为第三级人脸。(6) Calculate the number of times that the third-level face in the album and the first-level face belonging to different face categories appear on the same image; determine whether the number of times reaches the set threshold; Face recognition, get the face category corresponding to the third-level face; if not, keep it as the third-level face.

(7)根据第一级人脸所对应的人脸类别和第二级人脸所对应的人脸类别,以及第三级人脸所对应的人脸类别,将图像分入对应的人脸类别。(7) According to the face category corresponding to the first-level face, the face category corresponding to the second-level face, and the face category corresponding to the third-level face, the images are classified into corresponding face categories .

在一个实施例中,如图8所示,提供了一种图像分类装置800,装置包括:第一级人脸识别模块802、第二级人脸识别模块804及图像分类模块806。其中,In one embodiment, as shown in FIG. 8 , an image classification apparatus 800 is provided. The apparatus includes: a first-level face recognition module 802 , a second-level face recognition module 804 and an image classification module 806 . in,

第一级人脸识别模块802,用于根据人脸面积的大小从图像中获取满足预设条件的第一级人脸,对第一级人脸进行人脸识别,得到第一级人脸所对应的人脸类别。The first-level face recognition module 802 is used to obtain the first-level face that meets the preset conditions from the image according to the size of the face area, perform face recognition on the first-level face, and obtain the information of the first-level face. corresponding face category.

第二级人脸识别模块804,用于获取图像中的第二级人脸,对第二级人脸进行人脸识别,得到第二级人脸所对应的人脸类别,第二级人脸为图像中除去第一级人脸之外的人脸。The second-level face recognition module 804 is used to obtain the second-level face in the image, perform face recognition on the second-level face, and obtain the face category corresponding to the second-level face, the second-level face is the face except the first-level face in the image.

图像分类模块806,用于根据第一级人脸所对应的人脸类别和第二级人脸所对应的人脸类别,将图像分入对应的人脸类别。The image classification module 806 is configured to classify the images into corresponding face categories according to the face categories corresponding to the first-level faces and the face categories corresponding to the second-level faces.

在一个实施例中,如图9所示,第一级人脸识别模块802包括:In one embodiment, as shown in FIG. 9, the first-level face recognition module 802 includes:

多人合影图像的第一级人脸判断模块802a,用于从多人合影图像中获取人脸面积最大的人脸,判断人脸是否符合预设条件。The first-level face judging module 802a of the multi-person group photo image is used to obtain the face with the largest face area from the multi-person group photo image, and determine whether the face meets the preset condition.

多人合影图像的第一级人脸确定模块802b,用于若人脸面积最大的人脸符合预设条件,则将人脸面积最大的人脸作为多人合影图像的第一级人脸。The first-level face determination module 802b of the group photo image is configured to use the face with the largest face area as the first-level face of the group photo image if the face with the largest face area meets the preset condition.

循环模块802c,用于若人脸面积最大的人脸不符合预设条件,则继续从多人合影图像中获取人脸面积大小次之的人脸,判断人脸是否符合预设条件,重复执行直到人脸面积达到最小阈值或获取到第一级人脸为止。The loop module 802c is used for if the face with the largest face area does not meet the preset condition, then continue to obtain the face with the second largest face area from the multi-person group photo image, determine whether the face meets the preset condition, and repeat the execution Until the face area reaches the minimum threshold or the first-level face is obtained.

在一个实施例中,多人合影图像的第一级人脸判断模块802a,还用于从多人合影图像中获取人脸面积最大的人脸,判断人脸的角度和焦点是否符合预设条件。In one embodiment, the first-level face judging module 802a of the group photo image is further configured to obtain the face with the largest face area from the group photo image, and determine whether the angle and focus of the face meet preset conditions .

在一个实施例中,如图10所示,第二级人脸识别模块804包括:In one embodiment, as shown in FIG. 10 , the second-level face recognition module 804 includes:

第二级人脸获取模块8041,用于获取图像中的第二级人脸。The second-level face acquisition module 8041 is used to acquire the second-level human face in the image.

清晰度计算模块8042,用于分别计算图像中的第二级人脸的清晰度。The sharpness calculation module 8042 is used to calculate the sharpness of the second-level human face in the image respectively.

判断模块8043,用于判断第二级人脸的清晰度是否满足预设条件。The judgment module 8043 is used for judging whether the clarity of the second-level face satisfies the preset condition.

人脸识别模块8044,用于若第二级人脸的清晰度满足预设条件,则对满足清晰度预设条件的第二级人脸进行人脸识别,得到述第二级人脸所对应的人脸类别。The face recognition module 8044 is configured to perform face recognition on the second-level face that satisfies the preset clarity condition if the clarity of the second-level face meets the preset condition, and obtain the corresponding second-level face face category.

在一个实施例中,如图11所示,第二级人脸识别模块804还包括:In one embodiment, as shown in FIG. 11 , the second-level face recognition module 804 further includes:

相似第一级人脸寻找模块8045,用于当判断出第二级人脸的清晰度不满足预设条件时,则在相册中的其他图像中寻找与第二级人脸相似的第一级人脸。A similar first-level face finding module 8045 is used to search for a first-level face similar to the second-level face in other images in the album when it is judged that the clarity of the second-level face does not meet the preset condition human face.

第二级人脸分类模块8046,用于若寻找到与第二级人脸相似的第一级人脸,则将第二级人脸分入第一级人脸所对应的人脸类别。The second-level face classification module 8046 is configured to classify the second-level face into a face category corresponding to the first-level face if a first-level face similar to the second-level face is found.

在一个实施例中,第二级人脸识别模块还用于:若未寻找到与第二级人脸相似的第一级人脸,则在相册中的其他图像中寻找与第二级人脸相似的人脸;计算与第二级人脸相似的人脸出现的次数;若次数达到了设定阈值,则对第二级人脸进行人脸识别,得到第二级人脸所对应的人脸类别;若次数未达到了设定阈值,则将第二级人脸标识为第三级人脸。In one embodiment, the second-level face recognition module is further configured to: if the first-level face similar to the second-level face is not found, search for the second-level face in other images in the album Similar faces; count the number of appearances of faces similar to the second-level face; if the number of times reaches the set threshold, perform face recognition on the second-level face to obtain the person corresponding to the second-level face face category; if the number of times does not reach the set threshold, the second-level face is identified as the third-level face.

在一个实施例中,第二级人脸识别模块还用于:计算相册中第三级人脸与属于不同人脸类别的第一级人脸出现在同一张图像上的次数;判断次数是否达到设定阈值;若是,则对第三级人脸进行人脸识别,得到第三级人脸所对应的人脸类别;若次数未达到设定阈值,则保持为第三级人脸。In one embodiment, the second-level face recognition module is also used to: calculate the number of times that the third-level face in the album and the first-level face belonging to different face categories appear on the same image; determine whether the number of times reaches Set the threshold; if yes, perform face recognition on the third-level face to obtain the face category corresponding to the third-level face; if the number of times does not reach the set threshold, it will remain as the third-level face.

上述图像分类装置中各个模块的划分仅用于举例说明,在其他实施例中,可将图像分类装置按照需要划分为不同的模块,以完成上述图像分类装置的全部或部分功能。The division of each module in the above image classification apparatus is only for illustration. In other embodiments, the image classification apparatus may be divided into different modules as required to complete all or part of the functions of the above image classification apparatus.

一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述图像分类方法。A computer program product containing instructions, when run on a computer, causes the computer to perform the image classification method described above.

在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述各实施例所提供的图像分类方法的步骤。In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, implements the steps of the image classification methods provided in the foregoing embodiments.

本申请实施例还提供了一种电子设备,包括存储器,处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现上述各实施例所提供的图像分类方法的步骤。The embodiments of the present application also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, and the processor implements the image classification methods provided by the above embodiments when the computer program is executed. A step of.

本申请实施例还提供了一种电子设备。如图12所示,为了便于说明,仅示出了与本申请实施例相关的部分,具体技术细节未揭示的,请参照本申请实施例方法部分。该电子设备可以为包括手机、平板电脑、PDA(Personal Digital Assistant,个人数字助理)、POS(Point of Sales,销售终端)、车载电脑、穿戴式设备等任意终端设备,以电子设备为手机为例:The embodiments of the present application also provide an electronic device. As shown in FIG. 12 , for the convenience of description, only the parts related to the embodiments of the present application are shown, and the specific technical details are not disclosed, please refer to the method part of the embodiments of the present application. The electronic device can be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales, a sales terminal), a vehicle-mounted computer, a wearable device, etc. The electronic device is a mobile phone as an example :

图12为与本申请实施例提供的电子设备相关的手机的部分结构的框图。参考图12,手机包括:射频(Radio Frequency,RF)电路910、存储器920、输入单元930、显示单元940、传感器950、音频电路960、无线保真(wireless fidelity,WiFi)模块970、处理器980、以及电源990等部件。本领域技术人员可以理解,图12所示的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。FIG. 12 is a block diagram of a partial structure of a mobile phone related to an electronic device provided by an embodiment of the present application. Referring to FIG. 12 , the mobile phone includes: a radio frequency (RF) circuit 910 , a memory 920 , an input unit 930 , a display unit 940 , a sensor 950 , an audio circuit 960 , a wireless fidelity (WiFi) module 970 , and a processor 980 , and power supply 990 and other components. Those skilled in the art can understand that the structure of the mobile phone shown in FIG. 12 does not constitute a limitation on the mobile phone, and may include more or less components than shown, or combine some components, or arrange different components.

其中,RF电路910可用于收发信息或通话过程中,信号的接收和发送,可将基站的下行信息接收后,给处理器980处理;也可以将上行的数据发送给基站。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,RF电路910还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(Global System ofMobile communication,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband CodeDivision Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE))、电子邮件、短消息服务(Short Messaging Service,SMS)等。The RF circuit 910 can be used for receiving and sending signals during sending and receiving of information or during a call. After receiving the downlink information of the base station, it can be processed by the processor 980; it can also send the uplink data to the base station. Typically, the RF circuit includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, RF circuitry 910 may communicate with networks and other devices via wireless communications. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (General Packet Radio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access) Access, CDMA), Wideband Code Division Multiple Access (Wideband Code Division Multiple Access, WCDMA), Long Term Evolution (Long Term Evolution, LTE)), email, Short Messaging Service (Short Messaging Service, SMS) and the like.

存储器920可用于存储软件程序以及模块,处理器980通过运行存储在存储器920的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器920可第一级要包括程序存储区和数据存储区,其中,程序存储区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能的应用程序、图像播放功能的应用程序等)等;数据存储区可存储根据手机的使用所创建的数据(比如音频数据、通讯录等)等。此外,存储器920可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory 920 can be used to store software programs and modules, and the processor 980 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 920 . The memory 920 may include a program storage area and a data storage area at the first level, wherein the program storage area may store an operating system, an application program required for at least one function (such as an application program for a sound playback function, an application program for an image playback function, etc. ), etc.; the data storage area can store data (such as audio data, address book, etc.) created according to the use of the mobile phone. Additionally, memory 920 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.

输入单元930可用于接收输入的数字或字符信息,以及产生与手机900的用户设置以及功能控制有关的键信号输入。具体地,输入单元930可包括触控面板931以及其他输入设备932。触控面板931,也可称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板931上或在触控面板931附近的操作),并根据预先设定的程式驱动相应的连接装置。在一个实施例中,触控面板931可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器980,并能接收处理器980发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板931。除了触控面板931,输入单元930还可以包括其他输入设备932。具体地,其他输入设备932可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)等中的一种或多种。The input unit 930 may be used to receive input numerical or character information, and generate key signal input related to user settings and function control of the mobile phone 900 . Specifically, the input unit 930 may include a touch panel 931 and other input devices 932 . The touch panel 931, also referred to as a touch screen, can collect the user's touch operations on or near it (such as the user using a finger, a stylus, etc., any suitable object or accessory on or near the touch panel 931) operation), and drive the corresponding connection device according to the preset program. In one embodiment, the touch panel 931 may include two parts, a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the touch controller. To the processor 980, and can receive the command sent by the processor 980 and execute it. In addition, the touch panel 931 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 931 , the input unit 930 may further include other input devices 932 . Specifically, other input devices 932 may include, but are not limited to, one or more of physical keyboards, function keys (such as volume control keys, switch keys, etc.), and the like.

显示单元940可用于显示由用户输入的信息或提供给用户的信息以及手机的各种菜单。显示单元940可包括显示面板941。在一个实施例中,可以采用液晶显示器(LiquidCrystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板941。在一个实施例中,触控面板931可覆盖显示面板941,当触控面板931检测到在其上或附近的触摸操作后,传送给处理器980以确定触摸事件的类型,随后处理器980根据触摸事件的类型在显示面板941上提供相应的视觉输出。虽然在图12中,触控面板931与显示面板941是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将触控面板931与显示面板941集成而实现手机的输入和输出功能。The display unit 940 may be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 940 may include a display panel 941 . In one embodiment, the display panel 941 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. In one embodiment, the touch panel 931 may cover the display panel 941, and when the touch panel 931 detects a touch operation on or near it, the touch panel 931 transmits it to the processor 980 to determine the type of the touch event, and then the processor 980 determines the type of the touch event according to the The type of touch event provides a corresponding visual output on display panel 941 . Although in FIG. 12, the touch panel 931 and the display panel 941 are used as two independent components to realize the input and input functions of the mobile phone, in some embodiments, the touch panel 931 and the display panel 941 can be integrated to form a Realize the input and output functions of the mobile phone.

手机900还可包括至少一种传感器950,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板941的亮度,接近传感器可在手机移动到耳边时,关闭显示面板941和/或背光。运动传感器可包括加速度传感器,通过加速度传感器可检测各个方向上加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换)、振动识别相关功能(比如计步器、敲击)等;此外,手机还可配置陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器等。Cell phone 900 may also include at least one sensor 950, such as light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 941 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 941 and/or when the mobile phone is moved to the ear. or backlight. The motion sensor can include an acceleration sensor. The acceleration sensor can detect the magnitude of acceleration in all directions, and can detect the magnitude and direction of gravity when it is stationary. It can be used for applications that recognize the posture of the mobile phone (such as switching between horizontal and vertical screens), and vibration recognition related functions (such as Pedometer, tapping), etc.; in addition, the mobile phone can also be equipped with other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc.

音频电路960、扬声器961和传声器962可提供用户与手机之间的音频接口。音频电路960可将接收到的音频数据转换后的电信号,传输到扬声器961,由扬声器961转换为声音信号输出;另一方面,传声器962将收集的声音信号转换为电信号,由音频电路960接收后转换为音频数据,再将音频数据输出处理器980处理后,经RF电路910可以发送给另一手机,或者将音频数据输出至存储器920以便后续处理。Audio circuit 960, speaker 961 and microphone 962 may provide an audio interface between the user and the cell phone. The audio circuit 960 can transmit the received audio data converted electrical signal to the speaker 961, and the speaker 961 converts it into a sound signal for output; on the other hand, the microphone 962 converts the collected sound signal into an electrical signal, which is converted by the audio circuit 960 After receiving, the audio data is converted into audio data, and then the audio data is output to the processor 980 for processing, and can be sent to another mobile phone via the RF circuit 910, or the audio data can be output to the memory 920 for subsequent processing.

WiFi属于短距离无线传输技术,手机通过WiFi模块970可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图12示出了WiFi模块970,但是可以理解的是,其并不属于手机900的必须构成,可以根据需要而省略。WiFi is a short-distance wireless transmission technology. The mobile phone can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 970. It provides users with wireless broadband Internet access. Although FIG. 12 shows the WiFi module 970, it can be understood that it is not a necessary component of the mobile phone 900 and can be omitted as required.

处理器980是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器920内的软件程序和/或模块,以及调用存储在存储器920内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。在一个实施例中,处理器980可包括一个或多个处理单元。在一个实施例中,处理器980可集成应用处理器和调制解调处理器,其中,应用处理器第一级要处理操作系统、用户界面和应用程序等;调制解调处理器第一级要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器980中。The processor 980 is the control center of the mobile phone, using various interfaces and lines to connect various parts of the entire mobile phone, by running or executing the software programs and/or modules stored in the memory 920, and calling the data stored in the memory 920. Various functions of the mobile phone and processing data, so as to monitor the mobile phone as a whole. In one embodiment, the processor 980 may include one or more processing units. In one embodiment, the processor 980 may integrate an application processor and a modem processor, wherein the first stage of the application processor is to process the operating system, user interface and application programs, etc.; the first stage of the modem processor is to Handle wireless communications. It can be understood that, the above-mentioned modulation and demodulation processor may not be integrated into the processor 980.

手机900还包括给各个部件供电的电源990(比如电池),优选的,电源可以通过电源管理系统与处理器980逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The mobile phone 900 also includes a power supply 990 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 980 through a power management system, so as to manage charging, discharging, and power consumption management functions through the power management system.

在一个实施例中,手机900还可以包括摄像头、蓝牙模块等。In one embodiment, the mobile phone 900 may further include a camera, a Bluetooth module, and the like.

本申请所使用的对存储器、存储、数据库或其它介质的任何引用可包括非易失性和/或易失性存储器。合适的非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM),它用作外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDR SDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)。Any reference to a memory, storage, database, or other medium as used herein may include non-volatile and/or volatile memory. Suitable nonvolatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM), which acts as external cache memory. By way of illustration and not limitation, RAM is available in various forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), Memory Bus (Rambus) Direct RAM (RDRAM), Direct Memory Bus Dynamic RAM (DRDRAM), and Memory Bus Dynamic RAM (RDRAM).

以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several embodiments of the present application, and the descriptions thereof are relatively specific and detailed, but should not be construed as a limitation on the scope of the patent of the present application. It should be pointed out that for those skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which all belong to the protection scope of the present application. Therefore, the scope of protection of the patent of the present application shall be subject to the appended claims.

Claims (10)

1. An image classification method, comprising:
acquiring a face with the largest face area from a multi-person synthetic image, and judging whether the face meets a preset condition or not; if so, taking the face with the largest face area as a first-level face of the multi-person group photo image; if not, continuously acquiring the face with the face area of the second order from the multi-person group photo image, judging whether the face meets the preset condition, and repeatedly executing until the face area reaches the minimum threshold or the first-level face is acquired; acquiring a face from a single image as a first-level face;
carrying out face recognition on the first-level face to obtain a face category corresponding to the first-level face;
for a multi-person group photo image, acquiring a second-level face meeting a definition preset condition in the image, and performing face recognition on the second-level face to obtain a face type corresponding to the second-level face, wherein the second-level face is a face except for a first-level face in the image;
and dividing the image into corresponding face categories according to the face category corresponding to the first-level face and the face category corresponding to the second-level face.
2. The method according to claim 1, wherein the obtaining a face with a largest face area from the multi-person photographic image and determining whether the face meets a preset condition comprises:
and acquiring the face with the largest face area from the multi-person group photo image, and judging whether the angle and the focus of the face meet preset conditions.
3. The method according to claim 1, wherein for the multi-person group photo image, acquiring a second-level face meeting a preset definition condition in the image, and performing face recognition on the second-level face to obtain a face class corresponding to the second-level face, comprises:
acquiring a second-level face in the image;
respectively calculating the definition of the second-level face in the image;
judging whether the definition of the second-level face meets a preset condition or not;
and if so, carrying out face recognition on the second-level face meeting the definition preset condition to obtain the face type corresponding to the second-level face.
4. The method of claim 3, further comprising:
when the definition of the second-level face does not meet the preset condition, searching a first-level face similar to the second-level face in other images in the album;
and if a first-level face similar to the second-level face is found, dividing the second-level face into the face type corresponding to the first-level face.
5. The method of claim 4, wherein after finding the first level face similar to the second level face in the other images in the album, comprising:
if the first-level face similar to the second-level face is not found, searching faces similar to the second-level face in other images in the album;
calculating the occurrence times of the human faces similar to the second-level human faces;
if the times reach a set threshold value, carrying out face recognition on the second-level face to obtain a face type corresponding to the second-level face;
and if the times do not reach a set threshold value, identifying the second-level face as a third-level face.
6. The method of claim 5, wherein after said identifying said second level face as a third level face, comprising:
calculating the times of the third-level face and the first-level faces belonging to different face categories appearing on the same image in the photo album;
judging whether the times reach a set threshold value or not;
if so, carrying out face recognition on the third-level face to obtain a face class corresponding to the third-level face;
and if not, keeping the face as the third-level face.
7. The method according to claim 1, wherein the obtaining a face with a largest face area from the multi-person photographic image and determining whether the face meets a preset condition comprises:
and acquiring the face with the largest face area from the multi-person group photo image, and judging whether the face with the largest face area is closest to the lens.
8. An image classification apparatus, characterized in that the apparatus comprises:
the first-stage face recognition module is used for acquiring a face with the largest face area from the multi-person synthetic image and judging whether the face meets a preset condition or not; if so, taking the face with the largest face area as a first-level face of the multi-person group photo image; if not, continuously acquiring the face with the face area of the second order from the multi-person group photo image, judging whether the face meets the preset condition, and repeatedly executing until the face area reaches the minimum threshold or the first-level face is acquired; acquiring a face from a single image as a first-level face; acquiring a first-level face meeting preset conditions from an image according to the sequence of the face areas from large to small, and performing face recognition on the first-level face to obtain a face type corresponding to the first-level face;
the second-level face recognition module is used for acquiring a second-level face meeting the definition preset condition in the image for the multi-person group photo image, and performing face recognition on the second-level face to obtain a face type corresponding to the second-level face, wherein the second-level face is a face except the first-level face in the image;
and the image classification module is used for classifying the image into corresponding face classes according to the face class corresponding to the first-level face and the face class corresponding to the second-level face.
9. An electronic device comprising a memory and a processor, the memory having stored thereon a computer program, wherein the computer program, when executed by the processor, causes the processor to perform the steps of the image classification method according to any one of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the image classification method according to any one of claims 1 to 7.
CN201711270284.6A 2017-12-05 2017-12-05 Image classification method and apparatus, electronic device, computer-readable storage medium Expired - Fee Related CN108021669B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711270284.6A CN108021669B (en) 2017-12-05 2017-12-05 Image classification method and apparatus, electronic device, computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711270284.6A CN108021669B (en) 2017-12-05 2017-12-05 Image classification method and apparatus, electronic device, computer-readable storage medium

Publications (2)

Publication Number Publication Date
CN108021669A CN108021669A (en) 2018-05-11
CN108021669B true CN108021669B (en) 2021-03-12

Family

ID=62078464

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711270284.6A Expired - Fee Related CN108021669B (en) 2017-12-05 2017-12-05 Image classification method and apparatus, electronic device, computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN108021669B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108932724B (en) * 2018-05-31 2020-06-19 杭州晓图科技有限公司 Automatic system auditing method based on multi-person collaborative image annotation
CN110414433A (en) * 2019-07-29 2019-11-05 腾讯科技(深圳)有限公司 Image processing method, device, storage medium and computer equipment
CN110968719B (en) * 2019-11-25 2023-04-18 浙江大华技术股份有限公司 Face clustering method and device
CN113129917A (en) * 2020-01-15 2021-07-16 荣耀终端有限公司 Speech processing method based on scene recognition, and apparatus, medium, and system thereof

Family Cites Families (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8155397B2 (en) * 2007-09-26 2012-04-10 DigitalOptics Corporation Europe Limited Face tracking in a camera processor
JP4264660B2 (en) * 2006-06-09 2009-05-20 ソニー株式会社 IMAGING DEVICE, IMAGING DEVICE CONTROL METHOD, AND COMPUTER PROGRAM
US8031914B2 (en) * 2006-10-11 2011-10-04 Hewlett-Packard Development Company, L.P. Face-based image clustering
JP4254873B2 (en) * 2007-02-16 2009-04-15 ソニー株式会社 Image processing apparatus, image processing method, imaging apparatus, and computer program
CN101339607B (en) * 2008-08-15 2012-08-01 北京中星微电子有限公司 Human face recognition method and system, human face recognition model training method and system
AU2008264173A1 (en) * 2008-12-23 2010-07-08 Canon Kabushiki Kaisha Splitting a single video stream into multiple viewports based on face detection
KR101626004B1 (en) * 2009-12-07 2016-05-31 삼성전자주식회사 Method and apparatus for selective support of the RAW format in digital imaging processor
CN102033958B (en) * 2010-12-28 2013-04-17 Tcl商用信息科技(惠州)股份有限公司 Photo sort management system and method
US8917913B2 (en) * 2011-09-22 2014-12-23 International Business Machines Corporation Searching with face recognition and social networking profiles
CN103064864A (en) * 2011-10-19 2013-04-24 致伸科技股份有限公司 Photo sharing system with face recognition function
US20160078285A1 (en) * 2012-05-23 2016-03-17 Roshni Malani System and Method for Displaying an Object in a Tagged Image
JP6018029B2 (en) * 2013-09-26 2016-11-02 富士フイルム株式会社 Apparatus for determining main face image of captured image, control method thereof and control program thereof
US10121060B2 (en) * 2014-02-13 2018-11-06 Oath Inc. Automatic group formation and group detection through media recognition
JP6009481B2 (en) * 2014-03-11 2016-10-19 富士フイルム株式会社 Image processing apparatus, important person determination method, image layout method, program, and recording medium
CN105824875B (en) * 2016-02-26 2019-08-20 维沃移动通信有限公司 A kind of photo be shared method and mobile terminal
CN106599837A (en) * 2016-12-13 2017-04-26 北京智慧眼科技股份有限公司 Face identification method and device based on multi-image input

Also Published As

Publication number Publication date
CN108021669A (en) 2018-05-11

Similar Documents

Publication Publication Date Title
CN107729815B (en) Image processing method, image processing device, mobile terminal and computer readable storage medium
CN107679559B (en) Image processing method, image processing device, computer-readable storage medium and mobile terminal
CN107729889B (en) Image processing method and apparatus, electronic device, computer-readable storage medium
CN107995422B (en) Image shooting method and device, computer equipment and computer readable storage medium
US20150213127A1 (en) Method for providing search result and electronic device using the same
CN108334539B (en) Object recommendation method, mobile terminal and computer-readable storage medium
CN108021669B (en) Image classification method and apparatus, electronic device, computer-readable storage medium
WO2019052418A1 (en) Facial recognition method and related product
CN112269853B (en) Retrieval processing method, device and storage medium
CN109086761B (en) Image processing method and device, storage medium, electronic device
CN109325518B (en) Image classification method and device, electronic equipment and computer-readable storage medium
CN107944414B (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN107124555A (en) Method, device, computer equipment and computer-readable storage medium for controlling focusing
CN107977431A (en) Image processing method, device, computer device, and computer-readable storage medium
CN109978610A (en) Information processing method, mobile terminal and computer readable storage medium
CN107967339A (en) Image processing method, device, computer-readable recording medium and computer equipment
CN109726726B (en) Event detection method and device in video
CN108737618A (en) Information processing method and device, electronic equipment and computer readable storage medium
CN105335714A (en) Photograph processing method, device and apparatus
CN107729391B (en) Image processing method, image processing device, computer-readable storage medium and mobile terminal
CN104091600A (en) Song position detection method and device
WO2019109887A1 (en) Image processing method, electronic device, and computer readable storage medium
CN108256466B (en) Data processing method and device, electronic equipment and computer readable storage medium
CN108921086A (en) Image processing method and device, storage medium and electronic equipment
CN111027406B (en) Picture identification method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Applicant after: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

Address before: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Applicant before: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20210312

CF01 Termination of patent right due to non-payment of annual fee