WO2021190165A1 - 图片处理方法、装置、存储介质及电子设备 - Google Patents

图片处理方法、装置、存储介质及电子设备 Download PDF

Info

Publication number
WO2021190165A1
WO2021190165A1 PCT/CN2021/074955 CN2021074955W WO2021190165A1 WO 2021190165 A1 WO2021190165 A1 WO 2021190165A1 CN 2021074955 W CN2021074955 W CN 2021074955W WO 2021190165 A1 WO2021190165 A1 WO 2021190165A1
Authority
WO
WIPO (PCT)
Prior art keywords
pictures
category
target category
similarity
picture
Prior art date
Application number
PCT/CN2021/074955
Other languages
English (en)
French (fr)
Inventor
李翰
李亚乾
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2021190165A1 publication Critical patent/WO2021190165A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/55Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • This application belongs to the field of picture technology, and in particular relates to a picture processing method, device, storage medium and electronic equipment.
  • the embodiments of the present application provide a picture processing method, device, storage medium, and electronic equipment, which can effectively manage pictures.
  • an embodiment of the present application provides an image processing method applied to an electronic device, and the method includes:
  • the pictures included in each target category are clustered to obtain a clustering result of each target category.
  • an embodiment of the present application provides an image processing device applied to an electronic device, and the device includes:
  • the acquisition module is used to acquire multiple pictures
  • the classification module is used to classify the multiple pictures to obtain at least one category
  • a determining module configured to determine a target category that meets a preset condition from the at least one category
  • the clustering module is used to cluster the pictures included in each target category to obtain the clustering result of each target category.
  • an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored.
  • the computer program is executed on a computer, the computer is caused to execute the image processing method provided by the embodiment of the present application. In the process.
  • an embodiment of the present application further provides an electronic device including a memory and a processor, and the processor invokes a computer program stored in the memory to execute the process in the image processing method provided in the embodiment of the present application .
  • FIG. 1 is a schematic flowchart of a picture processing method provided by an embodiment of the present application.
  • FIG. 2 is a schematic diagram of another flowchart of a picture processing method provided by an embodiment of the present application.
  • FIG. 3 is a schematic diagram of the architecture of a twin neural network provided by an embodiment of the present application.
  • 4 to 8 are schematic diagrams of scenes of image processing methods provided by embodiments of the present application.
  • Fig. 9 is a schematic structural diagram of a picture processing apparatus provided by an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 11 is a schematic diagram of another structure of an electronic device provided by an embodiment of the present application.
  • the embodiment of the application provides an image processing method applied to an electronic device, and the method includes:
  • the pictures included in each target category are clustered to obtain a clustering result of each target category.
  • the clustering of pictures included in each target category to obtain a clustering result of each target category includes:
  • the method further includes:
  • the calculating the similarity of every two pictures included in each target category includes:
  • the twin neural network is used to calculate the similarity of every two pictures included in each target category.
  • the twin neural network is configured on a cloud device corresponding to the electronic device, and the cloud device is a device deployed in the cloud for calculating the similarity between pictures;
  • the use of the twin neural network to calculate the similarity of every two pictures included in each target category includes:
  • the similarity information of each two pictures included in each target category is received from the cloud device, where the similarity information is similarity information calculated by using a twin neural network.
  • the determining a target category that satisfies a preset condition from the at least one category includes:
  • a target category that satisfies a preset condition is determined from the at least one category, where the target category that meets the preset condition is a category in which the number of pictures contained is greater than or equal to a preset value.
  • the classifying the multiple pictures to obtain at least one category includes:
  • a lightweight image classification algorithm is used to classify the multiple images to obtain at least one category.
  • the execution subject of the embodiments of the present application may be an electronic device such as a smart phone or a tablet computer.
  • FIG. 1 is a schematic flow chart of an image processing method provided by an embodiment of the present application.
  • the flow may include:
  • the electronic device may first obtain multiple pictures.
  • the electronic device can obtain all pictures saved in an album.
  • the electronic device can classify the multiple pictures to obtain at least one category.
  • the electronic device can classify the pictures saved in the album, thereby dividing the pictures saved in the album into multiple categories, such as pictures in the landscape category, pictures in the plant category, and animal categories. Pictures of, pictures of vehicle categories, etc.
  • the electronic device can determine a target category that meets a preset condition from the at least one category.
  • the electronic device can select from the four categories of landscape, plant, animal, and vehicle.
  • the category that meets the preset conditions is determined and determined as the target category.
  • the electronic device determines the landscape category and the plant category as the target category.
  • the electronic device may perform clustering processing on the pictures contained in each target category, thereby obtaining clustering results under each target category.
  • the electronic device can cluster the pictures of the landscape category to obtain the clustering result under the landscape category.
  • the electronic device can also cluster the pictures of the plant category to obtain the clustering result under the plant category.
  • pictures belonging to the landscape category are clustered into 3 clusters after being clustered.
  • the 3 clusters are pictures in the mountain category, pictures in the seascape category, and pictures in the lake view category.
  • the pictures belonging to the plant category are clustered into two clusters, and the two clusters are pictures of the flower category, pictures of the tree category, and so on.
  • the electronic device can classify the multiple pictures to obtain at least one category.
  • the electronic device can determine a target category that satisfies a preset condition from the at least one category, and cluster the pictures in each target category to obtain a clustering result of the pictures in each target category. Therefore, in the embodiment of the present application, the electronic device may first classify the pictures, and then perform a clustering of the pictures of the target category on the basis of the classification, so as to realize the subdivision of the pictures. Since the subdivision of pictures helps to find and browse pictures, the embodiments of the present application can realize effective management of pictures.
  • FIG. 2 is a schematic diagram of another process of the image processing method provided by an embodiment of the application, and the process may include:
  • the electronic device acquires multiple pictures.
  • the electronic device can first obtain all the pictures in its album.
  • the electronic device uses a lightweight image classification algorithm to classify the multiple pictures to obtain at least one category.
  • the electronic device can use the lightweight picture classification algorithm MobileNet V2 to classify all the pictures in the album to obtain at least one category.
  • MobileNet V2 is a general-purpose computer vision neural network designed for electronic devices, especially mobile devices. It can be used to implement image classification, target detection, and semantic segmentation.
  • the electronic device in the embodiment of the present application may also use other lightweight image classification algorithms such as MobileNet V1, MobileNet V3, etc., which is not specifically limited in this embodiment.
  • the lightweight image classification algorithm used to classify the image may be a neural network that has been trained in advance.
  • the lightweight image classification algorithm can be pre-trained according to the required category.
  • the lightweight image classification algorithm can output the classification of the image, that is, the electronic device can obtain the image Classification.
  • the electronic device classifies all pictures in the album into pictures in the landscape category, pictures in the plant category, pictures in the animal category, pictures in the vehicle category, and so on.
  • the electronic device may create a corresponding folder or picture collection for each category of pictures to store the pictures of the category.
  • an electronic device can create a folder named "Landscape” to store pictures in the landscape category, create a folder named "Plants” to store pictures in the plant category, and create a file named "Animals”
  • the folder is used to store pictures of the animal category, a folder named "vehicle” is created to store pictures of the vehicle category, and so on.
  • the electronic device determines a target category that meets a preset condition from at least one category, where the target category that meets the preset condition is a category that contains a number of pictures greater than or equal to a preset value.
  • the electronic device can determine from the four categories that satisfy the preset
  • the target category of the condition where the target category that satisfies the preset condition may be a category in which the number of included pictures is greater than or equal to a preset value.
  • the preset value is 30 sheets.
  • the electronic device may determine a category containing at least 30 pictures as the target category. For example, there are 50 pictures in the landscape category, 35 pictures in the plant category, 20 pictures in the animal category, and 5 pictures in the vehicle category. Then, since both the scenery category pictures and the plant category pictures are greater than 30, the electronic device can determine the scenery category and the plant category as the target category. However, since the number of pictures of the animal category and the picture of the vehicle category are both less than 30, the electronic device will not determine the animal category and the vehicle category as the target category.
  • the electronic device calculates the similarity of every two pictures included in each target category to obtain the similarity of every two pictures included in each target category.
  • the electronic device performs clustering according to the similarity of each two pictures contained in each target category to obtain at least one cluster under each target category, wherein the similarity between the two pictures contained in the same cluster All are greater than or equal to the preset threshold.
  • 204 and 205 can include:
  • the electronic device may perform clustering processing on the pictures included in each target category, thereby obtaining clustering results of the pictures in each target category.
  • the electronic device may perform clustering processing on the pictures contained in each target category in the following manner: the electronic device may perform similarity calculation on every two pictures contained in each target category, In this way, the similarity of every two pictures contained in each target category is obtained. After that, the electronic device can cluster the pictures according to the similarity of each two pictures contained in each target category to obtain at least one cluster under each target category, wherein the pictures contained in the same cluster are paired with each other. The similarity between them is greater than the preset threshold.
  • the electronic device may perform clustering processing on pictures in the landscape category and cluster processing on pictures in the plant category.
  • the electronic device can calculate the similarity of every two pictures in the scenery category, and then cluster the pictures in the scenery category according to the similarity of each two pictures in the scenery category. , So as to obtain at least one cluster under the landscape category, wherein the similarity between the two pictures contained in the same cluster is greater than or equal to the preset threshold.
  • the pictures in the landscape category are clustered into 3 clusters, which are pictures in the mountain category, pictures in the seascape category, and pictures in the lake view category.
  • the similarity between the two pictures in the category of mountain peaks is greater than or equal to the preset threshold, and the similarity between the pictures in the category of seascape is also greater than or equal to the preset threshold.
  • the similarity between two pictures in a category is also greater than or equal to a preset threshold.
  • the electronic device can calculate the similarity of each two pictures in the plant category, and then cluster the pictures of the plant category according to the similarity of each two pictures of the plant category. Category, so as to obtain at least one cluster under the plant category, wherein the similarity between two pictures included in the same cluster is greater than or equal to a preset threshold.
  • the pictures in the plant scene category are clustered into two clusters, and the two clusters are pictures in the flower category and pictures in the tree category.
  • the similarity between the two pictures in the category of flowers is greater than or equal to the preset threshold
  • the similarity between the pictures in the category of trees is also greater than or equal to the preset threshold.
  • the electronic device may create a corresponding folder or picture collection for each cluster under each target category to store the pictures contained in the cluster.
  • the electronic device can create a folder for pictures in the mountain category (mountain cluster) to store pictures in the mountain category, and the electronic device can create a folder for pictures in the seascape category (seascape cluster).
  • the electronic device can create a folder for the pictures of the lake view category (lake view cluster) to store the pictures of the lake view category.
  • the electronic device can create a folder for the pictures of the flower category (flower cluster) to store the pictures of the flower category, and the electronic device can create a folder for the pictures of the tree category (tree cluster) for storage Picture of tree category, etc.
  • the electronic device may first perform a rough classification of the pictures, and then perform a clustering of the pictures of the target category on the basis of the classification, so as to realize the subdivision of the pictures. Since the subdivision of pictures helps to find and browse pictures, the embodiments of the present application can realize effective management of pictures.
  • the electronic device when the electronic device executes the similarity calculation process for every two pictures included in each target category in 204, it may include:
  • the electronic device uses the twin neural network to calculate the similarity of every two pictures included in each target category.
  • the electronic device can use the twin neural network to calculate the similarity of every two pictures included in each target category.
  • Siamese Network can be used to measure the similarity of two inputs.
  • the twin neural network has two inputs (for example, Input 1 and Input 2), and these two inputs Input 1 and Input 2 are input to two neural networks (for example, Network 1 and Network 2, respectively, Network 1 and Input 2).
  • Network 2 can both be convolutional neural networks (CNN, etc.), and these two neural networks can map the input to a new space respectively to form a representation of the input in the new space.
  • the loss function Loss the similarity of the two inputs can be evaluated.
  • the left and right networks can share all the weights.
  • the twin neural network uses Contrastive Loss as the loss function, which can effectively deal with the relationship between paired data in the twin neural network.
  • the architecture of the twin neural network can be shown in Figure 3.
  • the aforementioned twin neural network may be configured on a cloud device corresponding to the electronic device, and the cloud device may be a device deployed in the cloud for calculating the similarity between pictures.
  • the electronic device executes the above-mentioned similarity calculation process for every two pictures included in each target category by using the twin neural network, it may include:
  • the electronic device uploads the pictures contained in the target category to the cloud device;
  • the electronic device receives the similarity information of each two pictures included in each target category from the cloud device, where the similarity information is similarity information calculated by using the twin neural network.
  • the twin neural network used to calculate image similarity can be deployed on cloud devices. Then, after determining the target category, the electronic device can upload the pictures contained in each target category to the cloud device, so that the cloud device can use the twin neural network to analyze every two pictures contained in each target category. Perform similarity calculations. After calculating the similarity, the cloud device can feed back the similarity information between every two pictures in each target category to the electronic device.
  • the calculation of image similarity requires high resources such as device memory, the calculation of image similarity can be performed on a cloud device, thereby saving computing resources of the electronic device.
  • the electronic device can upload the picture for which the similarity is calculated to the cloud device, and the cloud device uses the configured twin neural network to calculate the similarity of the picture.
  • the electronic device can upload the pictures included in each target category to the cloud device at a preset trigger time, and the cloud device calculates the similarity of every two pictures in the same target category.
  • the preset trigger timing may be that the device is in an idle state or a specific time period at night, and so on.
  • the electronic device obtains the selected first picture, where the first picture is one picture among a plurality of pictures.
  • the electronic device determines similar pictures of the first picture.
  • the electronic device recommends similar pictures of the first picture.
  • 206, 207, and 208 may include:
  • pictures belonging to the same cluster can be regarded as pictures similar to each other. Then, for example, when the user selects or favorites a certain picture (that is, the first picture) in the album, the electronic device can determine the similar picture of the first picture according to the clustering result of the pictures in the album, and then compare the first picture to the first picture. A picture similar to the picture is recommended. For example, the electronic device may recommend 3 or 5 pictures with the highest similarity among similar pictures of the first picture to the user. For example, if the user selects or favorites a certain flower picture, the electronic device can determine from the flower cluster pictures 5 pictures that are most similar to the selected or favorite flower picture and recommend to the user, so that the user can also comment on these pictures. Similar pictures can be browsed and saved, etc.
  • FIG. 4 to FIG. 8 are schematic diagrams of scenes of the image processing method provided by the embodiments of the application.
  • the electronic device can first obtain all the pictures in the photo album. After that, the electronic device can classify all the pictures in the album by using the lightweight picture classification algorithm MobileNet V2, which has been learned and trained in advance. For example, the electronic device classifies all pictures in the album into pictures in the landscape category, pictures in the plant category, pictures in the animal category, and pictures in the vehicle category.
  • MobileNet V2 lightweight picture classification algorithm
  • the electronic device can create a corresponding folder for each category of pictures to store the pictures of the category.
  • the electronic device creates four folders, namely scenery, plants, animals, and vehicles.
  • the "landscape" folder is used to store pictures of the landscape category
  • the "plant” folder is used to store pictures of the plant category
  • the "animal” folder is used to store pictures of the animal category
  • the "vehicle” folder is used to store pictures in the category of plants. Used to store pictures of vehicle categories, as shown in Figure 4.
  • the electronic device can obtain the number of pictures in each category, and determine the target category for the category where the number of pictures reaches 30. For example, there are 50 pictures in the landscape category, 35 pictures in the plant category, 20 pictures in the animal category, and 5 pictures in the vehicle category. Then, the electronic device can determine the scenery category and the plant category as the target category.
  • the electronic device can perform clustering processing on the pictures of the landscape category and clustering processing on the pictures of the plant category.
  • the electronic device can upload pictures in the landscape category and pictures in the plant category to the cloud device when the electronic device is turned on and can be connected to the network during a specific time period at night, such as from 02:00 to 03:00.
  • a twin neural network is configured on the cloud device, and the cloud device can use the twin neural network to calculate the similarity between two pictures. For example, after receiving pictures in the landscape category and pictures in the plant category from the electronic device, the cloud device may use the twin neural network to calculate the similarity between each two pictures in the landscape category.
  • the cloud device can use the twin neural network to calculate the similarity between each two pictures in the plant category. After calculating the similarity, the cloud device can send the similarity information between the two pictures of the landscape category and the similarity information between the two pictures of the plant category to the electronic device.
  • the electronic device After the electronic device receives the similarity information between the two pictures of the landscape category and the similarity information between the two pictures of the plant category sent by the cloud device, it can compare the pictures of the landscape category and the plant according to the similarity information.
  • the pictures of the categories are clustered.
  • the electronic device can cluster the pictures in the scenery category according to the similarity of each two pictures in the scenery category, so as to obtain at least one cluster under the scenery category, where the same cluster
  • the similarity between each pair of pictures contained in is greater than or equal to a preset threshold.
  • the pictures in the landscape category are clustered into 3 clusters, which are pictures in the mountain category, pictures in the seascape category, and pictures in the lake view category.
  • the similarity between the two pictures in the category of mountain peaks is greater than or equal to the preset threshold, and the similarity between the pictures in the category of seascape is also greater than or equal to the preset threshold.
  • the similarity between two pictures in a category is also greater than or equal to a preset threshold.
  • the electronic device may cluster the pictures of the plant category according to the similarity of each two plant category pictures, so as to obtain at least one cluster under the plant category, where, The similarity between the pictures contained in the same cluster is greater than or equal to the preset threshold.
  • the pictures in the plant scene category are clustered into two clusters, and the two clusters are pictures in the flower category and pictures in the tree category.
  • the similarity between the two pictures in the category of flowers is greater than or equal to the preset threshold
  • the similarity between the two pictures in the category of trees is also greater than or equal to the preset threshold.
  • the electronic device can create 3 subfolders under the folder corresponding to the landscape category, namely mountain, seascape, and lake view.
  • the subfolder "mountain” is used to store pictures of the mountain category.
  • the subfolder “Seascape” is used to store pictures of the seascape category, and the subfolder “Lake View” is used to store the pictures of the lake view category, as shown in Figure 5.
  • the electronic device can create 2 subfolders under the folder corresponding to the plant category, namely flowers and trees.
  • the subfolder "flower” is used to store pictures of the flower category
  • the subfolder “trees” is used to store the tree category
  • the picture is shown in Figure 6.
  • the electronic device can search for 3 pictures with the highest similarity to the picture A from the subfolder "Mountain", and recommend these 3 similar pictures to the user.
  • the 3 pictures with the highest similarity to picture A in the subfolder "Mountains" are B, C, and D respectively. Then, the electronic device can recommend these three pictures B, C, and D to the user, as shown in FIG. 8.
  • the embodiment of the present application can realize the subdivision of pictures in the album, and recommend the most similar pictures for the user when the user collects pictures. Therefore, the embodiments of the present application can improve the effectiveness and intelligence of album management.
  • the image processing device 300 may include: an acquisition module 301, a classification module 302, a determination module 303, and a clustering module 304.
  • the obtaining module 301 is used to obtain multiple pictures.
  • the classification module 302 is configured to classify the multiple pictures to obtain at least one category.
  • the determining module 303 is configured to determine a target category that meets a preset condition from the at least one category.
  • the clustering module 304 is configured to cluster the pictures included in each target category to obtain a clustering result of each target category.
  • the clustering module 304 may be used to:
  • Clustering is performed according to the similarity of every two pictures contained in each target category to obtain at least one cluster under each target category, wherein the similarities between the two pictures contained in the same cluster are all greater than Or equal to the preset threshold.
  • the clustering module 304 may also be used for:
  • the clustering module 304 may be used to:
  • the twin neural network is used to calculate the similarity of every two pictures included in each target category.
  • the twin neural network is configured on a cloud device corresponding to the electronic device, and the cloud device is a device deployed in the cloud for calculating the similarity between pictures.
  • the clustering module 304 can be used to:
  • the similarity information of each two pictures included in each target category is received from the cloud device, where the similarity information is similarity information calculated by using a twin neural network.
  • the determining module 303 may be used to:
  • a target category that satisfies a preset condition is determined from the at least one category, where the target category that meets the preset condition is a category in which the number of pictures contained is greater than or equal to a preset value.
  • the classification module 302 may be used to:
  • a lightweight image classification algorithm is used to classify the multiple images to obtain at least one category.
  • the embodiment of the present application provides a computer-readable storage medium on which a computer program is stored.
  • the computer program is executed on a computer, the computer is caused to execute the process in the method provided in this embodiment.
  • An embodiment of the present application also provides an electronic device, including a memory and a processor, and the processor is configured to execute a process in the image processing method provided in this embodiment by calling a computer program stored in the memory.
  • the above-mentioned electronic device may be a mobile terminal such as a tablet computer or a smart phone.
  • a mobile terminal such as a tablet computer or a smart phone.
  • FIG. 10 is a schematic structural diagram of an electronic device provided by an embodiment of the application.
  • the electronic device 400 may include components such as a touch screen 401, a memory 402, and a processor 403. Those skilled in the art can understand that the structure of the electronic device shown in FIG. 10 does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or a combination of certain components, or different component arrangements.
  • the touch screen 401 can be used to display information such as images and texts, and can also be used to receive user touch operations.
  • the memory 402 can be used to store application programs and data.
  • the application program stored in the memory 402 contains executable code.
  • Application programs can be composed of various functional modules.
  • the processor 403 executes various functional applications and data processing by running application programs stored in the memory 402.
  • the processor 403 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. The various functions and processing data of the electronic equipment can be used to monitor the electronic equipment as a whole.
  • the processor 403 in the electronic device will load the executable code corresponding to the process of one or more application programs into the memory 402 according to the following instructions, and the processor 403 will run and store the executable code in the memory.
  • the application in 402 thus executes:
  • the pictures included in each target category are clustered to obtain a clustering result of each target category.
  • the electronic device 400 may include components such as a touch screen 401, a memory 402, a processor 403, a battery 404, a microphone 405, and a speaker 406.
  • the touch screen 401 can be used to display information such as images and texts, and can also be used to receive user touch operations.
  • the memory 402 can be used to store application programs and data.
  • the application program stored in the memory 402 contains executable code.
  • Application programs can be composed of various functional modules.
  • the processor 403 executes various functional applications and data processing by running application programs stored in the memory 402.
  • the processor 403 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. The various functions and processing data of the electronic equipment can be used to monitor the electronic equipment as a whole.
  • the battery 404 can be used to supply power to various modules and components of the electronic device.
  • the microphone 405 can be used to pick up sound signals in the surrounding environment, for example, to receive voice instructions issued by the user.
  • the speaker 406 can be used to play sound signals.
  • the processor 403 in the electronic device will load the executable code corresponding to the process of one or more application programs into the memory 402 according to the following instructions, and the processor 403 will run and store the executable code in the memory.
  • the application in 402 thus executes:
  • the pictures included in each target category are clustered to obtain a clustering result of each target category.
  • the processor 403 executes the clustering of the pictures included in each target category, and when obtaining the clustering result of each target category, it may execute: Perform similarity calculation for every two pictures to obtain the similarity of every two pictures included in each target category; perform clustering according to the similarity of every two pictures included in each target category to obtain each target At least one cluster under the category, wherein the similarity between two pictures contained in the same cluster is greater than or equal to a preset threshold.
  • the processor 403 may also execute: obtain a selected first picture, where the first picture is one of the multiple pictures; determine according to the clustering result of each target category Similar pictures of the first picture; recommending similar pictures of the first picture.
  • the processor 403 when the processor 403 executes the similarity calculation for every two pictures included in each target category, it may execute: use the twin neural network to perform the following calculation on every two pictures included in each target category. Perform similarity calculations.
  • the twin neural network is configured on a cloud device corresponding to the electronic device, and the cloud device is a device deployed in the cloud for calculating the similarity between pictures.
  • the processor 403 executes the similarity calculation of every two pictures included in each target category by using the twin neural network, it may execute: upload the pictures included in the target category to the cloud device;
  • the cloud device receives similarity information of every two pictures included in each target category, where the similarity information is similarity information calculated by using a twin neural network.
  • the processor 403 when the processor 403 executes the determination of the target category that meets the preset condition from the at least one category, it may execute: determine the target category that meets the preset condition from the at least one category , Wherein the target category that satisfies the preset condition is a category in which the number of included pictures is greater than or equal to a preset value.
  • the processor 403 when the processor 403 executes the classification of the plurality of pictures to obtain at least one category, it may execute: use a lightweight picture classification algorithm to classify the plurality of pictures to obtain at least A category.
  • the picture processing device provided in the embodiment of the application belongs to the same concept as the picture processing method in the above embodiment, and any method provided in the picture processing method embodiment can be run on the picture processing device.
  • any method provided in the picture processing method embodiment can be run on the picture processing device.
  • For details of the implementation process refer to the embodiment of the image processing method, which will not be repeated here.
  • the computer program may be stored in a computer readable storage medium, such as stored in a memory, and executed by at least one processor.
  • the execution process may include the process of the embodiment of the image processing method.
  • the storage medium may be a magnetic disk, an optical disc, a read only memory (ROM, Read Only Memory), a random access memory (RAM, Random Access Memory), etc.
  • the image processing device of the embodiment of the present application its functional modules may be integrated in one processing chip, or each module may exist alone physically, or two or more modules may be integrated in one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or software function modules. If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer readable storage medium, such as a read-only memory, a magnetic disk or an optical disk, etc. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Biophysics (AREA)
  • Evolutionary Computation (AREA)
  • Biomedical Technology (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Image Analysis (AREA)

Abstract

本申请公开了一种图片处理方法、装置、存储介质及电子设备。图片处理方法可以应用于电子设备,图片处理方法包括:获取多张图片;对多张图片进行分类,得到至少一个类别;从至少一个类别中确定出满足预设条件的目标类别;对每一目标类别中包含的图片进行聚类,得到每一目标类别的聚类结果。

Description

图片处理方法、装置、存储介质及电子设备
本申请要求于2020年3月26日提交中国专利局、申请号为202010225852.6、申请名称为“图片处理方法、装置、存储介质及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请属于图片技术领域,尤其涉及一种图片处理方法、装置、存储介质及电子设备。
背景技术
随着电子设备的拍照能力越来越强,用户经常会使用电子设备拍摄照片,比如用户可以拍摄风景照片,也可以拍摄人物照片等等。用户拍摄的照片一般会被存储到电子设备的相册中,以便用户随时可以查阅这些照片。此外,用户从网络上下载的图片一般也会被存储到相册中。
发明内容
本申请实施例提供一种图片处理方法、装置、存储介质及电子设备,可以对图片进行有效管理。
第一方面,本申请实施例提供一种图片处理方法,应用于电子设备,所述方法包括:
获取多张图片;
对所述多张图片进行分类,得到至少一个类别;
从所述至少一个类别中确定出满足预设条件的目标类别;
对每一目标类别中包含的图片进行聚类,得到每一所述目标类别的聚类结果。
第二方面,本申请实施例提供一种图片处理装置,应用于电子设备,所述装置包括:
获取模块,用于获取多张图片;
分类模块,用于对所述多张图片进行分类,得到至少一个类别;
确定模块,用于从所述至少一个类别中确定出满足预设条件的目标类别;
聚类模块,用于对每一目标类别中包含的图片进行聚类,得到每一所述目标类别的聚类结果。
第三方面,本申请实施例提供一种计算机可读的存储介质,其上存储有计算机程序,当所述计算机程序在计算机上执行时,使得所述计算机执行本申请实施例提供的图片处理方法中的流程。
第四方面,本申请实施例还提供一种电子设备,包括存储器,处理器,所述处理器通过调用所述存储器中存储的计算机程序,以执行本申请实施例提供的图片处理方法中的流程。
附图说明
下面结合附图,通过对本申请的具体实施方式详细描述,将使本申请的技术方案及其有益效果显而易见。
图1是本申请实施例提供的图片处理方法的流程示意图。
图2是本申请实施例提供的图片处理方法的另一流程示意图。
图3是本申请实施例提供的孪生神经网络的架构示意图。
图4至图8是本申请实施例提供的图片处理方法的场景示意图。
图9是本申请实施例提供的图片处理装置的结构示意图。
图10是本申请实施例提供的电子设备的结构示意图。
图11是本申请实施例提供的电子设备的另一结构示意图。
具体实施方式
请参照图示,其中相同的组件符号代表相同的组件,本申请的原理是以实施在一适当的运算环境中来举例说明。以下的说明是基于所例示的本申请具体实施例,其不应被视为限制本申请未在此详述的其它具体实施例。
本申请实施例提供一种图片处理方法,应用于电子设备,所述方法包括:
获取多张图片;
对所述多张图片进行分类,得到至少一个类别;
从所述至少一个类别中确定出满足预设条件的目标类别;
对每一目标类别中包含的图片进行聚类,得到每一所述目标类别的聚类结果。
在一种实施方式中,所述对每一目标类别中包含的图片进行聚类,得到每一所述目标类别的聚类结果,包括:
对每一目标类别中包含的每两张图片进行相似度计算,得到每一目标类别中包含的每两张图片的相似度;
根据所述每一目标类别中包含的每两张图片的相似度进行聚类,得到每一目标类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于或等于预设阈值。
在一种实施方式中,所述方法还包括:
获取被选中的第一图片,所述第一图片为所述多张图片中的一张图片;
根据每一目标类别的聚类结果,确定所述第一图片的相似图片;
对所述第一图片的相似图片进行推荐。
在一种实施方式中,所述对每一目标类别中包含的每两张图片进行相似度计算,包括:
利用孪生神经网络对每一目标类别中包含的每两张图片进行相似度计算。
在一种实施方式中,所述孪生神经网络被配置于与所述电子设备对应的云端设备,所述云端设备为部署于云端的用于计算图片之间的相似度的设备;
所述利用孪生神经网络对每一目标类别中包含的每两张图片进行相似度计算,包括:
将所述目标类别所包含的图片上传至所述云端设备;
从所述云端设备处接收每一目标类别中包含的每两张图片的相似度信息,所述相似度信息为利用孪生神经网络计算得到的相似度信息。
在一种实施方式中,所述从所述至少一个类别中确定出满足预设条件的目标类别,包括:
从所述至少一个类别中确定出满足预设条件的目标类别,其中,所述满足预设条件的目标类别为包含的图片的数量大于或等于预设数值的类别。
在一种实施方式中,所述对所述多张图片进行分类,得到至少一个类别,包括:
利用轻量级图片分类算法,对所述多张图片进行分类,得到至少一个类别。
可以理解的是,本申请实施例的执行主体可以是诸如智能手机或平板电脑 等的电子设备。
请参阅图1,图1是本申请实施例提供的图片处理方法的流程示意图,流程可以包括:
101、获取多张图片。
随着电子设备的拍照能力越来越强,用户经常会使用电子设备拍摄照片,比如用户可以拍摄风景照片,也可以拍摄人物照片等等。用户拍摄的照片一般会被存储到电子设备的相册中,以便用户随时可以查阅这些照片。此外,用户从网络上下载的图片一般也会被存储到相册中。然而,相关技术中,电子设备一般只能根据拍摄时间或者拍摄地点等对相册中保存的图片进行分类。即,相关技术中,电子设备无法对图片进行有效管理。
在本申请实施例中,比如,电子设备可以先获取多张图片。例如,电子设备可以获取保存在相册中的所有图片。
102、对多张图片进行分类,得到至少一个类别。
比如,在获取到多张图片后,电子设备可以对这多张图片进行分类,从而得到至少一个类别。
例如,在获取到相册中保存的图片后,电子设备可以对相册中保存的图片进行分类,从而将相册中保存的图片分为多个类别,如风景类别的图片、植物类别的图片、动物类别的图片、车辆类别的图片,等等。
103、从至少一个类别中确定出满足预设条件的目标类别。
比如,在对多张图片进行分类从而得到至少一个类别后,电子设备可以从这至少一个类别中确定出满足预设条件的目标类别。
例如,在将相册中保存的图片划分为风景类别的图片、植物类别的图片、动物类别的图片、车辆类别的图片后,电子设备可以从风景类别、植物类别、动物类别、车辆类别这4个类别中确定出满足预设条件的类别,并将其确定为目标类别。例如,电子设备将风景类别和植物类别确定为目标类别。
104、对每一目标类别中包含的图片进行聚类,得到每一目标类别的聚类结果。
比如,在确定出目标类别后,电子设备可以对每一个目标类别中所包含的图片分别进行聚类处理,从而得到每一个目标类别下的聚类结果。
例如,在将风景类别和植物类别确定为目标类别后,电子设备可以对风景类别的图片进行聚类,从而得到风景类别下的聚类结果。电子设备还可以对植物类别的图片进行聚类,从而得到植物类别下的聚类结果。例如,属于风景类别的图片在经过聚类后,又被聚类成3个簇,这3个簇分别为山峰类别的图片、海景类别的图片以及湖景类别的图片等。而属于植物类别的图片在经过聚类后,又被聚类成2个簇,这2个簇分别为花卉类别的图片、树木类别的图片等。
可以理解的是,本申请实施例中,在获取到多张图片后,电子设备可以对该多张图片进行分类,得到至少一个类别。电子设备可以从这至少一个类别中确定出满足预设条件的目标类别,在对每一个目标类别下的图片进行聚类,从而得到每一个目标类别下的图片的聚类结果。因此,本申请实施例中,电子设备可以先对图片进行一次分类,再在分类的基础上对目标类别的图片进行一次聚类,从而实现对图片的细分。由于对图片的细分有助于图片的查找和浏览,因此本申请实施例可以实现对图片的有效管理。
请参阅图2,图2为本申请实施例提供的图片处理方法的另一流程示意图,流程可以包括:
201、电子设备获取多张图片。
比如,电子设备可以先获取其相册中的所有图片。
202、电子设备利用轻量级图片分类算法对所述多张图片进行分类,得到至少一个类别。
比如,在获取到相册中的所有图片后,电子设备可以利用轻量级图片分类算法MobileNet V2对相册中的所有图片进行分类,得到至少一个类别。
需要说明的是,MobileNet V2是一种为电子设备尤其是移动设备设计的通用计算机视觉神经网络,它可以用于实现图像分类、目标检测和语义分割等。当然,除了MobileNet V2,本申请实施例中电子设备还可以使用诸如MobileNet V1、MobileNet V3等其它轻量级图片分类算法,本实施例对此不做具体限定。
其中,在本申请实施例中,用于对图片进行分类的轻量级图片分类算法可以是预先经过学习训练的神经网络。例如,可以按照所需的类别对轻量级图片分类算法进行预先训练等。当将一张需要分类的图片输入至诸如MobileNet V2神经网络等预先经过学习训练的轻量级图片分类算法时,该轻量级图片分类算 法可以输出该图片的分类,即电子设备可以得到该图片的分类。
例如,利用预先经过学习训练的轻量级图片分类算法MobileNet V2,电子设备将相册中的所有图片分类为风景类别的图片、植物类别的图片、动物类别的图片、车辆类别的图片,等等。
在一种实施方式中,电子设备可以为每一类别的图片创建一个对应的文件夹或图片集用于存储该类别的图片。例如,电子设备可以创建一个命名为“风景”的文件夹用于存储风景类别的图片,创建一个命名为“植物”的文件夹用于存储植物类别的图片,创建一个命名为“动物”的文件夹用于存储动物类别的图片,创建一个命名为“车辆”的文件夹用于存储车辆类别的图片,等等。
203、电子设备从至少一个类别中确定出满足预设条件的目标类别,其中,该满足预设条件的目标类别为包含的图片的数量大于或等于预设数值的类别。
比如,在将相册中的所有图片分类为风景类别的图片、植物类别的图片、动物类别的图片、车辆类别的图片这4个类别后,电子设备可以从这4个类别中确定出满足预设条件的目标类别,其中,满足预设条件的目标类别可以为所包含的图片的数量大于或等于预设数值的类别。
例如,预设数值为30张。那么,电子设备可以将包含有至少30张图片的类别确定为目标类别。例如,风景类别的图片有50张,植物类别的图片有35张,动物类别的图片有20张,车辆类别的图片有5张。那么,由于风景类别的图片和植物类别的图片均大于30张,因此电子设备可以将风景类别和植物类别确定为目标类别。而由于动物类别的图片和车辆类别的图片的数量均不足30张,因此电子设备不会将动物类别和车辆类别确定为目标类别。
204、电子设备对每一目标类别中包含的每两张图片进行相似度计算,得到每一目标类别中包含的每两张图片的相似度。
205、电子设备根据每一目标类别中包含的每两张图片的相似度进行聚类,得到每一目标类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于或等于预设阈值。
比如,204和205可以包括:
在确定出目标类别后,电子设备可以对每一个目标类别中所包含的图片分别进行聚类处理,从而得到每一个目标类别下的图片的聚类结果。
在本申请实施例中,电子设备可以通过如下方式来对每一个目标类别中所包含的图片进行聚类处理:电子设备可以对每一个目标类别中所包含的每两张图片进行相似度计算,从而得到每一个目标类别中所包含的每两张图片的相似度。之后,电子设备可以根据每一目标类别中所包含的每两张图片的相似度对图片进行聚类处理,得到每一目标类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于预设阈值。
例如,电子设备可以对风景类别的图片进行聚类处理,并对植物类别的图片进行聚类处理。其中,在对风景类别的图片进行聚类处理时,电子设备可以计算风景类别中的每两张图片的相似度,再根据每两张风景类别的图片的相似度对风景类别的图片进行聚类,从而得到风景类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于或等于预设阈值。例如,风景类别中的图片被聚类成3个簇,这3个簇分别为山峰类别的图片、海景类别的图片以及湖景类别的图片等。其中,山峰这一类别中的图片两两之间的相似度均大于或等于预设阈值,海景这一类别中的图片两两之间的相似度也均大于或等于预设阈值,湖景这一类别中的图片两两之间的相似度也均大于或等于预设阈值。
又如,在对植物类别的图片进行聚类处理时,电子设备可以计算植物类别中的每两张图片的相似度,再根据每两张植物类别的图片的相似度对植物类别的图片进行聚类,从而得到植物类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于或等于预设阈值。例如,植物景类别中的图片被聚类成2个簇,这2个簇分别为花卉类别的图片以及树木类别的图片等。其中,花卉这一类别中的图片两两之间的相似度均大于或等于预设阈值,树木这一类别中的图片两两之间的相似度也均大于或等于预设阈值。
在一种实施方式中,电子设备可以为每一个目标类别下的每一个簇创建一个对应的文件夹或图片集用于存储这个簇所包含的图片。例如,对于风景类别下的图片,电子设备可以为山峰类别(山峰簇)的图片创建一个文件夹用于存储山峰类别的图片,电子设备可以为海景类别(海景簇)的图片创建一个文件夹用于存储海景类别的图片,电子设备可以湖景类别(湖景簇)的图片创建一个文件夹用于存储湖景类别的图片。对于植物类别下的图片,电子设备可以为 花卉类别(花卉簇)的图片创建一个文件夹用于存储花卉类别的图片,电子设备可以为树木类别(树木簇)的图片创建一个文件夹用于存储树木类别的图片,等等。
可以理解的是,本申请实施例中,电子设备可以先对图片进行一次粗分类,再在分类的基础上对目标类别的图片进行一次聚类,从而实现对图片的细分。由于对图片的细分有助于图片的查找和浏览,因此本申请实施例可以实现对图片的有效管理。
在一种实施方式中,电子设备在执行204中对每一目标类别中包含的每两张图片进行相似度计算的流程时,可以包括:
电子设备利用孪生神经网络对每一目标类别中包含的每两张图片进行相似度计算。
比如,电子设备可以利用孪生神经网络来计算每一目标类别中包含的每两张图片的相似度。
需要说明的是,孪生神经网络(Siamese Network)可以用于衡量两个输入的相似程度。孪生神经网络有两个输入(例如,分别为Input 1和Input 2),将这两个输入Input 1和Input 2分别输入至两个神经网络(例如,分别为Network 1和Network 2,Network 1和Network 2可以均为卷积神经网络CNN等),这两个神经网络可以分别将输入映射到新的空间,形成输入在新的空间中的表示。通过损失函数Loss的计算,可以评价两个输入的相似度。当两个图片训练所用的神经网络完全相同时,左右两个网络可以实现全部的权值共享。孪生神经网络使用Contrastive Loss作为损失函数,它能有效地处理孪生神经网络中的成对的数据的关系。孪生神经网络的架构可以如图3所示。
在一种实施方式中,上述孪生神经网络可以被配置于与电子设备对应的云端设备,该云端设备可以是部署于云端的用于计算图片之间的相似度的设备。
那么,电子设备执行上述利用孪生神经网络对每一目标类别中包含的每两张图片进行相似度计算的流程时,可以包括:
电子设备将目标类别所包含的图片上传至云端设备;
电子设备从云端设备处接收每一目标类别中包含的每两张图片的相似度信息,该相似度信息为利用孪生神经网络计算得到的相似度信息。
比如,用于计算图片相似度的孪生神经网络可以被部署在云端设备上。那么,在确定出目标类别后,电子设备可以将每一个目标类别所包含的图片分别上传至云端设备,以便由云端设备可以利用孪生神经网络来对每一个目标类别中所包含的每两张图片进行相似度计算。在计算完相似度后,云端设备可以将每一目标类别下的每两张图片彼此之间的相似度信息反馈给电子设备。
可以理解的是,由于图片相似度的计算对于设备内存等资源要求较高,因此可以将图片的相似度计算放在云端设备上进行,从而节省电子设备的计算资源。当需要计算图片彼此之间的相似度时,电子设备可以将需要计算相似度的图片上传至云端设备,由云端设备利用配置的孪生神经网络来计算图片的相似度。
在一种实施方式中,电子设备可以在预设的触发时机将每一目标类别中所包含的图片上传至云端设备,并由云端设备来计算同一目标类别中的每两张图片的相似度。其中,预设的触发时机可以是设备处于空闲状态或者是夜间的特定时间段,等等。
206、电子设备获取被选中的第一图片,该第一图片为多张图片中的一张图片。
207、根据每一目标类别的聚类结果,电子设备确定第一图片的相似图片。
208、电子设备对第一图片的相似图片进行推荐。
比如,206、207、208可以包括:
在电子设备对相册中的图片进行分类和聚类后,属于同一个簇的图片可以认为是彼此相似的图片。那么,比如,当用户选中或收藏相册中的某一张图片(即第一图片)时,电子设备可以根据相册中图片的聚类结果,确定出该第一图片的相似图片,并将该第一图片的相似图片进行推荐。例如,电子设备可以将第一图片的相似图片中相似度最高的3张或5张图片推荐给用户。例如,用户选中或收藏了某一张花卉图片,那么电子设备可以从花卉簇的图片中确定出5张与该被选中或收藏的花卉图片最相似的图片推荐给用户,以便用户也可以对这些相似图片进行浏览和收藏等。
请参阅图4至图8,图4至图8为本申请实施例提供的图片处理方法的场景示意图。
比如,电子设备的相册中存储有很多图片,电子设备可以先获取该相册中的所有图片。之后,电子设备可以利用预先经过学习训练的轻量级图片分类算法MobileNet V2对相册中的所有图片进行分类。例如,电子设备将相册中的所有图片分类为风景类别的图片、植物类别的图片、动物类别的图片以及车辆类别的图片。
在对图片进行分类之后,电子设备可以为每一类别的图片创建一个对应的文件夹用于存储该类别的图片。例如,电子设备创建了四个文件夹,分别为风景、植物、动物以及车辆。其中,“风景”的文件夹用于存储风景类别的图片,“植物”的文件夹用于存储植物类别的图片,“动物”的文件夹用于存储动物类别的图片,“车辆”的文件夹用于存储车辆类别的图片,如图4所示。
之后,电子设备可以获取各类别的图片的数量,并将图片数量达到30张的类别确定目标类别。例如,风景类别的图片有50张,植物类别的图片有35张,动物类别的图片有20张,车辆类别的图片有5张。那么,电子设备可以将风景类别和植物类别确定为目标类别。
在确定出目标类别之后,电子设备可以对风景类别的图片进行聚类处理,并对植物类别的图片进行聚类处理。其中,电子设备可以在夜间特定时间段,例如02:00~03:00这段时间,并且电子设备处于开机状态及可以连接到网络时,将风景类别的图片和植物类别的图片上传到云端设备。其中,在云端设备上配置有孪生神经网络,云端设备可以利用该孪生神经网络计算两张图片之间的相似度。例如,在从电子设备处接收到风景类别的图片和植物类别的图片后,云端设备可以利用孪生神经网络计算风景类别中的每两张图片之间的相似度。之后,云端设备可以利用孪生神经网络计算植物类别中的每两张图片之间的相似度。在计算完相似度后,云端设备可以将风景类别的图片两两之间的相似度信息以及植物类别的图片两两之间的相似度信息发送给电子设备。
电子设备在接收到云端设备发送的风景类别的图片两两之间的相似度信息以及植物类别的图片两两之间的相似度信息之后,可以根据这些相似度信息分别对风景类别的图片和植物类别的图片进行聚类处理。在对风景类别的图片进行聚类处理时,电子设备可以根据每两张风景类别的图片的相似度对风景类别的图片进行聚类,从而得到风景类别下的至少一个簇,其中,同一个簇中包 含的图片两两之间的相似度均大于或等于预设阈值。例如,风景类别中的图片被聚类成3个簇,这3个簇分别为山峰类别的图片、海景类别的图片以及湖景类别的图片等。其中,山峰这一类别中的图片两两之间的相似度均大于或等于预设阈值,海景这一类别中的图片两两之间的相似度也均大于或等于预设阈值,湖景这一类别中的图片两两之间的相似度也均大于或等于预设阈值。
又如,在对植物类别的图片进行聚类处理时,电子设备可以根据每两张植物类别的图片的相似度对植物类别的图片进行聚类,从而得到植物类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于或等于预设阈值。例如,植物景类别中的图片被聚类成2个簇,这2个簇分别为花卉类别的图片以及树木类别的图片等。其中,花卉这一类别中的图片两两之间的相似度均大于或等于预设阈值,树木这一类别中的图片两两之间的相似度也均大于或等于预设阈值。
例如,本申请实施例中,电子设备可以在风景类别对应的文件夹下创建3个子文件夹,分别为山峰、海景、湖景,其中,子文件夹“山峰”用于存储山峰类别的图片,子文件夹“海景”用于存储海景类别的图片,子文件夹“湖景”用于存储湖景类别的图片,如图5所示。
电子设备可以在植物类别对应的文件夹下创建2个子文件夹,分别为花卉、树木,其中,子文件夹“花卉”用于存储花卉类别的图片,子文件夹“树木”用于存储树木类别的图片,如图6所示。
之后一段时间,例如用户在浏览某张山峰类别的图片A时觉得这张图片拍得特别好,因此点击了“收藏”以收藏这张图片,如图7所示。在检测到用户收藏了山峰类别的图片A后,电子设备可以从子文件夹“山峰”中搜索3张与图片A的相似度最高的图片,并将这3张相似图片推荐给用户。例如,子文件夹“山峰”中的3张与图片A的相似度最高的图片分别为B、C、D。那么,电子设备可以将这3张图片B、C、D推荐给用户,如图8所示。
可以理解的是,本申请实施例可以实现对相册中的图片的细分,并且在用户收藏图片时为用户推荐最相似的几张图片。因此,本申请实施例可以提高相册管理的有效性和智能性。
请参阅图9,图9为本申请实施例提供的图片处理装置的结构示意图。图 片处理装置300可以包括:获取模块301,分类模块302,确定模块303,聚类模块304。
获取模块301,用于获取多张图片。
分类模块302,用于对所述多张图片进行分类,得到至少一个类别。
确定模块303,用于从所述至少一个类别中确定出满足预设条件的目标类别。
聚类模块304,用于对每一目标类别中包含的图片进行聚类,得到每一所述目标类别的聚类结果。
在一种实施方式中,所述聚类模块304可以用于:
对每一目标类别中包含的每两张图片进行相似度计算,得到每一目标类别中包含的每两张图片的相似度;
根据所述每一目标类别中包含的每两张图片的相似度进行聚类,得到每一目标类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于或等于预设阈值。
在一种实施方式中,所述聚类模块304还可以用于:
获取被选中的第一图片,所述第一图片为所述多张图片中的一张图片;
根据每一目标类别的聚类结果,确定所述第一图片的相似图片;
对所述第一图片的相似图片进行推荐。
在一种实施方式中,所述聚类模块304可以用于:
利用孪生神经网络对每一目标类别中包含的每两张图片进行相似度计算。
在一种实施方式中,所述孪生神经网络被配置于与所述电子设备对应的云端设备,所述云端设备为部署于云端的用于计算图片之间的相似度的设备。
那么,所述聚类模块304可以用于:
将所述目标类别所包含的图片上传至所述云端设备;
从所述云端设备处接收每一目标类别中包含的每两张图片的相似度信息,所述相似度信息为利用孪生神经网络计算得到的相似度信息。
在一种实施方式中,所述确定模块303可以用于:
从所述至少一个类别中确定出满足预设条件的目标类别,其中,所述满足预设条件的目标类别为包含的图片的数量大于或等于预设数值的类别。
在一种实施方式中,所述分类模块302可以用于:
利用轻量级图片分类算法,对所述多张图片进行分类,得到至少一个类别。
本申请实施例提供一种计算机可读的存储介质,其上存储有计算机程序,当所述计算机程序在计算机上执行时,使得所述计算机执行如本实施例提供的方法中的流程。
本申请实施例还提供一种电子设备,包括存储器,处理器,所述处理器通过调用所述存储器中存储的计算机程序,用于执行本实施例提供的图片处理方法中的流程。
例如,上述电子设备可以是诸如平板电脑或者智能手机等移动终端。请参阅图10,图10为本申请实施例提供的电子设备的结构示意图。
该电子设备400可以包括触摸显示屏401、存储器402、处理器403等部件。本领域技术人员可以理解,图10中示出的电子设备结构并不构成对电子设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
触摸显示屏401可以用于显示诸如图像、文字等信息,还可以用于接收用户的触摸操作。
存储器402可用于存储应用程序和数据。存储器402存储的应用程序中包含有可执行代码。应用程序可以组成各种功能模块。处理器403通过运行存储在存储器402的应用程序,从而执行各种功能应用以及数据处理。
处理器403是电子设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器402内的应用程序,以及调用存储在存储器402内的数据,执行电子设备的各种功能和处理数据,从而对电子设备进行整体监控。
在本实施例中,电子设备中的处理器403会按照如下的指令,将一个或一个以上的应用程序的进程对应的可执行代码加载到存储器402中,并由处理器403来运行存储在存储器402中的应用程序,从而执行:
获取多张图片;
对所述多张图片进行分类,得到至少一个类别;
从所述至少一个类别中确定出满足预设条件的目标类别;
对每一目标类别中包含的图片进行聚类,得到每一所述目标类别的聚类结果。
请参阅图11,电子设备400可以包括触摸显示屏401、存储器402、处理器403、电池404、麦克风405、扬声器406等部件。
触摸显示屏401可以用于显示诸如图像、文字等信息,还可以用于接收用户的触摸操作。
存储器402可用于存储应用程序和数据。存储器402存储的应用程序中包含有可执行代码。应用程序可以组成各种功能模块。处理器403通过运行存储在存储器402的应用程序,从而执行各种功能应用以及数据处理。
处理器403是电子设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器402内的应用程序,以及调用存储在存储器402内的数据,执行电子设备的各种功能和处理数据,从而对电子设备进行整体监控。
电池404可用于为电子设备的各个模块和部件供应电力。
麦克风405可用于拾取周围环境中的声音信号,例如接收用户发出的语音指令等。
扬声器406可以用于播放声音信号。
在本实施例中,电子设备中的处理器403会按照如下的指令,将一个或一个以上的应用程序的进程对应的可执行代码加载到存储器402中,并由处理器403来运行存储在存储器402中的应用程序,从而执行:
获取多张图片;
对所述多张图片进行分类,得到至少一个类别;
从所述至少一个类别中确定出满足预设条件的目标类别;
对每一目标类别中包含的图片进行聚类,得到每一所述目标类别的聚类结果。
在一种实施方式中,处理器403执行所述对每一目标类别中包含的图片进行聚类,得到每一所述目标类别的聚类结果时,可以执行:对每一目标类别中包含的每两张图片进行相似度计算,得到每一目标类别中包含的每两张图片的相似度;根据所述每一目标类别中包含的每两张图片的相似度进行聚类,得到 每一目标类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于或等于预设阈值。
在一种实施方式中,处理器403还可以执行:获取被选中的第一图片,所述第一图片为所述多张图片中的一张图片;根据每一目标类别的聚类结果,确定所述第一图片的相似图片;对所述第一图片的相似图片进行推荐。
在一种实施方式中,处理器403执行所述对每一目标类别中包含的每两张图片进行相似度计算时,可以执行:利用孪生神经网络对每一目标类别中包含的每两张图片进行相似度计算。
在一种实施方式中,所述孪生神经网络被配置于与所述电子设备对应的云端设备,所述云端设备为部署于云端的用于计算图片之间的相似度的设备。
那么,处理器403执行所述利用孪生神经网络对每一目标类别中包含的每两张图片进行相似度计算时,可以执行:将所述目标类别所包含的图片上传至所述云端设备;从所述云端设备处接收每一目标类别中包含的每两张图片的相似度信息,所述相似度信息为利用孪生神经网络计算得到的相似度信息。
在一种实施方式中,处理器403执行所述从所述至少一个类别中确定出满足预设条件的目标类别时,可以执行:从所述至少一个类别中确定出满足预设条件的目标类别,其中,所述满足预设条件的目标类别为包含的图片的数量大于或等于预设数值的类别。
在一种实施方式中,处理器403执行所述对所述多张图片进行分类,得到至少一个类别时,可以执行:利用轻量级图片分类算法,对所述多张图片进行分类,得到至少一个类别。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见上文针对图片处理方法的详细描述,此处不再赘述。
本申请实施例提供的所述图片处理装置与上文实施例中的图片处理方法属于同一构思,在所述图片处理装置上可以运行所述图片处理方法实施例中提供的任一方法,其具体实现过程详见所述图片处理方法实施例,此处不再赘述。
需要说明的是,对本申请实施例所述图片处理方法而言,本领域普通技术人员可以理解实现本申请实施例所述图片处理方法的全部或部分流程,是可以通过计算机程序来控制相关的硬件来完成,所述计算机程序可存储于一计算机 可读取存储介质中,如存储在存储器中,并被至少一个处理器执行,在执行过程中可包括如所述图片处理方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储器(ROM,Read Only Memory)、随机存取记忆体(RAM,Random Access Memory)等。
对本申请实施例的所述图片处理装置而言,其各功能模块可以集成在一个处理芯片中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中,所述存储介质譬如为只读存储器,磁盘或光盘等。
以上对本申请实施例所提供的一种图片处理方法、装置、存储介质以及电子设备进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。

Claims (20)

  1. 一种图片处理方法,应用于电子设备,其中,所述方法包括:
    获取多张图片;
    对所述多张图片进行分类,得到至少一个类别;
    从所述至少一个类别中确定出满足预设条件的目标类别;
    对每一目标类别中包含的图片进行聚类,得到每一所述目标类别的聚类结果。
  2. 根据权利要求1所述的图片处理方法,其中,所述对每一目标类别中包含的图片进行聚类,得到每一所述目标类别的聚类结果,包括:
    对每一目标类别中包含的每两张图片进行相似度计算,得到每一目标类别中包含的每两张图片的相似度;
    根据所述每一目标类别中包含的每两张图片的相似度进行聚类,得到每一目标类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于或等于预设阈值。
  3. 根据权利要求2所述的图片处理方法,其中,所述方法还包括:
    获取被选中的第一图片,所述第一图片为所述多张图片中的一张图片;
    根据每一目标类别的聚类结果,确定所述第一图片的相似图片;
    对所述第一图片的相似图片进行推荐。
  4. 根据权利要求2所述的图片处理方法,其中,所述对每一目标类别中包含的每两张图片进行相似度计算,包括:
    利用孪生神经网络对每一目标类别中包含的每两张图片进行相似度计算。
  5. 根据权利要求4所述的图片处理方法,其中,所述孪生神经网络被配置于与所述电子设备对应的云端设备,所述云端设备为部署于云端的用于计算图片之间的相似度的设备;
    所述利用孪生神经网络对每一目标类别中包含的每两张图片进行相似度计算,包括:
    将所述目标类别所包含的图片上传至所述云端设备;
    从所述云端设备处接收每一目标类别中包含的每两张图片的相似度信息,所述相似度信息为利用孪生神经网络计算得到的相似度信息。
  6. 根据权利要求1所述的图片处理方法,其中,所述从所述至少一个类别中确定出满足预设条件的目标类别,包括:
    从所述至少一个类别中确定出满足预设条件的目标类别,其中,所述满足预设条件的目标类别为包含的图片的数量大于或等于预设数值的类别。
  7. 根据权利要求1所述的图片处理方法,其中,所述对所述多张图片进行分类,得到至少一个类别,包括:
    利用轻量级图片分类算法,对所述多张图片进行分类,得到至少一个类别。
  8. 一种图片处理装置,应用于电子设备,其中,所述装置包括:
    获取模块,用于获取多张图片;
    分类模块,用于对所述多张图片进行分类,得到至少一个类别;
    确定模块,用于从所述至少一个类别中确定出满足预设条件的目标类别;
    聚类模块,用于对每一目标类别中包含的图片进行聚类,得到每一所述目标类别的聚类结果。
  9. 根据权利要求8所述的图片处理装置,其中,所述聚类模块,用于:
    对每一目标类别中包含的每两张图片进行相似度计算,得到每一目标类别中包含的每两张图片的相似度;
    根据所述每一目标类别中包含的每两张图片的相似度进行聚类,得到每一目标类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于或等于预设阈值。
  10. 根据权利要求9所述的图片处理装置,其中,所述聚类模块,用于:
    获取被选中的第一图片,所述第一图片为所述多张图片中的一张图片;
    根据每一目标类别的聚类结果,确定所述第一图片的相似图片;
    对所述第一图片的相似图片进行推荐。
  11. 根据权利要求9所述的图片处理装置,其中,所述聚类模块,用于:
    利用孪生神经网络对每一目标类别中包含的每两张图片进行相似度计算。
  12. 根据权利要求11所述的图片处理装置,其中,所述孪生神经网络被配置于与所述电子设备对应的云端设备,所述云端设备为部署于云端的用于计算图片之间的相似度的设备;
    所述聚类模块,用于:
    将所述目标类别所包含的图片上传至所述云端设备;
    从所述云端设备处接收每一目标类别中包含的每两张图片的相似度信息,所述相似度信息为利用孪生神经网络计算得到的相似度信息。
  13. 一种计算机可读的存储介质,其上存储有计算机程序,其中,当所述计算机程序在计算机上执行时,使得所述计算机执行如权利要求1所述的方法。
  14. 一种电子设备,包括存储器,处理器,其中,所述处理器通过调用所述存储器中存储的计算机程序,以执行:获取多张图片;
    对所述多张图片进行分类,得到至少一个类别;
    从所述至少一个类别中确定出满足预设条件的目标类别;
    对每一目标类别中包含的图片进行聚类,得到每一所述目标类别的聚类结果。
  15. 根据权利要求14所述的电子设备,其中,所述处理器用于执行:
    对每一目标类别中包含的每两张图片进行相似度计算,得到每一目标类别中包含的每两张图片的相似度;
    根据所述每一目标类别中包含的每两张图片的相似度进行聚类,得到每一目标类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于或等于预设阈值。
  16. 根据权利要求15所述的电子设备,其中,所述处理器用于执行:
    获取被选中的第一图片,所述第一图片为所述多张图片中的一张图片;
    根据每一目标类别的聚类结果,确定所述第一图片的相似图片;
    对所述第一图片的相似图片进行推荐。
  17. 根据权利要求15所述的电子设备,其中,所述处理器用于执行:
    利用孪生神经网络对每一目标类别中包含的每两张图片进行相似度计算。
  18. 根据权利要求17所述的电子设备,其中,所述孪生神经网络被配置于与所述电子设备对应的云端设备,所述云端设备为部署于云端的用于计算图片之间的相似度的设备;
    所述处理器用于执行:
    将所述目标类别所包含的图片上传至所述云端设备;
    从所述云端设备处接收每一目标类别中包含的每两张图片的相似度信息,所述相似度信息为利用孪生神经网络计算得到的相似度信息。
  19. 根据权利要求14所述的电子设备,其中,所述处理器用于执行:
    从所述至少一个类别中确定出满足预设条件的目标类别,其中,所述满足预设条件的目标类别为包含的图片的数量大于或等于预设数值的类别。
  20. 根据权利要求14所述的电子设备,其中,所述处理器用于执行:
    利用轻量级图片分类算法,对所述多张图片进行分类,得到至少一个类别。
PCT/CN2021/074955 2020-03-26 2021-02-03 图片处理方法、装置、存储介质及电子设备 WO2021190165A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010225852.6A CN111460195B (zh) 2020-03-26 2020-03-26 图片处理方法、装置、存储介质及电子设备
CN202010225852.6 2020-03-26

Publications (1)

Publication Number Publication Date
WO2021190165A1 true WO2021190165A1 (zh) 2021-09-30

Family

ID=71682475

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/074955 WO2021190165A1 (zh) 2020-03-26 2021-02-03 图片处理方法、装置、存储介质及电子设备

Country Status (2)

Country Link
CN (1) CN111460195B (zh)
WO (1) WO2021190165A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113887680A (zh) * 2021-12-08 2022-01-04 智道网联科技(北京)有限公司 训练模型数据的检验方法、电子设备及存储介质
WO2023138353A1 (zh) * 2022-01-21 2023-07-27 京东方科技集团股份有限公司 图片处理方法、电子设备和计算机可读介质

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111460195B (zh) * 2020-03-26 2023-08-01 Oppo广东移动通信有限公司 图片处理方法、装置、存储介质及电子设备
CN112199451A (zh) * 2020-09-30 2021-01-08 京东数字科技控股股份有限公司 商品识别方法、装置、计算机设备及存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170300782A1 (en) * 2016-04-18 2017-10-19 International Business Machines Corporation Methods and systems of personalized photo albums based on social media data
CN109063737A (zh) * 2018-07-03 2018-12-21 Oppo广东移动通信有限公司 图像处理方法、装置、存储介质及移动终端
CN111460195A (zh) * 2020-03-26 2020-07-28 Oppo广东移动通信有限公司 图片处理方法、装置、存储介质及电子设备

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6765667B2 (ja) * 2016-07-13 2020-10-07 国立大学法人京都大学 クラスタ評価装置、クラスタ数算出装置、クラスタ装置、クラスタ評価方法、およびプログラム
CN108388888B (zh) * 2018-03-23 2022-04-05 腾讯科技(深圳)有限公司 一种车辆识别方法、装置和存储介质
CN110222728B (zh) * 2019-05-15 2021-03-12 图灵深视(南京)科技有限公司 物品鉴别模型的训练方法、系统及物品鉴别方法、设备
CN110490237B (zh) * 2019-08-02 2022-05-17 Oppo广东移动通信有限公司 数据处理方法、装置、存储介质及电子设备
CN110472082B (zh) * 2019-08-02 2022-04-01 Oppo广东移动通信有限公司 数据处理方法、装置、存储介质及电子设备

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170300782A1 (en) * 2016-04-18 2017-10-19 International Business Machines Corporation Methods and systems of personalized photo albums based on social media data
CN109063737A (zh) * 2018-07-03 2018-12-21 Oppo广东移动通信有限公司 图像处理方法、装置、存储介质及移动终端
CN111460195A (zh) * 2020-03-26 2020-07-28 Oppo广东移动通信有限公司 图片处理方法、装置、存储介质及电子设备

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113887680A (zh) * 2021-12-08 2022-01-04 智道网联科技(北京)有限公司 训练模型数据的检验方法、电子设备及存储介质
WO2023138353A1 (zh) * 2022-01-21 2023-07-27 京东方科技集团股份有限公司 图片处理方法、电子设备和计算机可读介质

Also Published As

Publication number Publication date
CN111460195A (zh) 2020-07-28
CN111460195B (zh) 2023-08-01

Similar Documents

Publication Publication Date Title
WO2021190165A1 (zh) 图片处理方法、装置、存储介质及电子设备
US11238066B2 (en) Generating personalized clusters of multimedia content elements based on user interests
US10140515B1 (en) Image recognition and classification techniques for selecting image and audio data
US10831814B2 (en) System and method for linking multimedia data elements to web pages
US9672217B2 (en) System and methods for generation of a concept based database
KR102457665B1 (ko) 검색/생성된 디지털 미디어 파일을 기반으로 잠재적 관련성에 대한 주제 예측
WO2019127832A1 (zh) 智能搜索方法、装置、终端及服务器、存储介质
CN111209970B (zh) 视频分类方法、装置、存储介质及服务器
US20150026182A1 (en) Systems and methods for generation of searchable structures respective of multimedia data content
CN111209440A (zh) 一种视频播放方法、装置和存储介质
WO2022121485A1 (zh) 图像的多标签分类方法、装置、计算机设备及存储介质
CN111444357A (zh) 内容信息确定方法、装置、计算机设备及存储介质
WO2023168998A1 (zh) 视频片段的识别方法、装置、设备以及存储介质
US9235634B2 (en) Method and server for media classification
US20170185690A1 (en) System and method for providing content recommendations based on personalized multimedia content element clusters
WO2022073516A1 (zh) 生成图像的方法、装置、电子设备及介质
CN115171014B (zh) 视频处理方法、装置、电子设备及计算机可读存储介质
CN110765305A (zh) 媒介信息推送系统及其基于视觉特征的图文检索方法
US11003706B2 (en) System and methods for determining access permissions on personalized clusters of multimedia content elements
US10180942B2 (en) System and method for generation of concept structures based on sub-concepts
CN108780462B (zh) 用于对多媒体内容元素进行聚类的系统和方法
US20170139940A1 (en) Systems and methods for generation of searchable structures respective of multimedia data content
US20240127406A1 (en) Image quality adjustment method and apparatus, device, and medium
Yang et al. Searching for images by video
Wu et al. Social Attribute Annotation for Personal Photo Collection

Legal Events

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

Ref document number: 21774525

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21774525

Country of ref document: EP

Kind code of ref document: A1