Photo set generation method and related equipment

By detecting and clustering face features in photos, intelligent photo collections are automatically generated, which solves the problem of inefficient collation caused by the increase in the number of photos on smart terminal devices, and improves the user experience and the quality of photo collections.

CN119248946APending Publication Date: 2025-01-03HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310807410.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-03
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

As the number of photos on smart terminal devices increases, users need to spend a lot of time sorting out, which is inefficient and has poor user experience.

Method used

Provide a photo collection generation method, by detecting whether the photo includes faces, extracting face features, clustering photos in the library database, filtering and generating photo collections according to preset rules, reducing user manual operations.

Benefits of technology

It improves the efficiency and user experience of photo collection generation, reduces user operations, and the generated photo collection is more representative and beautiful.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248946A_ABST
    Figure CN119248946A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a photo set generation method and related equipment, and the method comprises the steps: responding to a first operation of a user on a first photo, and detecting whether the first photo comprises a human face or not; if the first photo comprises the human face, displaying a creation control of the photo set; in response to a second operation of the user on the creation control, extracting face features in the first photo; clustering a plurality of pictures in a picture library database according to the face features to obtain a plurality of second pictures associated with the first picture; and screening the plurality of second photos according to a preset rule to obtain a plurality of third photos, and generating a photo set according to the plurality of third photos. According to the embodiment of the invention, in response to the operation executed by the user on the photo, when the photo comprises the human face, the plurality of photos are obtained from the photo library database according to the human face features, and the photo set corresponding to the photos is generated, so that the generation efficiency of the photo set is improved, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal technology, which belongs to image processing technology, and in particular to a method for generating a photo collection and related equipment. Background Art

[0002] With the development of terminal technology, smart terminal devices such as smartphones and tablets with camera functions allow users to record various scenes by taking photos or videos. With the use of smart terminal devices, more and more photos are taken and stored, or when users go out to play, they may take a large number of photos in a short period of time. As the number of photos increases, users often need to spend a lot of time to organize the photos, which is inefficient and has a poor user experience. Summary of the invention

[0003] In view of the above, it is necessary to provide a photo collection generation method and related equipment to solve the problem that users need to spend a lot of time organizing photos due to too many photos in electronic devices.

[0004] In a first aspect, the present application provides a method for generating a photo collection, which is applied to an electronic device, and the method includes: in response to a first operation of a user on a first photo, detecting whether the first photo includes a face; if the first photo includes a face, displaying a creation control for a photo collection; in response to a second operation of the user on the creation control, extracting facial features in the first photo; clustering multiple photos in a gallery database of the electronic device according to the facial features in the first photo to obtain multiple second photos associated with the first photo; screening the multiple second photos according to preset rules to obtain multiple third photos, and generating the photo collection based on the multiple third photos.

[0005] According to the above technical solution, when a user performs a preset operation on a photo, it can automatically detect whether the photo includes a face. If the photo includes a face, the gallery database is queried for multiple photos including similar faces, and a corresponding photo collection is created based on the multiple photos. This improves the efficiency of generating photo collections, eliminates the need for users to manually add photos to photo collections, reduces user operations, and improves user experience.

[0006] In one possible implementation, the detecting whether the first photo includes a face includes: detecting whether the first photo has face information; if the first photo does not have face information, detecting whether the first photo has undergone face detection; if the first photo has not undergone face detection, detecting whether the first photo includes a face by using a face detection algorithm; if the first photo has the face information, or the face information is detected by the face detection algorithm, determining that the first photo includes a face; if the first photo does not have the face information and has undergone face detection, or the face information is not detected by the face detection algorithm, determining that the first photo does not include a face.

[0007] According to the above technical solution, when a photo has facial information, it means that the photo has undergone face detection and it is detected that it includes a face. When a photo has undergone face detection and does not have facial information, it means that the photo has undergone face detection and it is detected that it does not include a face. When a photo has not undergone face detection and does not have facial information, a face detection algorithm can be used to detect whether the photo includes a face. This makes it possible to quickly and accurately determine whether the photo includes a face, thereby improving the efficiency of creating a photo collection related to the photo based on the result that the photo includes a face.

[0008] In one possible implementation, detecting whether the first photo includes a face by using a face detection algorithm includes: detecting a face rectangular frame of the first photo by using the face detection algorithm, and if the face rectangular frame is not detected from the first photo, determining that the first photo does not include a face; if the face rectangular frame is detected from the first photo, outputting the face information.

[0009] According to the above technical solution, whether a photo includes a face is determined by whether a face detection algorithm detects a face rectangular frame in the photo. The detection speed is fast, which effectively improves the detection efficiency.

[0010] In a possible implementation, the face information includes the number of faces and the coordinates of at least one vertex on the face rectangular frame.

[0011] According to the above technical solution, the face detection algorithm can be used to quickly detect the number of faces in the photo and the coordinates of at least one vertex on the face rectangular frame, thereby effectively improving the efficiency of acquiring face information.

[0012] In one possible implementation, detecting whether the first photo has facial information includes: obtaining a photo identification of the first photo, and searching for photo information corresponding to the photo identification in the gallery database based on the photo identification; if the facial information corresponding to the photo identification is found in the gallery database, determining that the first photo has the facial information; if the facial information corresponding to the photo identification is not found in the gallery database, determining that the first photo does not have the facial information.

[0013] Through the above technical solution, photo information is searched in the gallery database according to the photo identification, which improves the efficiency of searching the photo information, so that it can be quickly determined whether the photo includes facial information.

[0014] In one possible implementation, detecting whether the first photo has undergone face detection includes: searching for a detection identifier corresponding to the photo identifier in the gallery database based on the photo identifier; if the detection identifier corresponding to the photo identifier is a first identifier, determining that the first photo has undergone face detection; if the detection identifier corresponding to the photo identifier is a second identifier, determining that the first photo has not undergone face detection.

[0015] According to the above technical solution, by adding a detection mark to a photo, it is possible to quickly determine whether the photo has undergone face detection.

[0016] In a possible implementation, extracting facial features in the first photo includes: determining a facial rectangular frame in the first photo through a facial feature extraction algorithm; detecting multiple feature points in the facial rectangular frame through the facial feature extraction algorithm, and obtaining coordinates of the multiple feature points.

[0017] According to the above technical solution, the coordinates of multiple feature points of the face in the photo are obtained as facial features through a facial feature extraction algorithm, so that the facial features can be accurately extracted and the extraction efficiency of the facial features is improved.

[0018] In a possible implementation, clustering multiple photos in the gallery database of the electronic device according to facial features in the first photo to obtain multiple second photos associated with the first photo includes: acquiring facial features of other photos in the gallery database except the first photo; calculating the similarity between the facial features of the first photo and the facial features of each other photo; and determining multiple other photos corresponding to similarities greater than or equal to a preset value as the multiple second photos associated with the first photo.

[0019] According to the above technical solution, by calculating the similarity between photos and clustering the photos according to the similarity between the photos, the efficiency and accuracy of photo clustering are effectively improved.

[0020] In a possible implementation, the multiple second photos are screened according to a preset rule to obtain a multiple third photos, including: if the number of the multiple second photos is greater than the preset number, obtaining the shooting time of each second photo; selecting second photos whose shooting times are in different years, months and weeks from the multiple second photos; if the number of the selected second photos is greater than the preset number, reducing the number of the selected second photos to the preset number; if the number of the selected second photos is equal to the preset number, using the selected second photos as the multiple third photos; if the number of the selected second photos is less than the preset number, continuing to select second photos whose shooting times are in different years, months and weeks from the multiple second photos so that the number of the selected second photos reaches the preset number.

[0021] According to the above technical solution, the filtered photos can be distributed in different years, months and weeks as much as possible, so that the photos in the photo collection are more representative and more in line with user needs.

[0022] In a possible implementation, the method further includes: scoring the multiple third photos, and determining a cover photo of the photo collection according to the scores of the multiple third photos.

[0023] According to the above technical solution, by selecting a photo in a photo collection as a cover photo, it is convenient for users to understand the person corresponding to the photo collection and to view the photo collection.

[0024] In one possible implementation, scoring the multiple third photos and determining the cover photo of the photo collection based on the scores of the multiple third photos includes: inputting the multiple third photos into an aesthetic evaluation model respectively, outputting the aesthetic score of each third photo through the aesthetic evaluation model, and determining the third photo with the highest aesthetic score as the cover photo of the photo collection.

[0025] According to the above technical solution, the aesthetic score of the photo is determined by the aesthetic evaluation model, and the photo with the highest aesthetic score is selected as the cover photo, so that the cover photo is beautiful and representative, which can attract users to view the photo collection.

[0026] In a possible implementation, the method further includes: editing and playing the photo collection.

[0027] According to the above technical solution, by editing and playing the photo collection, the photos in the photo collection can be displayed after the photo collection is created, so that users can view the photo collection easily.

[0028] In a possible implementation, the editing and playing of the photo collection includes: obtaining the photo collection from the gallery database through an editing tool, setting the display time and display mode of each third photo in the photo collection; and playing the photo collection according to the display time and display mode of each third photo.

[0029] According to the above technical solution, the display time and display mode of the photos in the process of playing the photo collection are set by using the editing tool, making the playback process of the photo collection more interesting.

[0030] In a possible implementation, the method further includes: if the first photo is not included in the created photo collection, screening the multiple second photos according to the preset rules to obtain the multiple third photos, and generating the photo collection based on the multiple third photos; if the first photo is included in the created photo collection, adding the multiple second photos to the created photo collection.

[0031] According to the above technical solution, if the photo is not included in the created photo collection, the photo and other photos associated with the photo are added to the newly created photo collection. If the photo is included in the created photo collection, other photos associated with the photo are added to the created photo collection, thereby updating the created photo collection. Therefore, the photos can be processed differently according to the determination result of whether the photos are included in the created photo collection, so that the generation and creation of photo collections meet user needs.

[0032] In a second aspect, the present application provides an electronic device, comprising a memory and a processor: wherein the memory is used to store program instructions; the processor is used to read and execute the program instructions stored in the memory, and when the program instructions are executed by the processor, the electronic device executes the above-mentioned photo collection generation method.

[0033] In a third aspect, the present application provides a chip coupled to a memory in an electronic device, wherein the chip is used to control a processor of the electronic device to execute the above-mentioned photo collection generation method.

[0034] In a fourth aspect, the present application provides a computer storage medium storing program instructions, which, when executed on an electronic device, causes a processor of the electronic device to execute the above-mentioned method for generating a photo collection.

[0035] In addition, the technical effects brought about by the second to fourth aspects can be found in the descriptions related to the methods of each design in the above method part, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 It is a schematic diagram of a gallery database interface provided in an embodiment of the present application.

[0037] Figure 2 It is a software architecture diagram of an electronic device provided in one embodiment of the present application.

[0038] Figure 3 This is a flowchart of a method for generating a photo collection provided in one embodiment of the present application.

[0039] Figure 4 It is a schematic diagram of another gallery application program interface provided by an embodiment of the present application.

[0040] Figure 5 It is a schematic diagram of another gallery application program interface provided by an embodiment of the present application.

[0041] Figure 6 It is a schematic diagram of another gallery application program interface provided by an embodiment of the present application.

[0042] Figure 7 It is a schematic diagram of another gallery application program interface provided by an embodiment of the present application.

[0043] Figure 8 This is a flowchart of face detection provided by an embodiment of the present application.

[0044] Fig. 9 This is a flowchart of facial feature extraction provided by an embodiment of the present application.

[0045] Fig.10 This is a flowchart of photo clustering provided by an embodiment of the present application.

[0046] Fig.11 This is a flowchart of photo screening provided by an embodiment of the present application.

[0047] Fig.12 This is a flowchart of a method for generating a photo collection provided in another embodiment of the present application.

[0048] Fig.13 This is a flowchart of a method for generating a photo collection provided in another embodiment of the present application.

[0049] Fig.14 It is a schematic diagram of another gallery application program interface provided by an embodiment of the present application.

[0050] Fig.15 This is a flowchart of a method for generating a photo collection provided in another embodiment of the present application.

[0051] Fig.16This is a partial processing timing diagram of a method for generating a photo collection provided in one embodiment of the present application.

[0052] Fig.17 This is a partial processing timing diagram of a method for generating a photo collection provided in one embodiment of the present application.

[0053] Fig.18 This is a flowchart of a method for generating a photo collection provided in another embodiment of the present application.

[0054] Fig.19 This is a hardware architecture diagram of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0055] The terms "first" and "second" involved in an embodiment of the present application are only used for descriptive purposes and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in an embodiment of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way.

[0056] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those generally understood by technicians in the technical field in this application. The terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. It should be understood that, unless otherwise specified in this application, " / " means or. For example, A / B can represent A or B. "And / or" in this application is only a description of the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. "At least one" refers to one or more. "Multiple" refers to two or more than two. For example, at least one of a, b or c can represent: a, b, c, a and b, a and c, b and c, a, b and c. In the absence of conflict, the following embodiments and the features in the embodiments can be combined with each other.

[0057] For the detailed implementation process of the photo collection generation method, please refer to the description in the various embodiments below.

[0058] In order to better understand the photo collection generation method provided in the embodiment of the present application, Figure 1The application scenario of the photo collection generation method provided in the embodiment of the present application is described.

[0059] With the development of terminal technology, smart terminal devices such as smartphones and tablets with camera functions allow users to record various scenes by taking photos or videos. As the use time of smart terminal devices increases, more and more photos are taken and stored. Or, when users go out to play, they may take a large number of photos in a short period of time. As the number of photos increases, users often need to spend a lot of time to organize the photos, which is inefficient and has a poor user experience.

[0060] See also Figure 1 As shown, it is a schematic diagram of the gallery application interface provided by an embodiment of the present application. When a user turns on the camera of an electronic device to take photos, the taken photos can be automatically stored in the gallery database and displayed in the gallery application interface. In the gallery application interface, the photos can usually be automatically sorted according to the shooting time. The shooting time includes year, month, date, and specific time, so that users can view photos according to the shooting time. However, as the use time of electronic devices increases, there are more and more photos in the gallery database. Users usually tend to view current or recently taken photos. Since the photos are only sorted according to the shooting time, it takes a certain amount of time to find photos with a longer shooting time. In this way, it is not convenient for users to view photos, making it easy for users to forget some wonderful memories, which is contrary to the purpose of taking pictures. Or, when a user goes out to play, he may take a large number of photos in a short period of time, and as the number of photos increases, the user needs to spend a lot of time to organize the photos, and may even forget to view some photos.

[0061] In order to facilitate users to view photos according to the correlation between photos, evoke wonderful memories of the past for users, and facilitate users to organize photos, an embodiment of the present application provides a photo collection generation method, which can generate a photo collection according to facial features of photos.

[0062] See also Figure 2 As shown, it is a software architecture diagram of the electronic device provided in the embodiment of the present application. The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. For example, the Android system is divided into four layers, from top to bottom, respectively, the application layer 101, the framework layer 102, the Android runtime (Androidruntime) and the system library 103, the hardware abstraction layer 104, the kernel layer 105, and the hardware layer 106.

[0063] The application layer 101 may include a series of application packages, such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, device control service and other applications.

[0064] The framework layer 102 provides an application programming interface (API) and a programming framework for the application programs of the application layer. The application framework layer includes some predefined functions. For example, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, etc.

[0065] Among them, the window manager is used to manage window programs. The window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, capture the screen, etc. The content provider is used to store and obtain data and make the data accessible to the application. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phone books, etc. The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build applications. The display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying pictures. The phone manager is used to provide communication functions for electronic devices. For example, the management of call status (including connected, hung up, etc.). The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, etc. The notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify the completion of downloads, message reminders, etc. The notification manager can also be a notification that appears in the top status bar of the system in the form of an icon or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is prompted in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0066] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system. The core library contains two parts: one is the function that the Java language needs to call, and the other is the Android core library.

[0067] The application layer 101 and the framework layer 102 run in a virtual machine. The virtual machine executes the Java files of the application layer and the framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0068] The system library 103 may include multiple functional modules, such as a surface manager, a media library, a 3D graphics processing library (eg, OpenGL ES), a 2D graphics engine (eg, SGL), and the like.

[0069] Among them, the surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of multiple commonly used audio and video formats, as well as static image files. The media library can support multiple audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing. The 2D graphics engine is a drawing engine for 2D drawing.

[0070] The hardware abstraction layer 104 runs in the user space, encapsulates the kernel layer driver, and provides a calling interface to the upper layer.

[0071] The kernel layer 105 is a layer between hardware and software and includes at least a display driver, a camera driver, an audio driver, and a sensor driver.

[0072] The kernel layer 105 is the core of the operating system of the electronic device. It is the first layer of software expansion based on hardware, provides the most basic functions of the operating system, is the basis of the operating system, is responsible for managing the system's processes, memory, device drivers, files and network systems, and determines the performance and stability of the system. For example, the kernel can determine the operating time of an application on a certain part of the hardware.

[0073] The kernel layer 105 includes programs closely related to the hardware, such as interrupt handlers, device drivers, etc., and also includes basic, common, and high-frequency modules, such as clock management modules, process scheduling modules, etc., and also includes key data structures. The kernel layer can be set in the processor or solidified in the internal memory.

[0074] The hardware layer 106 includes the hardware of the electronic device, such as a display screen, buttons, a camera, etc.

[0075] See also Figure 3FIG. 1 is a flowchart of a method for generating a photo collection provided by an embodiment of the present application. The method is applied in an electronic device, and the method for generating a photo collection includes:

[0076] S101, in response to a first operation of a user on a first photo, detecting whether the first photo includes a face. If the first photo includes a face, executing S102; if the first photo does not include a face, the process repeatedly executes S101 to detect whether the first photo corresponding to the first operation includes a face.

[0077] In one embodiment of the present application, the first photo may be any photo in the gallery database of the electronic device, or any photo displayed in an application of the electronic device. If the first photo is any photo in the gallery database of the electronic device, the first operation may be to perform a swipe up operation on the first photo in the gallery application interface. Figure 1 As shown, after the user opens the gallery application, the gallery application interface displays thumbnails of some photos in the gallery database. The user can perform swiping up and swiping down on the gallery application interface to switch to display thumbnails of different photos, and the photo corresponding to the thumbnail clicked by the user is used as the first photo. Figure 4 In the schematic diagram shown, when a user clicks on the thumbnail of a first photo in a gallery application interface, the gallery application interface enlarges and displays the first photo, for example, in full screen or separately in a gallery application interface, and receives a swipe-up operation performed by the user on the enlarged first photo. The gallery application may display a first prompt while enlarging and displaying the first photo, and the content of the first prompt may be "Swipe up to generate a portrait memory" to prompt the user to generate a photo collection associated with the first photo by performing a first operation on the first photo.

[0078] In actual applications, the first operation is not limited to the swipe up operation, but may also be any operation such as a swipe down operation, a click operation, a drag operation, or a combination of multiple operations, which is not limited in the embodiments of the present application.

[0079] In another embodiment of the present application, the first operation may also be a download operation performed by the user on the first photo. For example, when the first photo is displayed in an application interface other than the gallery application, the user may perform a download operation on the first photo, thereby downloading the first photo to the gallery database.

[0080] In one embodiment of the present application, it is detected whether the first photo has face information. If the first photo has face information, it is determined that the first photo has a face. If the first photo does not have face information, it is determined whether the first photo has undergone face detection. If the first photo has undergone face detection, it is determined that the first photo does not include a face. If the first photo has not undergone face detection, a face detection algorithm is called to detect whether the first photo includes a face. If the face information of the first photo is obtained by detecting the face detection algorithm, it is determined that the first photo includes a face. If the face information of the first photo is not detected by the face detection algorithm, it is determined that the first photo does not include a face.

[0081] S102, displaying a control for creating a photo collection.

[0082] See also Figure 5 As shown, it is a schematic diagram of another gallery application interface provided by an embodiment of the present application. A creation control is displayed in the gallery application interface as an entry for creating a photo collection. A second prompt is also displayed on the creation control, and the content of the second prompt can be "Generate Memories" to prompt the user that a photo collection associated with the first photo can be created by triggering the first control.

[0083] In one embodiment of the present application, a third prompt can also be displayed in the gallery application interface. The third prompt can be displayed near the creation control. For example, the third prompt and the creation control can be displayed in the same view. The content of the third prompt can be "Based on the current photos, quickly analyze and generate related memory videos to relive good memories" or any other customized prompt content, so as to prompt the user of the functions and / or effects that can be performed by the creation control. For example, the function corresponding to creating a photo collection can be called.

[0084] S103, in response to the user's second operation on the creation control, extracting facial features in the first photo.

[0085] In one embodiment of the present application, the second operation may be a click operation performed by the user on the first control. When it is detected that the user performs a click operation on the first control, the facial features in the first photo are extracted by a facial feature extraction algorithm. Among them, facial features include but are not limited to the position of the face (for example, the coordinates of the facial parts) and the size of the face, as well as the feature vector of the face. The feature vector usually includes multiple feature points. The embodiment of the present application does not limit the facial feature extraction algorithm, which can be a face recognition method based on a convolutional neural network (CNN), a deep nonlinear face shape extraction method, etc.

[0086] S104: Clustering a plurality of photos in a gallery database of the electronic device according to facial features in the first photo to obtain a plurality of second photos associated with the first photo.

[0087] In one embodiment of the present application, multiple photos in the gallery database are clustered by a clustering algorithm based on the facial features in the first photo. The clustering algorithm can group similar photos together, making it easier for users to find common points between photos and facilitate users to view similar photos. For example, clustering algorithms may include: K-Means, Spectral, DBSCAN, Rank Order, etc. and variants of each clustering algorithm. The embodiments of the present application do not limit the specific clustering algorithm used. Among them, the second photo can be included in multiple second photos.

[0088] By clustering multiple photos, multiple second photos associated with the first photo can be obtained. Figure 5 As shown, in one embodiment of the present application, the gallery database application may display thumbnails of the plurality of second photos in the interface of the gallery application, for example, above the create control.

[0089] S105, screening the plurality of second photos according to a preset rule to obtain a plurality of third photos, and generating a photo collection according to the plurality of third photos.

[0090] In one embodiment of the present application, the preset rules may include, but are not limited to: quantity requirements, time requirements. For example, the preset rules may determine the preset number of third photos, and the number of multiple third photos obtained by screening from multiple second photos must be less than or equal to the preset number. For another example, the preset rules may determine the shooting time distribution of the third photo, and screen the third photos distributed in different years, months or weeks from multiple second photos. Through the preset rules, it is possible to ensure that the number of photos in the photo collection is not too large, and the time difference of each photo in the photo collection can be ensured through the control of time distribution, so as to avoid using multiple photos that are too similar and belong to the same time period (for example, multiple photos taken within an hour) as the third photo, and ensure that a certain time span can avoid the selection of multiple similar photos, thereby making the photo collection more readable.

[0091] See also Figure 6-7 As shown, it is a schematic diagram of another gallery application interface provided in an embodiment of the present application. The generated photo collection is displayed below the thumbnail of the second photo, and is displayed as the first photo collection in the photo collection interface of the gallery application.

[0092] Through the above embodiment, when the user performs a preset operation on a photo, it can automatically detect whether the photo includes a face. If the photo includes a face, multiple photos including similar faces are queried in the gallery database, and a corresponding photo collection is created based on the multiple photos, thereby improving the efficiency of generating photo collections. There is no need for users to manually add photos to the photo collection, reducing user operations and improving user experience.

[0093] See also Figure 8 , which is a flow chart of face detection provided by an embodiment of the present application.

[0094] S201, detecting whether the first photo has face information. If the first photo has face information, executing S204; if the first photo does not have face information, executing S202.

[0095] In one embodiment of the present application, the memory of the electronic device includes a gallery database for storing photos and corresponding photo information. The gallery application is a display window of the gallery database. The photo information includes, but is not limited to: photo identification and facial information of the photo. When each photo in the gallery database is taken by a camera and stored in the gallery database, a unique identifier ID (Identifier) ​​of the corresponding photo is automatically generated as the photo identification of the corresponding photo. In one embodiment of the present application, the photo identification can be generated according to the shooting time and shooting order of the photo. For example, the photo identification is "202306181", wherein "20230618" means that the shooting time of the photo is June 18, 2023, and "1" means that the photo is the first photo taken on that date. In other embodiments of the present application, the photo identification can also be a shooting sequence number determined according to the shooting order or a randomly generated identification consisting of numbers or letters + numbers.

[0096] In one embodiment of the present application, when a first operation performed by a user on a first photo is received, in response to the first operation, a photo identifier of the first photo is obtained, and photo information corresponding to the photo identifier is searched in a gallery database according to the photo identifier. If face information corresponding to the photo identifier is found in the gallery database, it is determined that the first photo has face information; if face information corresponding to the photo identifier is not found in the gallery database, it is determined that the first photo does not have face information.

[0097] S202, detecting whether the first photo has been subjected to face detection. If the first photo has been subjected to face detection, executing S205; if the first photo has not been subjected to face detection, executing S203.

[0098] In one embodiment of the present application, the gallery database also stores detection identification of photos, and the detection identification may include two identifications: a first identification and a second identification. For example, the first identification indicates that the photo has been detected, which is represented by 1, and the second identification indicates that the photo has not been detected, which is represented by 0. If the detection identification of the first photo is detected to be 0, it means that the photo has not been detected. If the detection identification of the first photo is detected to be 1, it means that the photo has been detected. Continuing from the above embodiment, if the first photo does not have facial information, the detection identification corresponding to the photo identification can be searched in the gallery database according to the photo identification. If the detection identification corresponding to the photo identification found in the gallery database is the first identification, that is, 1, it is determined that the first photo has been detected by the face. If the detection identification corresponding to the photo identification found in the gallery database is the second identification, that is, 0, it is determined that the first photo has not been detected by the face.

[0099] In another embodiment of the present application, the detection mark of the photo may also be included in the photo mark, for example, located in the first position of the photo mark. If the first photo does not have facial information, the first digit value of the photo mark can be obtained. If the first digit value of the photo mark is 1, the detection mark corresponding to the photo mark is 1, and it is determined that the first photo has undergone face detection. If the first digit value of the photo mark is 0, the detection mark corresponding to the photo mark is 0, and it is determined that the first photo has not undergone face detection. For example, if the photo mark is "0202306181" and the first digit is 0, it means that the photo has not undergone face detection.

[0100] S203, detecting whether the first photo includes a face by using a face detection algorithm. If face information is obtained by detecting the face detection algorithm, executing S204; if face information is not detected by the face detection algorithm, executing S205.

[0101] In one embodiment of the present application, the face detection algorithm is a convolutional neural network model, and the convolutional neural network model corresponding to the face detection algorithm is trained and generated with a face rectangular frame as a feature, and the face rectangular frame is the smallest rectangular frame that includes multiple parts of the face, and the multiple parts may include eyebrows, eyes, nose, and mouth. In other embodiments of the present application, the multiple parts may also include facial features.

[0102] In one embodiment of the present application, a thumbnail of the first photo is input into a model corresponding to a face detection algorithm, and a face rectangular frame of the first photo is extracted by the face detection algorithm. In another embodiment of the present application, the first photo is input into a model corresponding to a face detection algorithm, the size of the first photo is converted into a preset size (e.g., 1200*800) by the face detection algorithm, the first photo is grayed, and the face rectangular frame of the first photo is detected. If the face rectangular frame of the first photo is not detected, it is determined that the first photo does not include a face. If the face rectangular frame of the first photo is detected, the face information is output. Among them, the face information includes but is not limited to the number of faces and the coordinates of at least one vertex on the face rectangular frame. The number of faces is the same as the number of rectangular frames. The coordinates of at least one vertex on the rectangular frame may include the coordinates of the upper left vertex and the lower right vertex of the rectangular frame, and the coordinates of the vertex of the rectangular frame are pixel coordinates. For example, the face information output by the face detection algorithm is "2, target1rect(500*40, 600*80), target2rect(700*200, 800*240)".

[0103] In other embodiments of the present application, the face detection algorithm may also be a cascade classifier based on Haar features, a Dlib face detection algorithm, or the like.

[0104] S204: Determine whether the first photo includes a face.

[0105] S205: Determine that the first photo does not include a face.

[0106] Through the above embodiments, when a photo has facial information, it means that the photo has undergone face detection and it is detected that it includes a face. When a photo has undergone face detection and does not have facial information, it means that the photo has undergone face detection and it is detected that it does not include a face. When a photo has not undergone face detection and does not have facial information, a face detection algorithm can be used to detect whether the photo includes a face, thereby quickly and accurately determining whether the photo includes a face, thereby improving the efficiency of creating a photo collection related to the photo based on the result that the photo includes a face.

[0107] See also Fig. 9 , which is a flowchart of facial feature extraction provided by an embodiment of the present application.

[0108] S301, determining a face rectangular frame in a first photo by using a face feature extraction algorithm.

[0109] In one embodiment of the present application, the face feature extraction algorithm may also be a convolutional neural network model, and the convolutional neural network model corresponding to the face feature extraction algorithm is generated by training with face rectangular frames, face part rectangular frames, and face feature point positions as features. In other embodiments of the present application, the face feature extraction algorithm may also be a cascade classifier based on Haar features, a Dlib face detection algorithm, and the like.

[0110] In one embodiment of the present application, the size of the first photo is converted to a preset size (e.g., 800*600) by a facial feature extraction algorithm, and the first photo is grayscaled, and then the face rectangular frame in the first photo is determined. In another embodiment of the present application, the thumbnail of the first photo can also be input into a model corresponding to the facial feature extraction algorithm. During the grayscale processing, the RGB value of each pixel is combined into a single grayscale value. Common grayscale methods include component method, maximum value method, and average value method, etc., which are not limited by the present application.

[0111] S302, detecting multiple feature points in a face rectangular frame.

[0112] In one embodiment of the present application, the facial feature extraction algorithm detects multiple feature points in the face rectangular frame through a key point detector. For example, the multiple feature points include the beginning and end of the two eyes and the beginning of the nose.

[0113] S303: extracting coordinates of multiple feature points.

[0114] In one embodiment of the present application, the pixel coordinates of the plurality of feature points in the first photo are determined by a facial feature extraction algorithm.

[0115] S304, outputting coordinates of multiple feature points through a facial feature extraction algorithm.

[0116] In one embodiment of the present application, the facial feature extraction algorithm outputs feature vectors corresponding to the coordinates of multiple feature points in float values. For example, the feature vector is points[(94, 238), (98, 271), (105, 303), (113, 334), (125, 362)]. If the first photo includes multiple faces, there are also multiple feature vectors, including target1, points[(100, 200), (50, 281), (60, 305), (156, 402), (95, 320)]; target2, points[(94, 238), (98, 271), (105, 303), (113, 334), (125, 362)].

[0117] Through the above embodiment, the coordinates of multiple feature points of the face in the photo are obtained as facial features through the facial feature extraction algorithm, so that the facial features can be accurately extracted and the extraction efficiency of the facial features is improved.

[0118] See also Fig.10 As shown, it is a flowchart of photo clustering provided by an embodiment of the present application.

[0119] S401, obtaining facial features of other photos except the first photo in the gallery database.

[0120] In one embodiment of the present application, the facial information of the photos stored in the gallery database also includes facial features. The facial information of other photos in the gallery database except the first photo is queried. If the other photos have facial information, the corresponding facial features can be directly obtained. If any of the other photos does not have facial information, the detection mark of the photo is queried. If it is determined that any of the photos has undergone face detection based on the detection mark, there is no need to obtain the facial features of the photo. If it is determined that any of the photos has not undergone face detection based on the detection mark, the facial features of the photo are used. Figure 8 The process shown in the figure is to perform face detection on any photo through the face detection algorithm. After the detection, if it is determined that any photo contains a face, use Fig. 9 In the process shown, the facial features of any photo are extracted by a facial feature extraction algorithm. When it is determined that any photo does not include a face, there is no need to obtain a detection identifier of the photo.

[0121] S402, obtaining facial features of the first photo and facial features of other photos through a clustering algorithm.

[0122] In one embodiment of the present application, the clustering algorithm is a similarity detection algorithm, and the similarity of facial features between different photos can be calculated by the similarity detection algorithm.

[0123] S403, calculating the similarity between the facial features of the first photo and the facial features of each other photo by using a clustering algorithm.

[0124] In one embodiment of the present application, the similarity between the facial features of the first photo and the facial features of each other photo is the Euclidean distance. The calculation formula of the Euclidean distance is:

[0125]

[0126] In the calculation formula (1), A i is the i-th feature of the face feature of the first photo, the i-th feature of the first photo is the i-th feature point coordinate of the first photo, B iis the i-th feature of the face features of other photos, and the i-th feature of other photos is the i-th feature point coordinates of other photos.

[0127] In another embodiment of the present application, the similarity between the facial features of the first photo and the facial features of each other photo is cosine similarity. The calculation formula of cosine similarity is:

[0128]

[0129] In the calculation formula (2), A i is the i-th feature of the face feature of the first photo, the i-th feature of the first photo is the i-th feature point coordinate of the first photo, B i is the i-th feature of the face features of other photos, and the i-th feature of other photos is the i-th feature point coordinates of other photos.

[0130] S404: Determine a plurality of other photos corresponding to similarities greater than or equal to a preset value as a plurality of second photos associated with the first photo.

[0131] In one embodiment of the present application, the similarity between the facial features of the first photo and the facial features of each other photo is compared with a preset value to determine whether the similarity is greater than or equal to the preset value. If the similarity is greater than or equal to the preset value, the other photos corresponding to the similarity are determined as second photos associated with the first photo, thereby determining multiple other photos corresponding to similarities greater than or equal to the preset value as multiple second photos associated with the first photo.

[0132] In one embodiment of the present application, facial features whose similarity with the facial features of the first photo is greater than or equal to a preset value can be represented by a facial identifier, that is, faces with similar features have the same facial identifier, and the facial identifier can be stored in the photo information corresponding to the photo. Through the facial identifier, multiple photos with the same facial identifier can be quickly obtained in the gallery database.

[0133] According to the above embodiment, by calculating the similarity between photos and clustering the photos according to the similarity between the photos, the efficiency and accuracy of photo clustering are effectively improved.

[0134] See also Fig.11 As shown, it is a flowchart of photo screening provided by an embodiment of the present application.

[0135] S501, determining whether the number of the plurality of second photos is less than or equal to a preset number. If the number of the plurality of second photos is greater than the preset number, executing S502; if the number of the plurality of second photos is less than or equal to the preset number, executing S507.

[0136] S502: Obtain the shooting time of each of the plurality of second photos.

[0137] In one embodiment of the present application, the shooting time of each of the multiple second photos can be obtained through the time service of the gallery database, and the shooting time at least includes the shooting year, month and week.

[0138] S503, determining the years in which the shooting times of the plurality of second photos are distributed, the months in each year, and the weeks in each month according to the shooting time of each photo.

[0139] For example, the years in which the shooting time of the plurality of second photos is distributed, the months in each year, and the weeks in each month are distributed as shown in Table 1.

[0140] Table 1

[0141]

[0142] S504, selecting a plurality of second photos taken in different years, months and weeks.

[0143] In one embodiment of the present application, a second photo of each week of each month corresponding to each year is selected, that is, in the first round of photo screening, a photo of each different week corresponding to each year and month is selected to ensure that the photos selected in the first round are distributed in different years, months and weeks. For example, as shown in Table 1, a photo of the 1st and 2nd week of May, the 2nd and 3rd week of June, the 2nd, 4th and 5th week of July, the 2nd and 4th week of January, the 1st and 5th week of May, and the 1st and 3rd week of June in 2023 are selected respectively. Therefore, the photos selected in the first round are distributed in different years, months and weeks.

[0144] S505, determining whether the number of the selected plurality of second photos is greater than, equal to, or less than a preset number. If the number of the second photos is greater than the preset number, executing S506; if the number of the second photos is equal to the preset number, executing S507; if the number of the second photos is less than the preset number, returning to executing S504, and selecting a second photo of a round again.

[0145] S506, reducing the number of second photos to a preset number, and then executing S507. For example, the second photos may be deleted until the number of second photos is reduced to a preset number, and the deletion of the second photos may be performed according to a preset condition, for example, deleting the earliest photo or deleting the photo with the closest shooting time to the current time in chronological order, and the deletion of photos is only an example, and is not limited to this in actual application, for example, random deletion may also be used. In the process of deleting photos, photos with low aesthetic scores may be deleted.

[0146] S507, taking the second photos less than or equal to the preset number as a plurality of third photos, and creating a photo collection based on the plurality of third photos. For example, when the number of second photos obtained through clustering is less than the preset number, the number of third photos in the photo collection is also less than the preset number. When the number of second photos obtained through clustering is greater than or equal to the preset number, the number of third photos in the photo collection is equal to the preset number.

[0147] In one embodiment of the present application, multiple third photos can be packaged into a folder and stored in a gallery database to create a photo collection of the multiple third photos.

[0148] According to the above embodiment, the filtered photos can be distributed in different years, months and weeks as much as possible, so that the photos in the photo collection are more representative and more in line with user needs.

[0149] See also Fig.12 FIG. 1 is a flowchart of a method for generating a photo collection provided by another embodiment of the present application. The method is applied in an electronic device, and the method for generating a photo collection includes:

[0150] S601, in response to a first operation of a user on a first photo, detecting whether the first photo includes a face. If the first photo includes a face, executing S602; if the first photo does not include a face, continuing to execute S601.

[0151] S602, displaying a control for creating a photo collection.

[0152] S603, in response to the user's second operation on the creation control, extracting facial features in the first photo.

[0153] S604: Cluster multiple photos in a gallery database of the electronic device according to facial features in the first photo to obtain multiple second photos associated with the first photo.

[0154] S605, screening the plurality of second photos according to a preset rule to obtain a plurality of third photos, and generating a photo collection according to the plurality of third photos.

[0155] The specific implementation of S601-S605 is the same as that of S101-S105, and will not be repeated here.

[0156] S606: Score the plurality of third photos, and determine a cover photo of the photo collection according to the scores of the plurality of third photos.

[0157] In one embodiment of the present application, multiple third photos are respectively input into an aesthetic evaluation model, and the aesthetic score of each third photo is output by the aesthetic evaluation model, and the third photo with the highest aesthetic score is determined as the cover photo of the photo collection. The aesthetic evaluation model can be a model for evaluating the aesthetic quality of an image, which can judge the aesthetic quality of an image by analyzing the features of the image, such as color, composition, contrast, etc. The embodiment of the present application does not limit the type of aesthetic evaluation model. For example, the aesthetic evaluation model can be an ASM-Net (image cropping model), which can generate an aesthetic score map, and give a corresponding aesthetic score to any sub-image by pooling. It can also be an image aesthetic quality assessment (Image Aesthetic Quality Assessment) algorithm, which assists in computing electronic devices to judge the beauty or ugliness of a picture.

[0158] According to the above embodiment, by selecting a photo in a photo collection as a cover photo, it is convenient for the user to understand the person corresponding to the photo collection and to view the photo collection.

[0159] See also Fig.13 FIG. 1 is a flowchart of a method for generating a photo collection provided by another embodiment of the present application. The method is applied in an electronic device, and the method for generating a photo collection includes:

[0160] S701, in response to a first operation of a user on a first photo, detecting whether the first photo includes a face. If the first photo includes a face, executing S702; if the first photo does not include a face, continuing to execute S701.

[0161] S702, displaying a control for creating a photo collection.

[0162] S703, in response to the user's second operation on the creation control, extracting facial features in the first photo.

[0163] S704: Cluster multiple photos in a gallery database of the electronic device according to facial features in the first photo to obtain multiple second photos associated with the first photo.

[0164] S705, screening the plurality of second photos according to a preset rule to obtain a plurality of third photos, and generating a photo collection according to the plurality of third photos.

[0165] S706: Score the plurality of third photos, and determine a cover photo of the photo collection according to the scores of the plurality of third photos.

[0166] The specific implementation of S701-S706 is the same as that of S601-S606, and will not be repeated here.

[0167] S707, editing and playing the photo collection.

[0168] See also Fig.14 As shown, it is a schematic diagram of another gallery application interface provided by one embodiment of the present application. In one embodiment of the present application, a clipping tool (such as a clipping application) obtains a photo collection from a gallery database, sets the display time and display mode of each photo in the photo collection, and plays the photo collection according to the display time and display mode of each photo. For example, the display time is 2 seconds, and the display modes include full-screen display, half-screen display, tilted display, pop-up display, etc. The display time and display mode of each photo can be the same or different. The embodiment of the present application does not limit the display time and display mode. In other embodiments of the present application, the specific display time can be set to other times and the specific display mode can be set to other display modes according to needs.

[0169] See also Fig.15 FIG. 1 is a flowchart of a method for generating a photo collection provided by another embodiment of the present application. The method is applied in an electronic device, and the method for generating a photo collection includes:

[0170] S801, in response to a first operation of a user on a first photo, detecting whether the first photo includes a face. If the first photo includes a face, executing S802; if the first photo does not include a face, continuing to execute S801.

[0171] S802, displaying a control for creating a photo collection.

[0172] S803, in response to the user's second operation on the creation control, extracting facial features in the first photo.

[0173] S804: Cluster multiple photos in a gallery database of the electronic device according to facial features in the first photo to obtain multiple second photos associated with the first photo.

[0174] S805, determining whether the first photo is included in the created photo collection. If the first photo is not included in the created photo collection, executing S806; if the first photo is included in the created photo collection, executing S809.

[0175] S806, screening the plurality of second photos according to a preset rule to obtain a plurality of third photos, and generating a photo collection according to the plurality of third photos.

[0176] S807, scoring the plurality of third photos, and determining a cover photo of the photo collection according to the scores of the plurality of third photos.

[0177] S808, editing and playing the photo collection.

[0178] The specific implementations of S801-S804 and S806-S807 are the same as those of S701-S706, and are not elaborated here.

[0179] S809, adding the plurality of second photos to the created photo collection, and then executing S808.

[0180] like Figure 6 As shown, in one embodiment of the present application, if the first photo is included in a created photo collection, the created photo collection is displayed in the gallery application interface, and an update control for the created photo collection is displayed. In response to a second operation performed by the user on the update control, a second photo that is not included in the photo collection is determined, and the second photo is added to the created photo collection, and the photo with the highest aesthetic score among the first photo and multiple second photos is selected as the cover photo of the created photo collection.

[0181] In another embodiment of the present application, after S801, it is determined whether the first photo is included in the created photo collection, and if the first photo is not included in the created photo collection, S802 is executed. If the first photo is included in the created photo collection, the created photo collection is displayed in the gallery application interface, and an update control of the created photo collection is displayed, and in response to a second operation performed by the user on the update control, the photos in the gallery database are clustered to obtain multiple second photos associated with the first photo, and a second photo not included in the photo collection is determined, and the second photo not included in the photo collection is added to the created photo collection.

[0182] According to the above embodiment, if the photo is not included in the created photo collection, the photo and other photos associated with the photo are added to the newly created photo collection. If the photo is included in the created photo collection, other photos associated with the photo are added to the created photo collection, thereby updating the created photo collection. Therefore, the photos can be processed differently according to the determination result of whether the photos are included in the created photo collection, so that the generation and creation of the photo collection meets the user needs.

[0183] See also Figure 16-17 , which is a schematic diagram of the processing sequence of the photo collection generation method provided in one embodiment of the present application. The application layer 101 includes a gallery application 1011, a gallery database 1012, and a clipping application 1013. The framework layer 102 includes a face detection module 1021, a face feature extraction module 1022, a clustering module 1023, and a moment analysis module 1024.

[0184] S901, the gallery application 1011 receives a first operation (eg, a swipe up operation) performed by a user on a first photo.

[0185] S902 , the gallery application 1011 obtains face information or detection identification from the gallery database 1012 .

[0186] S903, if the gallery database 1012 includes the facial information of the first photo, return the facial information of the first photo to the gallery application 1011; if the gallery database 1012 does not include the facial information of the first photo, return the detection identifier of the first photo to the gallery application 1011.

[0187] S904: If the first photo does not have any facial information and has not been detected, start face detection and send a face detection instruction to the face detection module 1021.

[0188] S905: The face detection module 1021 calls a face detection algorithm to perform face detection on the first photo.

[0189] S906 , if it is detected that the first photo includes a face, the face detection module 1021 stores the face information in the gallery database 1012 .

[0190] S907, the gallery database 1012 sends the facial information to the gallery application 1011.

[0191] S908, the gallery application 1011 displays a control for creating a photo collection, and receives a second operation (eg, a click operation) from the user on the control.

[0192] S909, if the first photo is not included in the created photo collection, the gallery application 1011 starts facial feature extraction and sends a facial feature extraction instruction to the facial feature extraction module 1022.

[0193] S910, the facial feature extraction module 1022 calls a facial feature extraction algorithm to extract facial features of the first photo.

[0194] S911, the facial feature extraction module 1022 stores the facial features of the first photo in the gallery database 1012.

[0195] S912, the facial feature extraction module 1022 sends the facial features of the first photo to the clustering module 1023 to start photo clustering.

[0196] S913, the clustering module 1023 calls a clustering algorithm to perform photo clustering according to the facial features of the first photo.

[0197] S914 , the clustering module 1023 stores the clustering result (ie, the plurality of photos obtained by clustering) in the gallery database 1012 .

[0198] S915 , the clustering module 1023 starts the time analysis and sends a time analysis instruction to the time analysis module 1024 .

[0199] S916, the moment analysis module 1024 obtains the clustered photos from the gallery database 1012.

[0200] S917, the gallery database 1012 returns the clustered photos to the moment analysis module 1024.

[0201] S918, the moment analysis module 1024 screens the clustered photos, generates a photo collection, and uses the photo with the highest aesthetic score as the cover photo.

[0202] S919, the moment analysis module 1024 stores the photo collection in the gallery database 1012.

[0203] S920, the gallery database 1012 sends an interface refresh instruction to the gallery application 1011, notifying the gallery application 1011 to refresh the interface.

[0204] S921, the gallery database 1012 displays the photo collection and sends a clipping instruction to the clipping application 1013, notifying the clipping application 1013 to clip the photo collection.

[0205] S922, the editing application 1013 obtains photos in the photo collection from the gallery database 1012.

[0206] S923, the gallery database 1012 returns the photos in the photo collection to the editing application 1013.

[0207] S924, the editing application 1013 edits and plays the photos in the photo collection.

[0208] S925, after the photo collection is played, the editing application 1013 sends an interface refresh instruction to the gallery application 1011.

[0209] S926, the gallery application 1011 displays the photo collection and the photos in the photo collection (displayed in the form of thumbnails).

[0210] S927, the editing application 1013 stores the edited photo collection into the gallery database 1012.

[0211] S928, if the photo is included in the photo collection, the gallery application 1011 displays an update control for the photo collection and receives a second operation performed by the user on the update control.

[0212] S929 , the gallery application 1011 sends a clustering instruction to the clustering module 1023 .

[0213] S930, the clustering module 1023 calls a clustering algorithm to cluster photos according to the facial features of the first photo.

[0214] S931, the clustering module 1023 starts the moment analysis, and sends the moment analysis instruction and the clustered photos to the moment analysis module 1024.

[0215] S932, the moment analysis module 1024 adds the photos obtained by clustering that are not included in the photo collection to the photo collection corresponding to the first photo, and selects a cover photo.

[0216] S933, the moment analysis module 1024 stores the updated photo collection in the gallery database 1012.

[0217] S934, the gallery database 1012 sends an interface refresh instruction to the gallery application 1011, notifying the gallery application 1011 to refresh the interface.

[0218] S935, the gallery database 1012 displays the updated photo collection and sends a clipping instruction to the clipping application 1013, notifying the clipping application 1013 to clip the updated photo collection.

[0219] S936 , the editing application 1013 obtains the updated photos in the photo collection from the gallery database 1012 .

[0220] S937, the gallery database 1012 returns the photos in the related photo collection to the editing application 1013.

[0221] S938, the editing application 1013 edits and plays the photos in the updated photo collection.

[0222] See also Fig.18 FIG. 1 is a flowchart of a method for generating a photo collection provided by another embodiment of the present application. The method is applied to an electronic device, and the photo collection may also be an active moment. The method for generating a photo collection includes:

[0223] S1001, receiving a swipe up operation performed by the user on the current photo.

[0224] S1002, determine whether the current photo includes face information. If the current photo includes face information, execute S1003; if the current photo does not include face information, execute S1010.

[0225] S1003, determine whether the current photo is included in the active moment. If the current photo is included in the active moment, execute S1004; if the current photo is not included in the active moment, execute S1009.

[0226] S1004, generating an active moment corresponding to the current photo.

[0227] S1005, selecting photos to be edited in the active moment.

[0228] S1006, select a cover photo for the active moment.

[0229] S1007, storing the active moment data in the gallery database.

[0230] S1008, jump to edit and play the active moment.

[0231] S1009, update active time.

[0232] S1010, determine whether the current photo has been tested. If the current photo has been tested, the process ends; if the current photo has not been tested, execute S1011.

[0233] S1011, performing foreground face detection on the current photo.

[0234] S1012, determine whether the current photo includes a face. If the current photo includes a face, execute S1013; if the current photo does not include a face, the process ends.

[0235] S1013, receiving a click operation performed by the user on the generation control of the active moment.

[0236] S1014, performing foreground face feature extraction and face clustering on the current photo. Then, executing S1004.

[0237] The present application also provides an electronic device 100. Fig.19 As shown, the electronic device 100 can be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, a vehicle-mounted device, a smart home device and / or a smart city device. The embodiments of the present application do not impose any special restrictions on the specific type of the electronic device 100.

[0238] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a Universal Serial Bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a Subscriber Identification Module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0239] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0240] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0241] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0242] The processor 110 may also be provided with a memory for storing instructions and data. In one embodiment of the present application, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use instructions or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0243] In one embodiment of the present application, the processor 110 may include one or more interfaces. The interface may include an Inter-integrated Circuit (I2C) interface, an Inter-integrated Circuit Sound (I2S) interface, a Pulse Code Modulation (PCM) interface, a Universal Asynchronous Receiver / Transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a General-Purpose Input / Output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and / or a Universal Serial Bus (USB) interface, etc.

[0244] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In one embodiment of the present application, the processor 110 may include multiple groups of I2C buses. The processor 110 can be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example: the processor 110 can be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface to realize the touch function of the electronic device 100.

[0245] The I2S interface can be used for audio communication. In one embodiment of the present application, the processor 110 may include multiple I2S buses. The processor 110 may be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In one embodiment of the present application, the audio module 170 may transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call via a Bluetooth headset.

[0246] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In one embodiment of the present application, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In one embodiment of the present application, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering a call via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0247] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In one embodiment of the present application, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example: the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In one embodiment of the present application, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.

[0248] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In one embodiment of the present application, the processor 110 and the camera 193 communicate via the CSI interface to realize the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate via the DSI interface to realize the display function of the electronic device 100.

[0249] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In one embodiment of the present application, the GPIO interface can be used to connect the processor 110 with the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0250] The USB interface 130 is an interface that complies with the USB standard specification, and can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices 100, such as AR devices, etc.

[0251] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0252] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device 100 through the power management module 141.

[0253] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0254] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0255] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0256] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (Low Noise Amplifier, LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In one embodiment of the present application, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In one embodiment of the present application, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0257] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In one embodiment of the present application, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be arranged in the same device as the mobile communication module 150 or other functional modules.

[0258] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0259] In one embodiment of the present application, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include Global System For Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a Global Positioning System (GPS), a Global Navigation Satellite System (GLONASS), a Beidou Navigation Satellite System (BDS), a Quasi-Zenith Satellite System (QZSS) and / or a Satellite Based Augmentation System (SBAS).

[0260] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for generating a photo collection, and is connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0261] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light-emitting diode or an active matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, Microled, Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In one embodiment of the present application, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0262] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0263] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In one embodiment of the present application, ISP can be set in camera 193.

[0264] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal oxide semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In one embodiment of the present application, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0265] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0266] The video codec is used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0267] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of the electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0268] The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).

[0269] Random access memory may include static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth generation DDR SDRAM is generally referred to as DDR5 SDRAM), etc.;

[0270] Non-volatile memory may include disk storage devices and flash memory.

[0271] Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle. It can be divided into single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the storage unit potential level. It can be divided into universal flash storage (UFS), embedded Multi Media Card (eMMC), etc. according to the storage specification.

[0272] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.

[0273] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .

[0274] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device 100. The external non-volatile memory communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external non-volatile memory.

[0275] The internal memory 121 or the external memory interface 120 is used to store one or more computer programs. The one or more computer programs are configured to be executed by the processor 110. The one or more computer programs include multiple instructions. When the multiple instructions are executed by the processor 110, the screen display detection method executed on the electronic device 100 in the above embodiment can be implemented to implement the screen display detection function of the electronic device 100.

[0276] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0277] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In one embodiment of the present application, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

[0278] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.

[0279] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.

[0280] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.

[0281] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm Open Mobile Terminal Platform (OMTP) standard interface or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.

[0282] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.

[0283] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0284] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0285] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In one embodiment of the present application, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100. An embodiment of the present application also provides a computer storage medium, in which computer instructions are stored. When the computer instructions are executed on the electronic device 100, the electronic device 100 executes the above-mentioned related method steps to implement the photo collection generation method in the above-mentioned embodiment.

[0286] An embodiment of the present application also provides a computer program product. When the computer program product runs on a computer, it enables the computer to execute the above-mentioned related steps to implement the photo collection generation method in the above-mentioned embodiment.

[0287] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor can execute the computer-executable instructions stored in the memory so that the chip executes the photo collection generation method in the above-mentioned method embodiments.

[0288] Among them, the electronic device, computer storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above and will not be repeated here.

[0289] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0290] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0291] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0292] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0293] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the software product is stored in a storage medium, including a number of instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (RandomAccess Memory, RAM), disk or optical disk and other media that can store program code.

[0294] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the preferred embodiments, a person of ordinary skill in the art should understand that the technical solution of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present application.

Claims

1. A method for generating a photo collection, applied to an electronic device, characterized in that: The method comprises: In response to a first operation of a user on a first photo, detecting whether the first photo includes a face; If the first photo includes a face, displaying a control for creating a photo collection; In response to a second operation of the user on the creation control, extracting facial features in the first photo; Clustering a plurality of photos in a gallery database of the electronic device according to facial features in the first photo to obtain a plurality of second photos associated with the first photo; The multiple second photos are screened according to preset rules to obtain multiple third photos, and the photo collection is generated based on the multiple third photos.

2. The photo collection generation method according to claim 1, characterized in that: The detecting whether the first photo includes a face includes: Detecting whether the first photo has facial information; If the first photo does not have face information, detecting whether the first photo has been subjected to face detection; If the first photo has not been subjected to face detection, detecting whether the first photo includes a face by using a face detection algorithm; If the first photo has the face information, or the face information is detected by the face detection algorithm, it is determined that the first photo includes a face; If the first photo does not have the facial information and has been subjected to face detection, or the facial information is not detected by the face detection algorithm, it is determined that the first photo does not include a face.

3. The photo collection generation method according to claim 2, characterized in that: The detecting whether the first photo includes a face by using a face detection algorithm includes: Detecting a face rectangular frame of the first photo by using the face detection algorithm, If the face rectangular frame is not detected from the first photo, determining that the first photo does not include a face; If the face rectangular frame is detected from the first photo, the face information is output.

4. The photo collection generation method according to claim 3, characterized in that: The face information includes the number of faces and the coordinates of at least one vertex on the face rectangular frame.

5. The photo collection generation method according to claim 2, characterized in that: The detecting whether the first photo has face information includes: Obtaining a photo identification of the first photo, and searching the photo information corresponding to the photo identification in the photo library database according to the photo identification; If the face information corresponding to the photo identifier is found in the photo library database, it is determined that the first photo has the face information; If the facial information corresponding to the photo identification is not found in the gallery database, it is determined that the first photo does not have the facial information.

6. The photo collection generation method according to claim 5, characterized in that: The detecting whether the first photo has been subjected to face detection includes: Searching the image library database for a detection identifier corresponding to the photo identifier according to the photo identifier; If the detection identifier corresponding to the photo identifier is the first identifier, determining that the first photo has undergone face detection; If the detection identifier corresponding to the photo identifier is the second identifier, it is determined that the first photo has not undergone face detection.

7. The photo collection generation method according to claim 1, characterized in that: The extracting facial features from the first photo includes: Determine a face rectangular frame in the first photo by using a face feature extraction algorithm; The facial feature extraction algorithm is used to detect multiple feature points in the facial rectangular frame, and the coordinates of the multiple feature points are obtained.

8. The photo collection generation method according to claim 1, characterized in that: The clustering of the plurality of photos in the gallery database of the electronic device according to the facial features in the first photo to obtain the plurality of second photos associated with the first photo includes: Acquire facial features of other photos in the gallery database except the first photo; Calculating the similarity between the facial features of the first photo and the facial features of each other photo; A plurality of other photos corresponding to similarities greater than or equal to a preset value are determined as the plurality of second photos associated with the first photo.

9. The photo collection generation method according to claim 1, characterized in that: The step of screening the plurality of second photos according to a preset rule to obtain a plurality of third photos includes: If the number of the plurality of second photos is greater than a preset number, obtaining a shooting time of each second photo; Selecting second photos taken in different years, months and weeks from the plurality of second photos; If the number of the selected second photos is greater than the preset number, reducing the number of the selected second photos to the preset number; If the number of the selected second photos is equal to the preset number, using the selected second photos as the plurality of third photos; If the number of the selected second photos is less than the preset number, continue to select second photos whose shooting time is in different years, months and weeks from the multiple second photos, so that the number of the selected second photos reaches the preset number.

10. The photo collection generation method according to claim 1, characterized in that: The method further comprises: The multiple third photos are scored, and a cover photo of the photo collection is determined according to the scores of the multiple third photos.

11. The photo collection generation method according to claim 10, characterized in that: The step of scoring the plurality of third photos and determining the cover photo of the photo collection according to the scores of the plurality of third photos includes: The multiple third photos are respectively input into an aesthetic evaluation model, an aesthetic score of each third photo is outputted through the aesthetic evaluation model, and the third photo with the highest aesthetic score is determined as the cover photo of the photo collection.

12. The photo collection generation method according to claim 1, characterized in that: The method further comprises: The photo collection is edited and played.

13. The photo collection generation method according to claim 12, characterized in that: The editing and playing of the photo collection includes: Acquire the photo collection from the gallery database by using a editing tool, and set the display time and display mode of each third photo in the photo collection; The photo collection is played according to the display time and display mode of each third photo.

14. The photo collection generation method according to claim 1, characterized in that: The method further comprises: If the first photo is not included in the created photo collection, screening the plurality of second photos according to the preset rule to obtain the plurality of third photos, and generating the photo collection according to the plurality of third photos; If the first photo is included in the created photo collection, the plurality of second photos are added to the created photo collection.

15. An electronic device, characterized in that: The electronic device comprises a memory and a processor: Wherein, the memory is used to store program instructions; The processor is used to read and execute the program instructions stored in the memory. When the program instructions are executed by the processor, the electronic device executes the photo collection generation method as described in any one of claims 1 to 14.

16. A chip coupled to a memory in an electronic device, characterized in that: The chip is used to control the electronic device to execute the photo collection generation method as described in any one of claims 1 to 14.

17. A computer storage medium, characterized in that: The computer storage medium stores program instructions, and when the program instructions are executed on an electronic device, the processor of the electronic device executes the photo collection generation method as described in any one of claims 1 to 14.