CN111460195B - Image processing method, device, storage medium and electronic equipment - Google Patents
Image processing method, device, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN111460195B CN111460195B CN202010225852.6A CN202010225852A CN111460195B CN 111460195 B CN111460195 B CN 111460195B CN 202010225852 A CN202010225852 A CN 202010225852A CN 111460195 B CN111460195 B CN 111460195B
- Authority
- CN
- China
- Prior art keywords
- pictures
- category
- target category
- picture
- similarity
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 26
- 238000000034 method Methods 0.000 claims abstract description 20
- 238000013528 artificial neural network Methods 0.000 claims description 37
- 238000004364 calculation method Methods 0.000 claims description 14
- 238000007635 classification algorithm Methods 0.000 claims description 13
- 238000004590 computer program Methods 0.000 claims description 11
- 241001465754 Metazoa Species 0.000 description 15
- 238000010586 diagram Methods 0.000 description 9
- 230000006870 function Effects 0.000 description 6
- 238000013527 convolutional neural network Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000005236 sound signal Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/50—Information retrieval; Database structures therefor; File system structures therefor of still image data
- G06F16/55—Clustering; Classification
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Biomedical Technology (AREA)
- Evolutionary Computation (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- Databases & Information Systems (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Image Analysis (AREA)
Abstract
Description
技术领域technical field
本申请属于图片技术领域,尤其涉及一种图片处理方法、装置、存储介质及电子设备。The present application belongs to the technical field of pictures, and in particular relates to a picture processing method, device, storage medium and electronic equipment.
背景技术Background technique
随着电子设备的拍照能力越来越强,用户经常会使用电子设备拍摄照片,比如用户可以拍摄风景照片,也可以拍摄人物照片等等。用户拍摄的照片一般会被存储到电子设备的相册中,以便用户随时可以查阅这些照片。此外,用户从网络上下载的图片一般也会被存储到相册中。然而,相关技术中,电子设备无法对图片进行有效管理。As the photographing capabilities of electronic devices become stronger and stronger, users often use electronic devices to take photos. For example, users can take pictures of landscapes, people, and so on. The photos taken by the user are generally stored in the photo album of the electronic device, so that the user can consult these photos at any time. In addition, pictures downloaded by the user from the Internet are generally stored in the photo album. However, in related technologies, electronic devices cannot effectively manage pictures.
发明内容Contents of the invention
本申请实施例提供一种图片处理方法、装置、存储介质及电子设备,可以对图片进行有效管理。Embodiments of the present application provide a picture processing method, device, storage medium, and electronic equipment, which can effectively manage pictures.
第一方面,本申请实施例提供一种图片处理方法,应用于电子设备,所述方法包括:In the first aspect, the embodiment of the present application provides an image processing method, which is applied to an electronic device, and the method includes:
获取多张图片;Get multiple pictures;
对所述多张图片进行分类,得到至少一个类别;Classifying the multiple pictures to obtain at least one category;
从所述至少一个类别中确定出满足预设条件的目标类别;determining a target category satisfying a preset condition from the at least one category;
对每一目标类别中包含的图片进行聚类,得到每一所述目标类别的聚类结果。The pictures included in each target category are clustered to obtain a clustering result for each target category.
第二方面,本申请实施例提供一种图片处理装置,应用于电子设备,所述装置包括:In the second aspect, the embodiment of the present application provides an image processing device, which is applied to electronic equipment, and the device includes:
获取模块,用于获取多张图片;Acquisition module, used to obtain multiple pictures;
分类模块,用于对所述多张图片进行分类,得到至少一个类别;A classification module, configured to classify the multiple pictures to obtain at least one category;
确定模块,用于从所述至少一个类别中确定出满足预设条件的目标类别;a determining module, configured to determine a target category satisfying preset conditions from the at least one category;
聚类模块,用于对每一目标类别中包含的图片进行聚类,得到每一所述目标类别的聚类结果。The clustering module is used for clustering the pictures contained in each target category, and obtaining the clustering result of each target category.
第三方面,本申请实施例提供一种计算机可读的存储介质,其上存储有计算机程序,当所述计算机程序在计算机上执行时,使得所述计算机执行本申请实施例提供的图片处理方法中的流程。In the third aspect, the embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed on the computer, the computer executes the image processing method provided in the embodiment of the present application in the process.
第四方面,本申请实施例还提供一种电子设备,包括存储器,处理器,所述处理器通过调用所述存储器中存储的计算机程序,以执行本申请实施例提供的图片处理方法中的流程。In the fourth aspect, the embodiment of the present application further provides an electronic device, including a memory and a processor, and the processor executes the process in the image processing method provided in the embodiment of the present application by calling the computer program stored in the memory .
本申请实施例中,在获取到多张图片后,电子设备可以对该多张图片进行分类,得到至少一个类别。电子设备可以从这至少一个类别中确定出满足预设条件的目标类别,在对每一个目标类别下的图片进行聚类,从而得到每一个目标类别下的图片的聚类结果。因此,本申请实施例中,电子设备可以先对图片进行一次分类,再在分类的基础上对目标类别的图片进行一次聚类,从而实现对图片的细分。由于对图片的细分有助于图片的查找和浏览,因此本申请实施例可以实现对图片的有效管理。In the embodiment of the present application, after acquiring multiple pictures, the electronic device may classify the multiple pictures to obtain at least one category. The electronic device may determine a target category satisfying a preset condition from the at least one category, and perform clustering on pictures under each target category, so as to obtain a clustering result of pictures under each target category. Therefore, in the embodiment of the present application, the electronic device may first classify the pictures once, and then perform clustering once on the pictures of the target category based on the classification, so as to realize the subdivision of the pictures. Since the subdivision of pictures is helpful for searching and browsing pictures, this embodiment of the present application can realize effective management of pictures.
附图说明Description of drawings
下面结合附图,通过对本申请的具体实施方式详细描述,将使本申请的技术方案及其有益效果显而易见。The technical solutions and beneficial effects of the present application will be apparent through the detailed description of the specific embodiments of the present application below in conjunction with the accompanying drawings.
图1是本申请实施例提供的图片处理方法的流程示意图。FIG. 1 is a schematic flowchart of an image processing method provided by an embodiment of the present application.
图2是本申请实施例提供的图片处理方法的另一流程示意图。FIG. 2 is another schematic flowchart of the image processing method provided by the embodiment of the present application.
图3是本申请实施例提供的孪生神经网络的架构示意图。Fig. 3 is a schematic diagram of the architecture of the Siamese neural network provided by the embodiment of the present application.
图4至图8是本申请实施例提供的图片处理方法的场景示意图。FIG. 4 to FIG. 8 are schematic diagrams of scenes of the image processing method provided by the embodiment of the present application.
图9是本申请实施例提供的图片处理装置的结构示意图。FIG. 9 is a schematic structural diagram of an image processing device provided by an embodiment of the present application.
图10是本申请实施例提供的电子设备的结构示意图。FIG. 10 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
图11是本申请实施例提供的电子设备的另一结构示意图。FIG. 11 is another schematic structural diagram of an electronic device provided by an embodiment of the present application.
具体实施方式Detailed ways
请参照图示,其中相同的组件符号代表相同的组件,本申请的原理是以实施在一适当的运算环境中来举例说明。以下的说明是基于所例示的本申请具体实施例,其不应被视为限制本申请未在此详述的其它具体实施例。Referring to the drawings, where the same reference numerals represent the same components, the principle of the present application is illustrated by being implemented in a suitable computing environment. The following description is based on illustrated specific embodiments of the present application, which should not be construed as limiting other specific embodiments of the present application that are not described in detail here.
可以理解的是,本申请实施例的执行主体可以是诸如智能手机或平板电脑等的电子设备。It can be understood that, the execution subject of the embodiment of the present application may be an electronic device such as a smart phone or a tablet computer.
请参阅图1,图1是本申请实施例提供的图片处理方法的流程示意图,流程可以包括:Please refer to Fig. 1, Fig. 1 is a schematic flow diagram of the image processing method provided by the embodiment of the present application, the flow may include:
101、获取多张图片。101. Obtain multiple pictures.
随着电子设备的拍照能力越来越强,用户经常会使用电子设备拍摄照片,比如用户可以拍摄风景照片,也可以拍摄人物照片等等。用户拍摄的照片一般会被存储到电子设备的相册中,以便用户随时可以查阅这些照片。此外,用户从网络上下载的图片一般也会被存储到相册中。然而,相关技术中,电子设备一般只能根据拍摄时间或者拍摄地点等对相册中保存的图片进行分类。即,相关技术中,电子设备无法对图片进行有效管理。As the photographing capabilities of electronic devices become stronger and stronger, users often use electronic devices to take photos. For example, users can take pictures of landscapes, people, and so on. The photos taken by the user are generally stored in the photo album of the electronic device, so that the user can consult these photos at any time. In addition, pictures downloaded by the user from the Internet are generally stored in the photo album. However, in related technologies, electronic devices generally can only classify pictures stored in an album according to shooting time or shooting location. That is, in the related art, the electronic device cannot effectively manage pictures.
在本申请实施例中,比如,电子设备可以先获取多张图片。例如,电子设备可以获取保存在相册中的所有图片。In the embodiment of the present application, for example, the electronic device may acquire multiple pictures first. For example, an electronic device can obtain all pictures stored in a photo album.
102、对多张图片进行分类,得到至少一个类别。102. Classify the multiple pictures to obtain at least one category.
比如,在获取到多张图片后,电子设备可以对这多张图片进行分类,从而得到至少一个类别。For example, after acquiring multiple pictures, the electronic device may classify the multiple pictures to obtain at least one category.
例如,在获取到相册中保存的图片后,电子设备可以对相册中保存的图片进行分类,从而将相册中保存的图片分为多个类别,如风景类别的图片、植物类别的图片、动物类别的图片、车辆类别的图片,等等。For example, after obtaining the pictures saved in the photo album, the electronic device can classify the pictures saved in the photo album, so as to divide the pictures saved in the photo album into multiple categories, such as pictures of landscapes, pictures of plants, and pictures of animals. pictures of , pictures of vehicle classes, etc.
103、从至少一个类别中确定出满足预设条件的目标类别。103. Determine a target category satisfying a preset condition from at least one category.
比如,在对多张图片进行分类从而得到至少一个类别后,电子设备可以从这至少一个类别中确定出满足预设条件的目标类别。For example, after classifying a plurality of pictures to obtain at least one category, the electronic device may determine a target category satisfying a preset condition from the at least one category.
例如,在将相册中保存的图片划分为风景类别的图片、植物类别的图片、动物类别的图片、车辆类别的图片后,电子设备可以从风景类别、植物类别、动物类别、车辆类别这4个类别中确定出满足预设条件的类别,并将其确定为目标类别。例如,电子设备将风景类别和植物类别确定为目标类别。For example, after dividing the pictures saved in the photo album into pictures of the landscape category, pictures of the plant category, pictures of the animal category, and pictures of the vehicle category, the electronic device can select from the four categories of scenery category, plant category, animal category, and vehicle category. The category that satisfies the preset condition is determined from the categories, and it is determined as the target category. For example, the electronic device determines a landscape category and a plant category as target categories.
104、对每一目标类别中包含的图片进行聚类,得到每一目标类别的聚类结果。104. Cluster the pictures included in each target category to obtain a clustering result for each target category.
比如,在确定出目标类别后,电子设备可以对每一个目标类别中所包含的图片分别进行聚类处理,从而得到每一个目标类别下的聚类结果。For example, after the target category is determined, the electronic device may perform clustering processing on the pictures included in each target category, so as to obtain a clustering result under each target category.
例如,在将风景类别和植物类别确定为目标类别后,电子设备可以对风景类别的图片进行聚类,从而得到风景类别下的聚类结果。电子设备还可以对植物类别的图片进行聚类,从而得到植物类别下的聚类结果。例如,属于风景类别的图片在经过聚类后,又被聚类成3个簇,这3个簇分别为山峰类别的图片、海景类别的图片以及湖景类别的图片等。而属于植物类别的图片在经过聚类后,又被聚类成2个簇,这2个簇分别为花卉类别的图片、树木类别的图片等。For example, after the landscape category and the plant category are determined as target categories, the electronic device may cluster pictures of the landscape category to obtain a clustering result under the landscape category. The electronic device can also cluster the pictures of the plant category, so as to obtain the clustering result under the plant category. For example, after clustering, pictures belonging to the landscape category are clustered into three clusters, and these three clusters are pictures of the mountain category, pictures of the seascape category, and pictures of the lakescape category. The pictures belonging to the plant category are clustered into two clusters after being clustered, and the two clusters are pictures of the flower category, pictures of the tree category, and the like.
可以理解的是,本申请实施例中,在获取到多张图片后,电子设备可以对该多张图片进行分类,得到至少一个类别。电子设备可以从这至少一个类别中确定出满足预设条件的目标类别,在对每一个目标类别下的图片进行聚类,从而得到每一个目标类别下的图片的聚类结果。因此,本申请实施例中,电子设备可以先对图片进行一次分类,再在分类的基础上对目标类别的图片进行一次聚类,从而实现对图片的细分。由于对图片的细分有助于图片的查找和浏览,因此本申请实施例可以实现对图片的有效管理。It can be understood that, in the embodiment of the present application, after acquiring multiple pictures, the electronic device may classify the multiple pictures to obtain at least one category. The electronic device may determine a target category satisfying a preset condition from the at least one category, and perform clustering on pictures under each target category, so as to obtain a clustering result of pictures under each target category. Therefore, in the embodiment of the present application, the electronic device may first classify the pictures once, and then perform clustering once on the pictures of the target category based on the classification, so as to realize the subdivision of the pictures. Since the subdivision of pictures is helpful for searching and browsing pictures, this embodiment of the present application can realize effective management of pictures.
请参阅图2,图2为本申请实施例提供的图片处理方法的另一流程示意图,流程可以包括:Please refer to FIG. 2. FIG. 2 is another schematic flowchart of the image processing method provided by the embodiment of the present application. The process may include:
201、电子设备获取多张图片。201. The electronic device acquires multiple pictures.
比如,电子设备可以先获取其相册中的所有图片。For example, an electronic device may first obtain all pictures in its photo album.
202、电子设备利用轻量级图片分类算法对所述多张图片进行分类,得到至少一个类别。202. The electronic device classifies the multiple pictures by using a lightweight picture classification algorithm to obtain at least one category.
比如,在获取到相册中的所有图片后,电子设备可以利用轻量级图片分类算法MobileNet V2对相册中的所有图片进行分类,得到至少一个类别。For example, after obtaining all the pictures in the photo album, the electronic device can classify all the pictures in the photo album by using the lightweight picture classification algorithm MobileNet V2 to obtain at least one category.
需要说明的是,MobileNet V2是一种为电子设备尤其是移动设备设计的通用计算机视觉神经网络,它可以用于实现图像分类、目标检测和语义分割等。当然,除了MobileNetV2,本申请实施例中电子设备还可以使用诸如MobileNet V1、MobileNet V3等其它轻量级图片分类算法,本实施例对此不做具体限定。It should be noted that MobileNet V2 is a general-purpose computer vision neural network designed for electronic devices, especially mobile devices. It can be used for image classification, object detection and semantic segmentation. Of course, in addition to MobileNetV2, the electronic device in this embodiment of the application can also use other lightweight image classification algorithms such as MobileNet V1, MobileNet V3, etc., which is not specifically limited in this embodiment.
其中,在本申请实施例中,用于对图片进行分类的轻量级图片分类算法可以是预先经过学习训练的神经网络。例如,可以按照所需的类别对轻量级图片分类算法进行预先训练等。当将一张需要分类的图片输入至诸如MobileNet V2神经网络等预先经过学习训练的轻量级图片分类算法时,该轻量级图片分类算法可以输出该图片的分类,即电子设备可以得到该图片的分类。Wherein, in the embodiment of the present application, the lightweight image classification algorithm used for classifying images may be a neural network that has been learned and trained in advance. For example, the lightweight image classification algorithm can be pre-trained according to the required categories. When a picture to be classified is input to a pre-learned and trained lightweight picture classification algorithm such as the MobileNet V2 neural network, the lightweight picture classification algorithm can output the classification of the picture, that is, the electronic device can get the picture Classification.
例如,利用预先经过学习训练的轻量级图片分类算法MobileNet V2,电子设备将相册中的所有图片分类为风景类别的图片、植物类别的图片、动物类别的图片、车辆类别的图片,等等。For example, by using MobileNet V2, a lightweight image classification algorithm that has been trained in advance, the electronic device can classify all the images in the photo album into pictures of landscapes, plants, animals, vehicles, and so on.
在一种实施方式中,电子设备可以为每一类别的图片创建一个对应的文件夹或图片集用于存储该类别的图片。例如,电子设备可以创建一个命名为“风景”的文件夹用于存储风景类别的图片,创建一个命名为“植物”的文件夹用于存储植物类别的图片,创建一个命名为“动物”的文件夹用于存储动物类别的图片,创建一个命名为“车辆”的文件夹用于存储车辆类别的图片,等等。In an implementation manner, the electronic device may create a corresponding folder or picture collection for each category of pictures to store the pictures of the category. For example, the electronic device can create a folder named "landscape" for storing pictures of the landscape category, create a folder named "plants" for storing pictures of the plant category, and create a file named "animal" folder to store pictures of the animal category, create a folder named "vehicles" to store pictures of the vehicle category, and so on.
203、电子设备从至少一个类别中确定出满足预设条件的目标类别,其中,该满足预设条件的目标类别为包含的图片的数量大于或等于预设数值的类别。203. The electronic device determines a target category that satisfies a preset condition from at least one category, where the target category that meets the preset condition is a category that includes a number of pictures greater than or equal to a preset value.
比如,在将相册中的所有图片分类为风景类别的图片、植物类别的图片、动物类别的图片、车辆类别的图片这4个类别后,电子设备可以从这4个类别中确定出满足预设条件的目标类别,其中,满足预设条件的目标类别可以为所包含的图片的数量大于或等于预设数值的类别。For example, after classifying all the pictures in the photo album into four categories: pictures of landscapes, plants, animals, and vehicles, the electronic device can determine from the four categories that satisfy the preset The target category of the condition, wherein, the target category satisfying the preset condition may be a category whose number of included pictures is greater than or equal to a preset value.
例如,预设数值为30张。那么,电子设备可以将包含有至少30张图片的类别确定为目标类别。例如,风景类别的图片有50张,植物类别的图片有35张,动物类别的图片有20张,车辆类别的图片有5张。那么,由于风景类别的图片和植物类别的图片均大于30张,因此电子设备可以将风景类别和植物类别确定为目标类别。而由于动物类别的图片和车辆类别的图片的数量均不足30张,因此电子设备不会将动物类别和车辆类别确定为目标类别。For example, the default value is 30 sheets. Then, the electronic device may determine the category containing at least 30 pictures as the target category. For example, there are 50 pictures of the landscape category, 35 pictures of the plant category, 20 pictures of the animal category, and 5 pictures of the vehicle category. Then, since there are more than 30 pictures of the landscape category and pictures of the plant category, the electronic device can determine the landscape category and the plant category as target categories. However, since the number of pictures of the animal category and the pictures of the vehicle category is less than 30, the electronic device will not determine the animal category and the vehicle category as the target category.
204、电子设备对每一目标类别中包含的每两张图片进行相似度计算,得到每一目标类别中包含的每两张图片的相似度。204. The electronic device performs similarity calculation on every two pictures included in each target category, and obtains the similarity between every two pictures included in each target category.
205、电子设备根据每一目标类别中包含的每两张图片的相似度进行聚类,得到每一目标类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于或等于预设阈值。205. The electronic device clusters according to the similarity of every two pictures contained in each target category, and obtains at least one cluster under each target category, wherein the similarity between two pictures contained in the same cluster are greater than or equal to the preset threshold.
比如,204和205可以包括:For example, 204 and 205 could include:
在确定出目标类别后,电子设备可以对每一个目标类别中所包含的图片分别进行聚类处理,从而得到每一个目标类别下的图片的聚类结果。After the target category is determined, the electronic device may perform clustering processing on the pictures included in each target category, so as to obtain a clustering result of the pictures in each target category.
在本申请实施例中,电子设备可以通过如下方式来对每一个目标类别中所包含的图片进行聚类处理:电子设备可以对每一个目标类别中所包含的每两张图片进行相似度计算,从而得到每一个目标类别中所包含的每两张图片的相似度。之后,电子设备可以根据每一目标类别中所包含的每两张图片的相似度对图片进行聚类处理,得到每一目标类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于预设阈值。In the embodiment of the present application, the electronic device may cluster the pictures included in each target category in the following manner: the electronic device may perform similarity calculation on every two pictures contained in each target category, Thus, the similarity of every two pictures contained in each target category is obtained. Afterwards, the electronic device can cluster the pictures according to the similarity of every two pictures contained in each target category, and obtain at least one cluster under each target category, wherein the pictures contained in the same cluster are paired The similarity between them is greater than the preset threshold.
例如,电子设备可以对风景类别的图片进行聚类处理,并对植物类别的图片进行聚类处理。其中,在对风景类别的图片进行聚类处理时,电子设备可以计算风景类别中的每两张图片的相似度,再根据每两张风景类别的图片的相似度对风景类别的图片进行聚类,从而得到风景类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于或等于预设阈值。例如,风景类别中的图片被聚类成3个簇,这3个簇分别为山峰类别的图片、海景类别的图片以及湖景类别的图片等。其中,山峰这一类别中的图片两两之间的相似度均大于或等于预设阈值,海景这一类别中的图片两两之间的相似度也均大于或等于预设阈值,湖景这一类别中的图片两两之间的相似度也均大于或等于预设阈值。For example, the electronic device may perform clustering processing on pictures of the landscape category, and perform clustering processing on pictures of the plant category. Wherein, when clustering the pictures of the landscape category, the electronic device can calculate the similarity of every two pictures in the landscape category, and then cluster the pictures of the landscape category according to the similarity of every two pictures of the landscape category , so as to obtain at least one cluster under the landscape category, wherein the similarity between any two pictures contained in the same cluster is greater than or equal to a preset threshold. For example, pictures in the landscape category are clustered into three clusters, and the three clusters are pictures in the mountain category, pictures in the seascape category, and pictures in the lakescape category. Among them, the similarity between the pictures in the category of mountains is greater than or equal to the preset threshold, the similarity between the pictures in the category of seascapes is also greater than or equal to the preset threshold, and the similarity between the pictures in the category of lake is greater than or equal to the preset threshold. The similarities between pairs of pictures in a category are also greater than or equal to a preset threshold.
又如,在对植物类别的图片进行聚类处理时,电子设备可以计算植物类别中的每两张图片的相似度,再根据每两张植物类别的图片的相似度对植物类别的图片进行聚类,从而得到植物类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于或等于预设阈值。例如,植物景类别中的图片被聚类成2个簇,这2个簇分别为花卉类别的图片以及树木类别的图片等。其中,花卉这一类别中的图片两两之间的相似度均大于或等于预设阈值,树木这一类别中的图片两两之间的相似度也均大于或等于预设阈值。For another example, when clustering pictures of plant categories, the electronic device can calculate the similarity of every two pictures of plant categories, and then cluster the pictures of plant categories according to the similarity of every two pictures of plant categories. classes, so as to obtain at least one cluster under the plant category, wherein the similarity between any two pictures contained in the same cluster is greater than or equal to a preset threshold. For example, the pictures in the plant scene category are clustered into two clusters, and the two clusters are pictures of the flower category and pictures of the tree category respectively. Wherein, the similarity between any two pictures in the flower category is greater than or equal to a preset threshold, and the similarity between any two pictures in the tree category is also greater than or equal to a preset threshold.
在一种实施方式中,电子设备可以为每一个目标类别下的每一个簇创建一个对应的文件夹或图片集用于存储这个簇所包含的图片。例如,对于风景类别下的图片,电子设备可以为山峰类别(山峰簇)的图片创建一个文件夹用于存储山峰类别的图片,电子设备可以为海景类别(海景簇)的图片创建一个文件夹用于存储海景类别的图片,电子设备可以湖景类别(湖景簇)的图片创建一个文件夹用于存储湖景类别的图片。对于植物类别下的图片,电子设备可以为花卉类别(花卉簇)的图片创建一个文件夹用于存储花卉类别的图片,电子设备可以为树木类别(树木簇)的图片创建一个文件夹用于存储树木类别的图片,等等。In an implementation manner, the electronic device may create a corresponding folder or picture set for each cluster under each target category to store the pictures included in the cluster. For example, for pictures under the landscape category, the electronic device can create a folder for pictures of the mountain category (peak cluster) to store pictures of the mountain category, and the electronic device can create a folder for pictures of the seascape category (seascape cluster). In order to store the pictures of the seascape category, the electronic device may create a folder for storing the pictures of the lakescape category (lakescape cluster) for the pictures of the lakescape category. For pictures under the plant category, the electronic device can create a folder for storing pictures of the flower category (flower clusters), and the electronic device can create a folder for storing pictures of the tree category (tree clusters). Pictures of tree categories, etc.
可以理解的是,本申请实施例中,电子设备可以先对图片进行一次粗分类,再在分类的基础上对目标类别的图片进行一次聚类,从而实现对图片的细分。由于对图片的细分有助于图片的查找和浏览,因此本申请实施例可以实现对图片的有效管理。It can be understood that, in the embodiment of the present application, the electronic device may first perform a rough classification on the pictures, and then perform a clustering on the pictures of the target category based on the classification, so as to realize the subdivision of the pictures. Since the subdivision of pictures is helpful for searching and browsing pictures, this embodiment of the present application can realize effective management of pictures.
在一种实施方式中,电子设备在执行204中对每一目标类别中包含的每两张图片进行相似度计算的流程时,可以包括:In one embodiment, when the electronic device executes the process of calculating the similarity of every two pictures contained in each target category in 204, it may include:
电子设备利用孪生神经网络对每一目标类别中包含的每两张图片进行相似度计算。The electronic device uses a Siamese neural network to perform similarity calculation on every two pictures contained in each target category.
比如,电子设备可以利用孪生神经网络来计算每一目标类别中包含的每两张图片的相似度。For example, the electronic device can use the Siamese neural network to calculate the similarity between every two pictures contained in each target category.
需要说明的是,孪生神经网络(Siamese Network)可以用于衡量两个输入的相似程度。孪生神经网络有两个输入(例如,分别为Input 1和Input 2),将这两个输入Input 1和Input 2分别输入至两个神经网络(例如,分别为Network 1和Network 2,Network 1和Network 2可以均为卷积神经网络CNN等),这两个神经网络可以分别将输入映射到新的空间,形成输入在新的空间中的表示。通过损失函数Loss的计算,可以评价两个输入的相似度。当两个图片训练所用的神经网络完全相同时,左右两个网络可以实现全部的权值共享。孪生神经网络使用Contrastive Loss作为损失函数,它能有效地处理孪生神经网络中的成对的数据的关系。孪生神经网络的架构可以如图3所示。It should be noted that the 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 respectively), and these two inputs Input 1 and Input 2 are respectively input into two neural networks (for example, Network 1 and Network 2, Network 1 and Network 2 can be a convolutional neural network (CNN, etc.), and these two neural networks can respectively map the input to a new space to form a representation of the input in the new space. Through the calculation of the loss function Loss, the similarity between two inputs can be evaluated. When the neural networks used for two image training are exactly the same, the left and right networks can share all the weights. The twin neural network uses Contrastive Loss as a loss function, which can effectively deal with the relationship of paired data in the twin neural network. The architecture of the Siamese neural network can be shown in Figure 3.
在一种实施方式中,上述孪生神经网络可以被配置于与电子设备对应的云端设备,该云端设备可以是部署于云端的用于计算图片之间的相似度的设备。In an implementation manner, the above-mentioned Siamese neural network may be configured in 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.
那么,电子设备执行上述利用孪生神经网络对每一目标类别中包含的每两张图片进行相似度计算的流程时,可以包括:Then, when the electronic device executes the above-mentioned process of calculating the similarity of every two pictures contained 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 every two pictures contained in each target category from the cloud device, and the similarity information is the similarity information calculated by using the Siamese neural network.
比如,用于计算图片相似度的孪生神经网络可以被部署在云端设备上。那么,在确定出目标类别后,电子设备可以将每一个目标类别所包含的图片分别上传至云端设备,以便由云端设备可以利用孪生神经网络来对每一个目标类别中所包含的每两张图片进行相似度计算。在计算完相似度后,云端设备可以将每一目标类别下的每两张图片彼此之间的相似度信息反馈给电子设备。For example, Siamese neural networks used to calculate image similarity can be deployed on cloud devices. Then, after the target category is determined, 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 each two pictures under each target category to the electronic device.
可以理解的是,由于图片相似度的计算对于设备内存等资源要求较高,因此可以将图片的相似度计算放在云端设备上进行,从而节省电子设备的计算资源。当需要计算图片彼此之间的相似度时,电子设备可以将需要计算相似度的图片上传至云端设备,由云端设备利用配置的孪生神经网络来计算图片的相似度。It can be understood that since the calculation of the image similarity has high requirements on resources such as device memory, the image similarity calculation can be performed on a cloud device, thereby saving computing resources of the electronic device. When it is necessary to calculate the similarity between pictures, the electronic device can upload the picture that needs to be calculated to the cloud device, and the cloud device uses the configured twin neural network to calculate the similarity of the picture.
在一种实施方式中,电子设备可以在预设的触发时机将每一目标类别中所包含的图片上传至云端设备,并由云端设备来计算同一目标类别中的每两张图片的相似度。其中,预设的触发时机可以是设备处于空闲状态或者是夜间的特定时间段,等等。In one embodiment, the electronic device can upload the pictures contained in each target category to the cloud device at a preset triggering time, and the cloud device can calculate the similarity between every two pictures in the same target category. Wherein, the preset triggering timing may be that the device is in an idle state or a specific time period at night, and so on.
206、电子设备获取被选中的第一图片,该第一图片为多张图片中的一张图片。206. The electronic device acquires the selected first picture, where the first picture is one of the multiple pictures.
207、根据每一目标类别的聚类结果,电子设备确定第一图片的相似图片。207. According to the clustering result of each target category, the electronic device determines a similar picture to the first picture.
208、电子设备对第一图片的相似图片进行推荐。208. The electronic device recommends pictures similar to the first picture.
比如,206、207、208可以包括:For example, 206, 207, 208 may include:
在电子设备对相册中的图片进行分类和聚类后,属于同一个簇的图片可以认为是彼此相似的图片。那么,比如,当用户选中或收藏相册中的某一张图片(即第一图片)时,电子设备可以根据相册中图片的聚类结果,确定出该第一图片的相似图片,并将该第一图片的相似图片进行推荐。例如,电子设备可以将第一图片的相似图片中相似度最高的3张或5张图片推荐给用户。例如,用户选中或收藏了某一张花卉图片,那么电子设备可以从花卉簇的图片中确定出5张与该被选中或收藏的花卉图片最相似的图片推荐给用户,以便用户也可以对这些相似图片进行浏览和收藏等。After the electronic device classifies and clusters the pictures in the album, the pictures belonging to the same cluster can be considered as pictures similar to each other. Then, for example, when the user selects or collects a certain picture (ie, the first picture) in the album, the electronic device can determine similar pictures to the first picture according to the clustering results of the pictures in the album, and store the first picture Similar pictures to a picture are recommended. For example, the electronic device may recommend 3 or 5 pictures with the highest similarity among similar pictures to the first picture to the user. For example, if the user selects or favorites a certain flower picture, then the electronic device can determine 5 pictures that are most similar to the selected or favorite flower picture from the pictures of flower clusters and recommend them to the user, so that the user can also select these pictures. Browse and collect similar pictures.
请参阅图4至图8,图4至图8为本申请实施例提供的图片处理方法的场景示意图。Please refer to FIG. 4 to FIG. 8 . FIG. 4 to FIG. 8 are schematic diagrams of scenes of the image processing method provided by the embodiment of the present application.
比如,电子设备的相册中存储有很多图片,电子设备可以先获取该相册中的所有图片。之后,电子设备可以利用预先经过学习训练的轻量级图片分类算法MobileNet V2对相册中的所有图片进行分类。例如,电子设备将相册中的所有图片分类为风景类别的图片、植物类别的图片、动物类别的图片以及车辆类别的图片。For example, many pictures are stored in the photo album of the electronic device, and the electronic device may first obtain all the pictures in the photo album. Afterwards, the electronic device can classify all the pictures in the album by using MobileNet V2, a lightweight picture classification algorithm that has been trained in advance. For example, the electronic device classifies all the pictures in the photo album into pictures of the landscape category, pictures of the plant category, pictures of the animal category, and pictures of the vehicle category.
在对图片进行分类之后,电子设备可以为每一类别的图片创建一个对应的文件夹用于存储该类别的图片。例如,电子设备创建了四个文件夹,分别为风景、植物、动物以及车辆。其中,“风景”的文件夹用于存储风景类别的图片,“植物”的文件夹用于存储植物类别的图片,“动物”的文件夹用于存储动物类别的图片,“车辆”的文件夹用于存储车辆类别的图片,如图4所示。After classifying the pictures, the electronic device may create a corresponding folder for each category of pictures to store the pictures of this category. For example, Electronics creates four folders, namely Landscapes, Plants, Animals, and Vehicles. Among them, 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, and the "vehicle" folder It is used to store pictures of vehicle categories, as shown in Figure 4.
之后,电子设备可以获取各类别的图片的数量,并将图片数量达到30张的类别确定目标类别。例如,风景类别的图片有50张,植物类别的图片有35张,动物类别的图片有20张,车辆类别的图片有5张。那么,电子设备可以将风景类别和植物类别确定为目标类别。Afterwards, the electronic device may acquire the number of pictures in each category, and determine the target category for the category whose number of pictures reaches 30. For example, there are 50 pictures of the landscape category, 35 pictures of the plant category, 20 pictures of the animal category, and 5 pictures of the vehicle category. Then, the electronic device may determine the landscape category and the plant category as target categories.
在确定出目标类别之后,电子设备可以对风景类别的图片进行聚类处理,并对植物类别的图片进行聚类处理。其中,电子设备可以在夜间特定时间段,例如02:00~03:00这段时间,并且电子设备处于开机状态及可以连接到网络时,将风景类别的图片和植物类别的图片上传到云端设备。其中,在云端设备上配置有孪生神经网络,云端设备可以利用该孪生神经网络计算两张图片之间的相似度。例如,在从电子设备处接收到风景类别的图片和植物类别的图片后,云端设备可以利用孪生神经网络计算风景类别中的每两张图片之间的相似度。之后,云端设备可以利用孪生神经网络计算植物类别中的每两张图片之间的相似度。在计算完相似度后,云端设备可以将风景类别的图片两两之间的相似度信息以及植物类别的图片两两之间的相似度信息发送给电子设备。After the target category is determined, the electronic device may perform clustering processing on the pictures of the landscape category, and perform clustering processing on the pictures of the plant category. Among them, the electronic device can upload the pictures of the landscape category and the pictures of the plant category to the cloud device during a specific time period at night, such as 02:00 to 03:00, and the electronic device is turned on and can be connected to the network. . Wherein, 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 a picture of the landscape category and a picture of the plant category from the electronic device, the cloud device may use a Siamese neural network to calculate the similarity between every two pictures in the landscape category. Afterwards, the cloud device can use the Siamese neural network to calculate the similarity between every two pictures in the plant category. After the similarity is calculated, the cloud device can send the similarity information between the pictures of the landscape category and the similarity information between the pictures of the plant category to the electronic device.
电子设备在接收到云端设备发送的风景类别的图片两两之间的相似度信息以及植物类别的图片两两之间的相似度信息之后,可以根据这些相似度信息分别对风景类别的图片和植物类别的图片进行聚类处理。在对风景类别的图片进行聚类处理时,电子设备可以根据每两张风景类别的图片的相似度对风景类别的图片进行聚类,从而得到风景类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于或等于预设阈值。例如,风景类别中的图片被聚类成3个簇,这3个簇分别为山峰类别的图片、海景类别的图片以及湖景类别的图片等。其中,山峰这一类别中的图片两两之间的相似度均大于或等于预设阈值,海景这一类别中的图片两两之间的相似度也均大于或等于预设阈值,湖景这一类别中的图片两两之间的相似度也均大于或等于预设阈值。After the electronic device receives the similarity information between the pictures of the landscape category and the similarity information between the pictures of the plant category sent by the cloud device, it can respectively compare the pictures of the landscape category and the plant category according to the similarity information. Category images are clustered. When clustering the pictures of the landscape category, the electronic device can cluster the pictures of the landscape category according to the similarity of every two pictures of the landscape category, so as to obtain at least one cluster under the landscape category, wherein the same cluster The similarity between the pictures contained in is greater than or equal to the preset threshold. For example, pictures in the landscape category are clustered into three clusters, and the three clusters are pictures in the mountain category, pictures in the seascape category, and pictures in the lakescape category. Among them, the similarity between the pictures in the category of mountains is greater than or equal to the preset threshold, the similarity between the pictures in the category of seascapes is also greater than or equal to the preset threshold, and the similarity between the pictures in the category of lake is greater than or equal to the preset threshold. The similarities between pairs of pictures in a category are also greater than or equal to a preset threshold.
又如,在对植物类别的图片进行聚类处理时,电子设备可以根据每两张植物类别的图片的相似度对植物类别的图片进行聚类,从而得到植物类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于或等于预设阈值。例如,植物景类别中的图片被聚类成2个簇,这2个簇分别为花卉类别的图片以及树木类别的图片等。其中,花卉这一类别中的图片两两之间的相似度均大于或等于预设阈值,树木这一类别中的图片两两之间的相似度也均大于或等于预设阈值。As another example, when performing clustering processing on pictures of plant categories, the electronic device may cluster pictures of plant categories according to the similarity between each two pictures of plant categories, so as to obtain at least one cluster under the plant category, wherein, The similarities between any two pictures included in the same cluster are greater than or equal to a preset threshold. For example, the pictures in the plant scene category are clustered into two clusters, and the two clusters are pictures of the flower category and pictures of the tree category respectively. Wherein, the similarity between any two pictures in the flower category is greater than or equal to a preset threshold, and the similarity between any two pictures in the tree category is also greater than or equal to a preset threshold.
例如,本申请实施例中,电子设备可以在风景类别对应的文件夹下创建3个子文件夹,分别为山峰、海景、湖景,其中,子文件夹“山峰”用于存储山峰类别的图片,子文件夹“海景”用于存储海景类别的图片,子文件夹“湖景”用于存储湖景类别的图片,如图5所示。For example, in the embodiment of the present application, the electronic device can create three subfolders under the folder corresponding to the scenery category, namely mountain peak, sea view, and lake view, wherein the subfolder "mountain peak" is used to store pictures of the mountain peak category, The subfolder "seascape" is used to store pictures of the category of seascape, and the subfolder "lakeview" is used to store pictures of the category of lakescape, as shown in Figure 5.
电子设备可以在植物类别对应的文件夹下创建2个子文件夹,分别为花卉、树木,其中,子文件夹“花卉”用于存储花卉类别的图片,子文件夹“树木”用于存储树木类别的图片,如图6所示。The electronic device can create two subfolders under the folder corresponding to the plant category, namely flowers and trees, wherein the subfolder "flowers" is used to store pictures of the flower category, and the subfolder "trees" is used to store the tree category , as shown in Figure 6.
之后一段时间,例如用户在浏览某张山峰类别的图片A时觉得这张图片拍得特别好,因此点击了“收藏”以收藏这张图片,如图7所示。在检测到用户收藏了山峰类别的图片A后,电子设备可以从子文件夹“山峰”中搜索3张与图片A的相似度最高的图片,并将这3张相似图片推荐给用户。例如,子文件夹“山峰”中的3张与图片A的相似度最高的图片分别为B、C、D。那么,电子设备可以将这3张图片B、C、D推荐给用户,如图8所示。After a period of time, for example, when the user browses the picture A of a certain mountain category, he thinks that this picture is taken particularly well, so he clicks "Favorite" to save this picture, as shown in Figure 7. After detecting that the user has favorited the picture A of the mountain category, the electronic device may search for 3 pictures with the highest similarity to picture A from the subfolder "Mountain", and recommend these 3 similar pictures to the user. For example, the three most similar pictures to picture A in the subfolder "Mountain Peak" are B, C, and D respectively. Then, the electronic device may recommend the three pictures B, C, and D to the user, as shown in FIG. 8 .
可以理解的是,本申请实施例可以实现对相册中的图片的细分,并且在用户收藏图片时为用户推荐最相似的几张图片。因此,本申请实施例可以提高相册管理的有效性和智能性。It can be understood that the embodiment of the present application can implement the subdivision of pictures in the album, and recommend the most similar pictures to the user when the user collects pictures. Therefore, the embodiments of the present application can improve the effectiveness and intelligence of album management.
请参阅图9,图9为本申请实施例提供的图片处理装置的结构示意图。图片处理装置300可以包括:获取模块301,分类模块302,确定模块303,聚类模块304。Please refer to FIG. 9 . FIG. 9 is a schematic structural diagram of an image processing device provided by an embodiment of the present application. The image processing apparatus 300 may include: an acquisition module 301 , a classification module 302 , a determination module 303 , and a clustering module 304 .
获取模块301,用于获取多张图片。An acquisition module 301, configured to acquire multiple pictures.
分类模块302,用于对所述多张图片进行分类,得到至少一个类别。A classification module 302, configured to classify the multiple pictures to obtain at least one category.
确定模块303,用于从所述至少一个类别中确定出满足预设条件的目标类别。A determining module 303, configured to determine a target category satisfying a preset condition from the at least one category.
聚类模块304,用于对每一目标类别中包含的图片进行聚类,得到每一所述目标类别的聚类结果。The clustering module 304 is configured to cluster the pictures included in each target category to obtain a clustering result for each target category.
在一种实施方式中,所述聚类模块304可以用于:In one embodiment, the clustering module 304 can be used for:
对每一目标类别中包含的每两张图片进行相似度计算,得到每一目标类别中包含的每两张图片的相似度;Carry out similarity calculation for every two pictures contained in each target category, and obtain the similarity of every two pictures contained in each target category;
根据所述每一目标类别中包含的每两张图片的相似度进行聚类,得到每一目标类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于或等于预设阈值。Clustering is carried out 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 similarity between two pictures contained in the same cluster is greater than or equal to the preset threshold.
在一种实施方式中,所述聚类模块304还可以用于:In one embodiment, the clustering module 304 can also be used for:
获取被选中的第一图片,所述第一图片为所述多张图片中的一张图片;Acquiring the selected first picture, where the first picture is one of the multiple pictures;
根据每一目标类别的聚类结果,确定所述第一图片的相似图片;determining similar pictures to the first picture according to the clustering results of each target category;
对所述第一图片的相似图片进行推荐。Recommending pictures similar to the first picture.
在一种实施方式中,所述聚类模块304可以用于:In one embodiment, the clustering module 304 can be used for:
利用孪生神经网络对每一目标类别中包含的每两张图片进行相似度计算。The Siamese neural network is used to calculate the similarity of every two images contained in each target category.
在一种实施方式中,所述孪生神经网络被配置于与所述电子设备对应的云端设备,所述云端设备为部署于云端的用于计算图片之间的相似度的设备。In one embodiment, the Siamese neural network is configured in 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.
那么,所述聚类模块304可以用于:Then, the clustering module 304 can be used for:
将所述目标类别所包含的图片上传至所述云端设备;uploading the pictures contained in the target category to the cloud device;
从所述云端设备处接收每一目标类别中包含的每两张图片的相似度信息,所述相似度信息为利用孪生神经网络计算得到的相似度信息。The similarity information of every two pictures contained in each target category is received from the cloud device, and the similarity information is the similarity information calculated by using a Siamese neural network.
在一种实施方式中,所述确定模块303可以用于:In an implementation manner, the determination module 303 may be used to:
从所述至少一个类别中确定出满足预设条件的目标类别,其中,所述满足预设条件的目标类别为包含的图片的数量大于或等于预设数值的类别。A target category that meets a preset condition is determined from the at least one category, wherein the target category that meets the preset condition is a category that includes a number of pictures greater than or equal to a preset value.
在一种实施方式中,所述分类模块302可以用于:In one embodiment, the classification module 302 can be used to:
利用轻量级图片分类算法,对所述多张图片进行分类,得到至少一个类别。Using a light-weight image classification algorithm to classify the plurality of images to obtain at least one category.
本申请实施例提供一种计算机可读的存储介质,其上存储有计算机程序,当所述计算机程序在计算机上执行时,使得所述计算机执行如本实施例提供的方法中的流程。An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed on a computer, the computer is made to execute the procedures in the method provided in this embodiment.
本申请实施例还提供一种电子设备,包括存储器,处理器,所述处理器通过调用所述存储器中存储的计算机程序,用于执行本实施例提供的图片处理方法中的流程。The embodiment of the present application also provides an electronic device, including a memory and a processor, and the processor is used to execute the process in the image processing method provided in the embodiment by calling the computer program stored in the memory.
例如,上述电子设备可以是诸如平板电脑或者智能手机等移动终端。请参阅图10,图10为本申请实施例提供的电子设备的结构示意图。For example, the above-mentioned electronic device may be a mobile terminal such as a tablet computer or a smart phone. Please refer to FIG. 10 . FIG. 10 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
该电子设备400可以包括触摸显示屏401、存储器402、处理器403等部件。本领域技术人员可以理解,图10中示出的电子设备结构并不构成对电子设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。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 less components than shown in the figure, or combine some components, or arrange different components.
触摸显示屏401可以用于显示诸如图像、文字等信息,还可以用于接收用户的触摸操作。The touch display screen 401 can be used to display information such as images and texts, and can also be used to receive user touch operations.
存储器402可用于存储应用程序和数据。存储器402存储的应用程序中包含有可执行代码。应用程序可以组成各种功能模块。处理器403通过运行存储在存储器402的应用程序,从而执行各种功能应用以及数据处理。Memory 402 may be used to store applications and data. The application programs stored in the memory 402 include executable codes. Applications can be composed of various functional modules. The processor 403 executes various functional applications and data processing by running the application programs stored in the memory 402 .
处理器403是电子设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器402内的应用程序,以及调用存储在存储器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. By running or executing the application program stored in the memory 402 and calling the data stored in the memory 402, the electronic device executes Various functions and processing data, so as to monitor the electronic equipment as a whole.
在本实施例中,电子设备中的处理器403会按照如下的指令,将一个或一个以上的应用程序的进程对应的可执行代码加载到存储器402中,并由处理器403来运行存储在存储器402中的应用程序,从而执行:In this embodiment, the processor 403 in the electronic device loads 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 runs the executable code stored in the memory. 402 in the application, thus executing:
获取多张图片;Get multiple pictures;
对所述多张图片进行分类,得到至少一个类别;Classifying the multiple pictures to obtain at least one category;
从所述至少一个类别中确定出满足预设条件的目标类别;determining a target category satisfying a preset condition from the at least one category;
对每一目标类别中包含的图片进行聚类,得到每一所述目标类别的聚类结果。The pictures included in each target category are clustered to obtain a clustering result for each target category.
请参阅图11,电子设备400可以包括触摸显示屏401、存储器402、处理器403、电池404、麦克风405、扬声器406等部件。Referring to FIG. 11 , an electronic device 400 may include a touch screen 401 , a memory 402 , a processor 403 , a battery 404 , a microphone 405 , a speaker 406 and other components.
触摸显示屏401可以用于显示诸如图像、文字等信息,还可以用于接收用户的触摸操作。The touch display screen 401 can be used to display information such as images and texts, and can also be used to receive user touch operations.
存储器402可用于存储应用程序和数据。存储器402存储的应用程序中包含有可执行代码。应用程序可以组成各种功能模块。处理器403通过运行存储在存储器402的应用程序,从而执行各种功能应用以及数据处理。Memory 402 may be used to store applications and data. The application programs stored in the memory 402 include executable codes. Applications can be composed of various functional modules. The processor 403 executes various functional applications and data processing by running the application programs stored in the memory 402 .
处理器403是电子设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器402内的应用程序,以及调用存储在存储器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. By running or executing the application program stored in the memory 402 and calling the data stored in the memory 402, the electronic device executes Various functions and processing data, so as to monitor the electronic equipment as a whole.
电池404可用于为电子设备的各个模块和部件供应电力。The battery 404 can be used to supply power to various modules and components of the electronic device.
麦克风405可用于拾取周围环境中的声音信号,例如接收用户发出的语音指令等。The microphone 405 can be used to pick up sound signals in the surrounding environment, such as receiving voice commands issued by the user.
扬声器406可以用于播放声音信号。Speaker 406 may be used to play sound signals.
在本实施例中,电子设备中的处理器403会按照如下的指令,将一个或一个以上的应用程序的进程对应的可执行代码加载到存储器402中,并由处理器403来运行存储在存储器402中的应用程序,从而执行:In this embodiment, the processor 403 in the electronic device loads 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 runs the executable code stored in the memory. 402 in the application, thus executing:
获取多张图片;Get multiple pictures;
对所述多张图片进行分类,得到至少一个类别;Classifying the multiple pictures to obtain at least one category;
从所述至少一个类别中确定出满足预设条件的目标类别;determining a target category satisfying a preset condition from the at least one category;
对每一目标类别中包含的图片进行聚类,得到每一所述目标类别的聚类结果。The pictures included in each target category are clustered to obtain a clustering result for each target category.
在一种实施方式中,处理器403执行所述对每一目标类别中包含的图片进行聚类,得到每一所述目标类别的聚类结果时,可以执行:对每一目标类别中包含的每两张图片进行相似度计算,得到每一目标类别中包含的每两张图片的相似度;根据所述每一目标类别中包含的每两张图片的相似度进行聚类,得到每一目标类别下的至少一个簇,其中,同一个簇中包含的图片两两之间的相似度均大于或等于预设阈值。In one embodiment, when the processor 403 executes the clustering of pictures contained in each target category, and obtains the clustering result of each target category, it may perform: clustering the pictures contained in each target category Carry out similarity calculation for every two pictures to obtain the similarity of every two pictures contained in each target category; perform clustering according to the similarity of every two pictures contained in each target category to obtain each target At least one cluster under the category, wherein the similarities between any two pictures contained in the same cluster are greater than or equal to a preset threshold.
在一种实施方式中,处理器403还可以执行:获取被选中的第一图片,所述第一图片为所述多张图片中的一张图片;根据每一目标类别的聚类结果,确定所述第一图片的相似图片;对所述第一图片的相似图片进行推荐。In one embodiment, the processor 403 may also execute: acquiring the selected first picture, where the first picture is one of the multiple pictures; according to the clustering result of each target category, determine Similar pictures to the first picture; recommending similar pictures to the first picture.
在一种实施方式中,处理器403执行所述对每一目标类别中包含的每两张图片进行相似度计算时,可以执行:利用孪生神经网络对每一目标类别中包含的每两张图片进行相似度计算。In one embodiment, when the processor 403 executes the calculation of the similarity of every two pictures included in each target category, it may perform: using a Siamese neural network to Perform similarity calculations.
在一种实施方式中,所述孪生神经网络被配置于与所述电子设备对应的云端设备,所述云端设备为部署于云端的用于计算图片之间的相似度的设备。In one embodiment, the Siamese neural network is configured in 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.
那么,处理器403执行所述利用孪生神经网络对每一目标类别中包含的每两张图片进行相似度计算时,可以执行:将所述目标类别所包含的图片上传至所述云端设备;从所述云端设备处接收每一目标类别中包含的每两张图片的相似度信息,所述相似度信息为利用孪生神经网络计算得到的相似度信息。Then, when the processor 403 performs the similarity calculation for every two pictures contained in each target category by using the twin neural network, it may perform: upload the pictures contained in the target category to the cloud device; The cloud device receives the similarity information of every two pictures contained in each target category, and the similarity information is the similarity information calculated by using a Siamese neural network.
在一种实施方式中,处理器403执行所述从所述至少一个类别中确定出满足预设条件的目标类别时,可以执行:从所述至少一个类别中确定出满足预设条件的目标类别,其中,所述满足预设条件的目标类别为包含的图片的数量大于或等于预设数值的类别。In one embodiment, when the processor 403 executes the step of determining the target category satisfying the preset condition from the at least one category, it may perform: determining the target category satisfying the preset condition from the at least one category , wherein, the target category satisfying the preset condition is a category whose number of included pictures is greater than or equal to a preset value.
在一种实施方式中,处理器403执行所述对所述多张图片进行分类,得到至少一个类别时,可以执行:利用轻量级图片分类算法,对所述多张图片进行分类,得到至少一个类别。In one embodiment, when the processor 403 executes the classifying the multiple pictures to obtain at least one category, it may perform: classify the multiple pictures by using a lightweight picture classification algorithm to obtain at least one category. a category.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见上文针对图片处理方法的详细描述,此处不再赘述。In the above-mentioned embodiments, the descriptions of each embodiment have their own emphases. For the part that is not described in detail in a certain embodiment, refer to the detailed description of the image processing method above, and will not be repeated here.
本申请实施例提供的所述图片处理装置与上文实施例中的图片处理方法属于同一构思,在所述图片处理装置上可以运行所述图片处理方法实施例中提供的任一方法,其具体实现过程详见所述图片处理方法实施例,此处不再赘述。The image processing device provided in the embodiment of the present application belongs to the same idea as the image processing method in the above embodiment, and any method provided in the embodiment of the image processing method can be run on the image processing device, and its specific For the implementation process, refer to the embodiment of the image processing method, and details are not repeated here.
需要说明的是,对本申请实施例所述图片处理方法而言,本领域普通技术人员可以理解实现本申请实施例所述图片处理方法的全部或部分流程,是可以通过计算机程序来控制相关的硬件来完成,所述计算机程序可存储于一计算机可读取存储介质中,如存储在存储器中,并被至少一个处理器执行,在执行过程中可包括如所述图片处理方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储器(ROM,Read Only Memory)、随机存取记忆体(RAM,Random Access Memory)等。It should be noted that, for the image processing method described in the embodiment of the present application, those skilled in the art can understand that all or part of the flow of the image processing method described in the embodiment of the application can be controlled by computer programs. To complete, the computer program can be stored in a computer-readable storage medium, such as stored in a memory, and executed by at least one processor, and the execution process can include the flow of the embodiment of the image processing method . Wherein, the storage medium may be a magnetic disk, an optical disk, a read only memory (ROM, Read Only Memory), a random access memory (RAM, Random Access Memory) and the like.
对本申请实施例的所述图片处理装置而言,其各功能模块可以集成在一个处理芯片中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中,所述存储介质譬如为只读存储器,磁盘或光盘等。For the image processing device in the embodiment of the present application, its various functional modules may be integrated into one processing chip, each module may exist separately physically, or two or more modules may be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software function modules. If the integrated modules are implemented in the form of software function modules and sold or used as independent products, they can also be stored in a computer-readable storage medium, such as read-only memory, magnetic disk or optical disk, etc. .
以上对本申请实施例所提供的一种图片处理方法、装置、存储介质以及电子设备进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。A picture processing method, device, storage medium and electronic equipment provided by the embodiment of the present application have been introduced in detail above. In this paper, specific examples are used to illustrate the principle and implementation of the present application. The description of the above embodiment is only It is used to help understand the method and its core idea of this application; at the same time, for those skilled in the art, according to the idea of this application, there will be changes in the specific implementation and application scope. In summary, this specification The content should not be construed as a limitation of the application.
Claims (6)
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010225852.6A CN111460195B (en) | 2020-03-26 | 2020-03-26 | Image processing method, device, storage medium and electronic equipment |
PCT/CN2021/074955 WO2021190165A1 (en) | 2020-03-26 | 2021-02-03 | Picture processing method and apparatus, and storage medium and electronic device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010225852.6A CN111460195B (en) | 2020-03-26 | 2020-03-26 | Image processing method, device, storage medium and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111460195A CN111460195A (en) | 2020-07-28 |
CN111460195B true CN111460195B (en) | 2023-08-01 |
Family
ID=71682475
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010225852.6A Active CN111460195B (en) | 2020-03-26 | 2020-03-26 | Image processing method, device, storage medium and electronic equipment |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111460195B (en) |
WO (1) | WO2021190165A1 (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111460195B (en) * | 2020-03-26 | 2023-08-01 | Oppo广东移动通信有限公司 | Image processing method, device, storage medium and electronic equipment |
CN112199451B (en) * | 2020-09-30 | 2024-07-16 | 京东科技控股股份有限公司 | Commodity identification method, commodity identification device, computer equipment and storage medium |
CN113887680A (en) * | 2021-12-08 | 2022-01-04 | 智道网联科技(北京)有限公司 | Method for testing training model data, electronic device, and storage medium |
CN114416647A (en) * | 2022-01-21 | 2022-04-29 | 京东方科技集团股份有限公司 | Picture processing method, electronic device and computer readable medium |
CN116310939A (en) * | 2022-12-28 | 2023-06-23 | 北京爱奇艺科技有限公司 | Commodity matching method, device, equipment and storage medium |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110222728A (en) * | 2019-05-15 | 2019-09-10 | 图灵深视(南京)科技有限公司 | The training method of article discrimination model, system and article discrimination method, equipment |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10346466B2 (en) * | 2016-04-18 | 2019-07-09 | International Business Machines Corporation | Methods and systems of personalized photo albums based on social media data |
JP6765667B2 (en) * | 2016-07-13 | 2020-10-07 | 国立大学法人京都大学 | Cluster evaluation device, cluster number calculation device, cluster device, cluster evaluation method, and program |
CN108388888B (en) * | 2018-03-23 | 2022-04-05 | 腾讯科技(深圳)有限公司 | Vehicle identification method and device and storage medium |
CN109063737A (en) * | 2018-07-03 | 2018-12-21 | Oppo广东移动通信有限公司 | Image processing method, device, storage medium and mobile terminal |
CN110472082B (en) * | 2019-08-02 | 2022-04-01 | Oppo广东移动通信有限公司 | Data processing method, data processing device, storage medium and electronic equipment |
CN110490237B (en) * | 2019-08-02 | 2022-05-17 | Oppo广东移动通信有限公司 | Data processing method, device, storage medium and electronic device |
CN111460195B (en) * | 2020-03-26 | 2023-08-01 | Oppo广东移动通信有限公司 | Image processing method, device, storage medium and electronic equipment |
-
2020
- 2020-03-26 CN CN202010225852.6A patent/CN111460195B/en active Active
-
2021
- 2021-02-03 WO PCT/CN2021/074955 patent/WO2021190165A1/en active Application Filing
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110222728A (en) * | 2019-05-15 | 2019-09-10 | 图灵深视(南京)科技有限公司 | The training method of article discrimination model, system and article discrimination method, equipment |
Also Published As
Publication number | Publication date |
---|---|
CN111460195A (en) | 2020-07-28 |
WO2021190165A1 (en) | 2021-09-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111460195B (en) | Image processing method, device, storage medium and electronic equipment | |
WO2021169723A1 (en) | Image recognition method and apparatus, electronic device, and storage medium | |
US11238066B2 (en) | Generating personalized clusters of multimedia content elements based on user interests | |
CN111209970B (en) | Video classification method, device, storage medium and server | |
US10140515B1 (en) | Image recognition and classification techniques for selecting image and audio data | |
US11042586B2 (en) | Clustering search results based on image composition | |
CN111241985B (en) | A video content identification method, device, storage medium, and electronic device | |
US10437878B2 (en) | Identification of a salient portion of an image | |
WO2022121485A1 (en) | Image multi-tag classification method and apparatus, computer device, and storage medium | |
EP2402867B1 (en) | A computer-implemented method, a computer program product and a computer system for image processing | |
CN110020185A (en) | Intelligent search method, terminal and server | |
US10482146B2 (en) | Systems and methods for automatic customization of content filtering | |
CN112328823A (en) | Training method and device for multi-label classification model, electronic equipment and storage medium | |
US20170185690A1 (en) | System and method for providing content recommendations based on personalized multimedia content element clusters | |
CN112580750A (en) | Image recognition method and device, electronic equipment and storage medium | |
CN112035728B (en) | Cross-modal retrieval method and device and readable storage medium | |
CN111797862A (en) | Task processing method, device, storage medium and electronic device | |
CN112069338A (en) | Picture processing method and device, electronic equipment and storage medium | |
CN112069335A (en) | Image classification method and device, electronic equipment and storage medium | |
US11003706B2 (en) | System and methods for determining access permissions on personalized clusters of multimedia content elements | |
CN106777066B (en) | A method and device for image recognition matching media file | |
CN111339335A (en) | Image retrieval method, image retrieval device, storage medium and electronic equipment | |
CN111881352A (en) | Content pushing method and device, computer equipment and storage medium | |
CN115147754A (en) | Video frame processing method, apparatus, electronic device, storage medium and program product | |
CN108780462B (en) | System and method for clustering multimedia content elements |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |