WO2022111070A1 - Image processing method and apparatus, and electronic device and storage medium - Google Patents

Image processing method and apparatus, and electronic device and storage medium Download PDF

Info

Publication number
WO2022111070A1
WO2022111070A1 PCT/CN2021/122901 CN2021122901W WO2022111070A1 WO 2022111070 A1 WO2022111070 A1 WO 2022111070A1 CN 2021122901 W CN2021122901 W CN 2021122901W WO 2022111070 A1 WO2022111070 A1 WO 2022111070A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
feature
local
global
feature map
Prior art date
Application number
PCT/CN2021/122901
Other languages
French (fr)
Chinese (zh)
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 WO2022111070A1 publication Critical patent/WO2022111070A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/75Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
    • G06V10/751Comparing pixel values or logical combinations thereof, or feature values having positional relevance, e.g. template matching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/75Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
    • G06V10/757Matching configurations of points or features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/75Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
    • G06V10/758Involving statistics of pixels or of feature values, e.g. histogram matching

Abstract

Disclosed in embodiments of the present application are an image processing method and apparatus, and an electronic device and a storage medium. The method comprises: acquiring a first image and a second image; acquiring a first global feature and a first local feature map, wherein the first global feature is a global feature corresponding to the first image, and the first local feature map comprises a local feature corresponding to the first image; acquiring a second global feature and a second local feature map, wherein the second global feature is a global feature corresponding to the second image, and the second local feature map comprises a local feature corresponding to the second image; and determining, on the basis of the first global feature, the first local feature map, the second global feature and the second local feature map, whether the first image is similar to the second image. Thus, combining global features and local features of a first image and a second image to perform similarity detection can realize more comprehensive detection in an image similarity detection process, and the accuracy of similarity detection is improved.

Description

图像处理方法、装置、电子设备及存储介质Image processing method, device, electronic device and storage medium
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本申请要求于2020年11月26日提交的申请号为202011356038.4的中国申请的优先权,其在此出于所有目的通过引用将其全部内容并入本文。This application claims priority to Chinese Application No. 202011356038.4 filed on November 26, 2020, the entire contents of which are hereby incorporated by reference for all purposes.
技术领域technical field
本申请涉及计算机技术领域,更具体地,涉及一种图像处理方法、装置、电子设备及存储介质。The present application relates to the field of computer technology, and more particularly, to an image processing method, apparatus, electronic device, and storage medium.
背景技术Background technique
通常图像都可以有自己的一些特征,进而通过将图像的一些特征进行比对可以获取到一些相似的图像。Usually images can have some features of their own, and then some similar images can be obtained by comparing some features of the images.
发明内容SUMMARY OF THE INVENTION
鉴于上述问题,本申请提出了一种图像处理方法、装置、电子设备及存储介质,以改善上述问题。In view of the above problems, the present application proposes an image processing method, apparatus, electronic device and storage medium to improve the above problems.
第一方面,本申请提供了一种图像处理方法,所述方法包括:获取第一图像以及第二图像;获取第一全局特征以及第一局部特征图,所述第一全局特征为所述第一图像对应的全局特征,所述第一局部特征图包括所述第一图像对应的局部特征;获取第二全局特征以及第二局部特征图,所述第二全局特征为所述第二图像对应的全局特征,所述第二局部特征图包括所述第二图像对应的局部特征;基于所述第一全局特征、第一局部特征图、第二全局特征以及第二局部特征图,确定所述第一图像与第二图像是否相似。In a first aspect, the present application provides an image processing method, the method includes: acquiring a first image and a second image; acquiring a first global feature and a first local feature map, where the first global feature is the first global feature. A global feature corresponding to an image, the first local feature map includes local features corresponding to the first image; a second global feature and a second local feature map are obtained, and the second global feature corresponds to the second image. The global features of the second image, the second local feature map includes the local features corresponding to the second image; Whether the first image is similar to the second image.
第二方面,本申请提供了一种图像处理方法,所述方法包括:获取第一图像以及第一图像集合;获取第一全局特征以及第一局部特征图,所述第一全局特征为所述第一图像对应的全局特征,所述第一局部特征图包括所述第一图像对应的局部特征;获取所述第一图像集合中每个图像对应的全局特征以及局部特征图;基于所述第一全局特征以及所述第一图像集合中每个图像对应的全局特征,从所述第一图像集合中确定第二图像集合;基于所述第一局部特征图以及所述第二图像集合中每个图像的局部特征图,确定所述第二图像集合中与所述第一图像相似的图像。In a second aspect, the present application provides an image processing method, the method includes: acquiring a first image and a first image set; acquiring a first global feature and a first local feature map, where the first global feature is the The global feature corresponding to the first image, and the first local feature map includes the local feature corresponding to the first image; obtain the global feature and local feature map corresponding to each image in the first image set; a global feature and a global feature corresponding to each image in the first image set, determine a second image set from the first image set; based on the first local feature map and each image in the second image set A local feature map of each image, to determine an image in the second image set that is similar to the first image.
第三方面,本申请提供了一种图像处理装置,所述装置包括:图像获取单元,用于获取第一图像以及第二图像;特征获取单元,用于获取第一全局特征以及第一局部特征图,所述第一全局特征为所述第一图像对应的全局特征,所述第一局部特征图包括所述第一图像对应的局部特征;所述特征获取单元,还用于获取第二全局特征以及第二局部特征图,所述第二全局特征为所述第二图像对应的全局特征,所述第二局部特征图包括所述第二图像对应的局部特征;图像比对单元,用于基于所述第一全局特征、第一局部特征图、第二全局特征以及第二局部特征图,确定所述第一图像与第二图像是否相似。In a third aspect, the present application provides an image processing device, the device includes: an image acquisition unit for acquiring a first image and a second image; a feature acquisition unit for acquiring a first global feature and a first local feature The first global feature is a global feature corresponding to the first image, and the first local feature map includes local features corresponding to the first image; the feature acquiring unit is further configured to acquire a second global feature feature and a second local feature map, the second global feature is the global feature corresponding to the second image, and the second local feature map includes the local feature corresponding to the second image; the image comparison unit is used for Based on the first global feature, the first local feature map, the second global feature, and the second local feature map, it is determined whether the first image and the second image are similar.
第四方面,本申请提供了一种图像处理装置,所述装置包括:图像获取单元,用于获取第一图像以及第一图像集合;特征获取单元,用于获取第一全局特征以及第一局部特征图,所述第一 全局特征为所述第一图像对应的全局特征,所述第一局部特征图包括所述第一图像对应的局部特征;所述特征获取单元,还用于获取所述第一图像集合中每个图像对应的全局特征以及局部特征图;第一图像确定单元,用于基于所述第一全局特征以及所述第一图像集合中每个图像对应的全局特征,从所述第一图像集合中确定第二图像集合;第二图像确定单元,用于基于所述第一局部特征图以及所述第二图像集合中每个图像的局部特征图,确定所述第二图像集合中与所述第一图像相似的图像。In a fourth aspect, the present application provides an image processing device, the device comprising: an image acquisition unit for acquiring a first image and a first image set; a feature acquisition unit for acquiring a first global feature and a first local feature a feature map, where the first global feature is a global feature corresponding to the first image, and the first local feature map includes local features corresponding to the first image; the feature acquisition unit is further configured to acquire the A global feature and a local feature map corresponding to each image in the first image set; the first image determination unit is configured to, based on the first global feature and the global feature corresponding to each image in the first image set, from the determining a second image set from the first image set; a second image determining unit, configured to determine the second image based on the first local feature map and the local feature map of each image in the second image set An image in the collection that is similar to the first image.
第五方面,本申请提供了一种电子设备,包括处理器以及存储器;一个或多个程序被存储在所述存储器中并被配置为由所述处理器执行以实现上述的方法。In a fifth aspect, the present application provides an electronic device including a processor and a memory; one or more programs are stored in the memory and configured to be executed by the processor to implement the above method.
第六方面,本申请提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有程序代码,其中,在所述程序代码被启动控制器运行时执行上述的方法。In a sixth aspect, the present application provides a computer-readable storage medium, where a program code is stored in the computer-readable storage medium, wherein the above-mentioned method is executed when the program code is executed by a startup controller.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present application more clearly, the following briefly introduces the drawings that are used in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can also be obtained from these drawings without creative effort.
图1示出了本申请实施例提出的一种图像处理方法的应用场景的示意图;FIG. 1 shows a schematic diagram of an application scenario of an image processing method proposed by an embodiment of the present application;
图2示出了本申请实施例提出的一种图像处理方法的流程图;FIG. 2 shows a flowchart of an image processing method proposed by an embodiment of the present application;
图3示出了图2中S120的一种实施方式包括的流程图;Fig. 3 shows a flowchart included in an embodiment of S120 in Fig. 2;
图4示出了本申请实施例中得到全局特征的示意图;FIG. 4 shows a schematic diagram of obtaining a global feature in an embodiment of the present application;
图5示出了本申请实施例中第一初始特征图中的位置对应特征集合的示意图;5 shows a schematic diagram of a feature set corresponding to a position in a first initial feature map in an embodiment of the present application;
图6示出了本申请实施例中得到局部特征的示意图;FIG. 6 shows a schematic diagram of obtaining local features in an embodiment of the present application;
图7示出了图2中S130的一种实施方式包括的流程图;Fig. 7 shows a flowchart included in an embodiment of S130 in Fig. 2;
图8示出了本申请另一实施例提出的一种图像处理方法的流程图;FIG. 8 shows a flowchart of an image processing method proposed by another embodiment of the present application;
图9示出了本申请实施例中基于第一全局特征、第一局部特征图、第二全局特征以及第二局部特征图,确定第一图像与第二图像是否相似的流程图;9 shows a flowchart of determining whether the first image and the second image are similar based on the first global feature, the first local feature map, the second global feature, and the second local feature map in an embodiment of the present application;
图10示出了本申请实施例中位置对应的示意图;FIG. 10 shows a schematic diagram of position correspondence in the embodiment of the present application;
图11示出了本申请再一实施例提出的一种图像处理方法的流程图;FIG. 11 shows a flowchart of an image processing method proposed by still another embodiment of the present application;
图12示出了本申请一实施例提出的一种数据处理装置的结构框图;FIG. 12 shows a structural block diagram of a data processing apparatus proposed by an embodiment of the present application;
图13示出了本申请另一实施例提出的一种数据处理装置的结构框图;FIG. 13 shows a structural block diagram of a data processing apparatus proposed by another embodiment of the present application;
图14示出了本申请再一实施例提出的一种数据处理装置的结构框图;FIG. 14 shows a structural block diagram of a data processing apparatus proposed by still another embodiment of the present application;
图15示出了本申请的用于执行根据本申请实施例的图像处理方法的电子设备的结构框图;FIG. 15 shows a structural block diagram of the electronic device of the present application for executing the image processing method according to the embodiment of the present application;
图16是本申请实施例的用于保存或者携带实现根据本申请实施例的图像处理方法的程序代码的存储单元。FIG. 16 is a storage unit for storing or carrying a program code for implementing the image processing method according to the embodiment of the present application according to the embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
随着图像的增多,存在有更多的关于图像的应用。例如,可以通过将图像所包括的特征进行比对,以判断两个图像之间是否相似,或者以某个图像为基准,从一个图像集合中筛选出与作为基准的图像相似的图像。As the number of images increases, there are more applications for images. For example, it is possible to judge whether two images are similar by comparing the features included in the images, or to use a certain image as a benchmark to filter out an image that is similar to the benchmark image from a set of images.
然而发明人在研究中发现,在相关的获取相似图像的过程中,还存在不能够更为准确的获取到相似图像的问题。However, the inventor found in the research that in the related process of acquiring similar images, there is still a problem that the similar images cannot be acquired more accurately.
因此,发明人提出了本申请中可以改善上述问题的图像处理方法、装置、电子设备及存储介质,通过在获取第一图像和第二图像后,会进一步的获取第一全局特征以及第一局部特征图,以及获取第二全局特征以及第二局部特征图,进而基于所述第一全局特征、第一局部特征图、第二全局特征以及第二局部特征图,确定所述第一图像与第二图像是否相似。从而在判断第一图像和第二图像的相似性的过程中,可以同时结合第一图像以及第二图像的全局特征以及局部特征进行相似性的检测,使得在进行图像相似检测过程中能够进行更为全面的检测,提升了进行相似检测的准确性。Therefore, the inventor proposes an image processing method, device, electronic device and storage medium in the present application that can improve the above-mentioned problems. After acquiring the first image and the second image, the first global feature and the first local feature are further acquired. feature map, and obtain a second global feature and a second local feature map, and then determine the first image and the first image based on the first global feature, the first local feature map, the second global feature, and the second local feature map. Whether the two images are similar. Therefore, in the process of judging the similarity between the first image and the second image, the similarity detection can be carried out in combination with the global features and local features of the first image and the second image, so that it is possible to perform more similarity detection in the process of image similarity detection. For comprehensive detection, the accuracy of similar detection is improved.
需要说明的是,本申请实施例所提供的图像处理方法可以运行于手机、平板电脑等电子设备中,也可以运行于服务器中。其中,服务器可以是单个的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云计算、云存储、CDN(Content Delivery Network,内容分发网络)、以及人工智能平台等基础云计算服务的云服务器。其中,在本申请实施例提供的数据处理方法由多个物理服务器构成的服务器集群或者分布式系统执行的情况下,数据处理方法中的不同步骤可以分别由不同的物理服务器执行,或者可以由基于分布式系统构建的服务器基于分布式的方式执行。例如,如图1所示,其中的获取第一图像以及第二图像、以及获取第一全局特征、第一局部特征图、第二全局特征以及第二局部特征图可以单独由服务器110来执行,而后续的步骤则可以由服务器120来执行。It should be noted that, the image processing method provided by the embodiments of the present application may be executed in electronic devices such as mobile phones and tablet computers, and may also be executed in a server. Among them, the server may be a single physical server, or a server cluster or distributed system composed of multiple physical servers, or may provide cloud services, cloud computing, cloud storage, CDN (Content Delivery Network, Content Delivery Network), And cloud servers for basic cloud computing services such as artificial intelligence platforms. Wherein, in the case where the data processing method provided by the embodiment of the present application is executed by a server cluster or a distributed system composed of multiple physical servers, different steps in the data processing method may be executed by different physical servers respectively, or may be executed by Servers built by distributed systems execute in a distributed manner. For example, as shown in FIG. 1 , acquiring the first image and the second image, and acquiring the first global feature, the first local feature map, the second global feature, and the second local feature map may be performed by the server 110 alone, The subsequent steps can be performed by the server 120 .
再者,本实施例提供的图像处理方法也可以由电子设备和服务器协同完成。可选的,可以由电子设备来执行获取第一图像以及第二图像,然后电子设备将获取的第一图像以及第二图像发送给服务器,再由服务器来执行后续的获取第一全局特征、第一局部特征图、第二全局特征以及第二局部特征图,以及基于所述第一全局特征、第一局部特征图、第二全局特征以及第二局部特征图,确定所述第一图像与第二图像是否相似,而服务器在得到相似判断结果后,可以将判断结果再返回给电子设备。Furthermore, the image processing method provided in this embodiment may also be completed by the electronic device and the server in cooperation. Optionally, the acquisition of the first image and the second image can be performed by the electronic device, and then the electronic device sends the acquired first image and the second image to the server, and then the server performs the subsequent acquisition of the first global feature, the first image and the second image. a local feature map, a second global feature, and a second local feature map, and determining the first image and the first image based on the first global feature, the first local feature map, the second global feature, and the second local feature map Whether the two images are similar, and after obtaining the similarity judgment result, the server can return the judgment result to the electronic device.
下面将结合附图具体描述本申请的各实施例。The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
请参阅图2,本申请实施例提供的一种图像处理方法,所述方法包括:Referring to FIG. 2, an image processing method provided by an embodiment of the present application includes:
S110:获取第一图像以及第二图像。S110: Acquire the first image and the second image.
其中,第一图像和第二图像为进行相似性比对的图像。需要说明的是,本实施例提供的图像处理方法可以运行在多种场景下,对应的,在不同的场景下获取第一图像和第二图像的方式不同。Wherein, the first image and the second image are images for similarity comparison. It should be noted that, the image processing method provided in this embodiment may operate in various scenarios, and correspondingly, the manners of acquiring the first image and the second image are different in different scenarios.
可选的,本实施例提供的图像处理方法可以运行于网络信息搜索场景中。在这种场景中,用户可以输入一种图像,进而搜索出与该输入的图像相似的图像。对应的,可以将用户输入的图像作为第一图像,而将当前与该第一图像进行相似比对的图像作为第二图像。可选的,本实施例提供的图像处理方法可以运行于图像管理程序中,在这种场景中,可以将用户从图像管理程序中选择的图像作为第一图像,而将除了被选择的图像以外的图像作为第二图像。Optionally, the image processing method provided in this embodiment may be run in a network information search scenario. In this scenario, the user can input an image, and then search for images similar to the input image. Correspondingly, the image input by the user may be used as the first image, and the image currently being similarly compared with the first image may be used as the second image. Optionally, the image processing method provided in this embodiment may run in an image management program. In this scenario, the image selected by the user from the image management program may be used as the first image, and the images other than the selected image may be used as the first image. image as the second image.
S120:获取第一全局特征以及第一局部特征图,所述第一全局特征为所述第一图像对应的全局特征,所述第一局部特征图包括所述第一图像对应的局部特征。S120: Acquire a first global feature and a first local feature map, where the first global feature is a global feature corresponding to the first image, and the first local feature map includes local features corresponding to the first image.
其中,全局特征可以理解为从整体上表征图像内容的特征,对应的,局部特征可以理解为从图像的局部表征图像内容的特征。Among them, the global feature can be understood as the feature that characterizes the image content as a whole, and correspondingly, the local feature can be understood as the feature that characterizes the image content from the part of the image.
作为一种方式,如图3所示,所述获取第一全局特征以及第一局部特征图,包括:As one way, as shown in FIG. 3 , the obtaining of the first global feature and the first local feature map includes:
S121:将所述第一图像输入到目标神经网络,获取所述目标神经网络输出的特征图作为第一初始特征图。可选的,该目标神经网络可以为CNN(Convolutional Neural Networks)网络。其中,本实施例中的目标神经网络可以为已经在其他任务中训练好的模型,如分类模型、分割模型等。S121: Input the first image into a target neural network, and obtain a feature map output by the target neural network as a first initial feature map. Optionally, the target neural network can be a CNN (Convolutional Neural Networks) network. The target neural network in this embodiment may be a model that has been trained in other tasks, such as a classification model, a segmentation model, and the like.
S122:对于所述初始特征图进行全局平均池化处理,得到第一全局特征。S122: Perform a global average pooling process on the initial feature map to obtain a first global feature.
可选的,可以基于下列公式来进行全局平均池化处理,该公式为:Optionally, global average pooling can be performed based on the following formula, which is:
Figure PCTCN2021122901-appb-000001
Figure PCTCN2021122901-appb-000001
其中,F(i,j)表示位置(i,j)处的特征向量,w表示初始特征图的宽,h表示初始特征图的高。以尺寸为w*h*d的初始特征图F为例,其中,w表示初始特征图的宽,h表示初始特征图的高,d表示初始特征图的通道数。如图4所示,尺寸为w*h*d的初始特征图F经过全局平均池化处理可以得到尺寸为1*d的全局图像特征G作为第一全局特征。Among them, F(i,j) represents the feature vector at position (i,j), w represents the width of the initial feature map, and h represents the height of the initial feature map. Take the initial feature map F of size w*h*d as an example, where w represents the width of the initial feature map, h represents the height of the initial feature map, and d represents the number of channels of the initial feature map. As shown in Figure 4, the initial feature map F of size w*h*d can be processed by global average pooling to obtain global image feature G of size 1*d as the first global feature.
S123:获取所述初始特征图中多个位置各自对应的特征集合,每个所述位置对应的特征集合包括每个位置的特征,以及每个位置的相邻位置的特征。S123: Acquire feature sets corresponding to multiple positions in the initial feature map, where the feature sets corresponding to each position include features of each position and features of adjacent positions of each position.
作为一种方式,该多个位置可以为初始特征图中的每个位置。需要说明的是,初始特征图可以对应有通道维度,那么每个位置(i,j)的信息包含每个通道的颜色信息。示例性的,如图5所示,如图5所示的初始特征图10,其中示例性的展示为其中的位置a到位置i(初始特征图10还可以包括有位置a到位置i以外的其他位置),其中,对于位置a而言,相邻位置包括位置b、位置e以及位置d,示例性的,对于位置e而言,相邻位置包括位置a、位置b、位置c、位置f、位置i、位置h、位置g、位置d。As one approach, the plurality of locations may be each location in the initial feature map. It should be noted that the initial feature map may correspond to a channel dimension, then the information of each position (i, j) includes the color information of each channel. Exemplarily, as shown in FIG. 5 , the initial feature map 10 shown in FIG. 5 , which is exemplarily shown as position a to position i (the initial feature map 10 may also include positions other than position a to position i) other positions), wherein, for position a, adjacent positions include position b, position e and position d, for example, for position e, adjacent positions include position a, position b, position c, position f , position i, position h, position g, position d.
S124:对每个所述位置各自对应的特征集合进行平均处理,得到每个所述位置对应的局部特征。S124: Perform an average process on the feature sets corresponding to each of the positions to obtain a local feature corresponding to each of the positions.
S125:基于所述每个所述位置对应的局部特征得到所述第一局部特征图。S125: Obtain the first local feature map based on the local features corresponding to each of the positions.
如图6所示,若第一图像的尺寸为W*H*3,那么经过目标神经网络处理后,可以得到尺寸为w*h*d的初始特征图F,然后可以获取位置(i,j)的特征集合,然后对该位置(i,j)的特征集合进行局部领域求均值(即进行平均处理),可以得到尺寸为1*d的局部特征,进而将每个位置对应的尺寸为1*d的局部特征进行集合则可以得到尺寸为W*H*3的第一图像对应的第一局部特征图。As shown in Figure 6, if the size of the first image is W*H*3, after processing by the target neural network, an initial feature map F with a size of w*h*d can be obtained, and then the position (i, j ) of the feature set, and then average the local domain of the feature set at the position (i, j) (that is, average processing), you can obtain a local feature of size 1*d, and then the size corresponding to each position is 1 By collecting the local features of *d, the first local feature map corresponding to the first image of size W*H*3 can be obtained.
其中,需要说明的是,每个所述位置对应的局部特征也可以理解为每个位置的局部特征向量,可选的,可以通过下列公式来计算得到每个位置的局部特征向量,该公式为:It should be noted that the local feature corresponding to each position can also be understood as the local feature vector of each position. Optionally, the local feature vector of each position can be calculated by the following formula. The formula is: :
Figure PCTCN2021122901-appb-000002
Figure PCTCN2021122901-appb-000002
其中,F(u,v)表示位置(u,v)处的特征向量,M表征位置(u,v)对应的相邻位置的数量。Among them, F(u, v) represents the feature vector at the position (u, v), and M represents the number of adjacent positions corresponding to the position (u, v).
S130:获取第二全局特征以及第二局部特征图,所述第二全局特征为所述第二图像对应的全局特征,所述第二局部特征图包括所述第二图像对应的局部特征。S130: Acquire a second global feature and a second local feature map, where the second global feature is a global feature corresponding to the second image, and the second local feature map includes local features corresponding to the second image.
作为一种方式,如图7所示,所述获取第二全局特征以及第二局部特征图,包括:As one way, as shown in FIG. 7 , the obtaining of the second global feature and the second local feature map includes:
S131:将所述第二图像输入到目标神经网络,获取所述目标神经网络输出的特征图作为第二初始特征图。S131: Input the second image into a target neural network, and obtain a feature map output by the target neural network as a second initial feature map.
S132:对于所述第二初始特征图进行全局平均池化处理,得到第二全局特征。S132: Perform a global average pooling process on the second initial feature map to obtain a second global feature.
S133:获取所述第二初始特征图中多个位置各自对应的特征集合,每个所述位置对应的特征集合包括每个位置的特征,以及每个位置的相邻位置的特征。S133: Acquire feature sets corresponding to multiple positions in the second initial feature map, where the feature sets corresponding to each position include features of each position and features of adjacent positions of each position.
S134:对每个所述位置各自对应的特征集合进行平均处理,得到每个所述位置对应的局部特征。S134: Perform averaging processing on the feature sets corresponding to each of the positions to obtain local features corresponding to each of the positions.
S135:基于所述每个所述位置对应的局部特征得到所述第二局部特征图。S135: Obtain the second local feature map based on the local features corresponding to each of the positions.
需要说明的是,从第二图像输入到目标神经网络到得到第二全局特征以及第二局部特征图的原理与前述的得到第一全局特征以及第一局部特征图的原理相同,本实施例就不再赘述。It should be noted that the principle of obtaining the second global feature and the second local feature map from the input of the second image to the target neural network is the same as the above-mentioned principle of obtaining the first global feature and the first local feature map. No longer.
S140:基于所述第一全局特征、第一局部特征图、第二全局特征以及第二局部特征图,确定所述第一图像与第二图像是否相似。S140: Determine whether the first image and the second image are similar based on the first global feature, the first local feature map, the second global feature, and the second local feature map.
在本实施例中,可以通过基于第一全局特征、第一局部特征图、第二全局特征以及第二局部特征图来确定第一图像和第二图像是否相似。可选的,可以将第一全局特征和第二全局特征进行比对,而将第一局部特征图和第二局部特征图进行比对,进而在第一全局特征和第二全局特征之间满足一定条件,且第一局部特征图和第二局部特征图也满足一定条件的情况下,确定第一图像与第二图像相似,进而可以在图像相似比对的过程中,可以更为全面的进行特征比对,以便提升准确性。In this embodiment, it may be determined whether the first image and the second image are similar based on the first global feature, the first local feature map, the second global feature, and the second local feature map. Optionally, the first global feature and the second global feature can be compared, and the first local feature map and the second local feature map can be compared, and then the first global feature and the second global feature are satisfied. When certain conditions are met, and the first local feature map and the second local feature map also meet certain conditions, it is determined that the first image is similar to the second image, so that in the process of image similarity comparison, a more comprehensive Feature alignment to improve accuracy.
本实施例提供的一种图像处理方法,在获取第一图像和第二图像后,会进一步的获取第一全局特征以及第一局部特征图,以及获取第二全局特征以及第二局部特征图,进而基于所述第一全局特征、第一局部特征图、第二全局特征以及第二局部特征图,确定所述第一图像与第二图像是否相似。从而在判断第一图像和第二图像的相似性的过程中,可以同时结合第一图像以及第二图像的全局特征以及局部特征进行相似性的检测,使得在进行图像相似检测过程中能够进行更为全面的检测,提升了进行相似检测的准确性。In the image processing method provided in this embodiment, after acquiring the first image and the second image, the first global feature and the first local feature map are further acquired, and the second global feature and the second local feature map are acquired, Further, it is determined whether the first image and the second image are similar based on the first global feature, the first local feature map, the second global feature and the second local feature map. Therefore, in the process of judging the similarity between the first image and the second image, the similarity detection can be carried out in combination with the global features and local features of the first image and the second image, so that it is possible to perform more similarity detection in the process of image similarity detection. For comprehensive detection, the accuracy of similar detection is improved.
请参阅图8,本申请实施例提供的一种图像处理方法,所述方法包括:Referring to FIG. 8, an image processing method provided by an embodiment of the present application includes:
S210:获取第一图像以及第二图像。S210: Acquire the first image and the second image.
S220:获取第一全局特征以及第一局部特征图,所述第一全局特征为所述第一图像对应的全局特征,所述第一局部特征图包括所述第一图像对应的局部特征。S220: Obtain a first global feature and a first local feature map, where the first global feature is a global feature corresponding to the first image, and the first local feature map includes local features corresponding to the first image.
S230:获取第二全局特征以及第二局部特征图,所述第二全局特征为所述第二图像对应的全局特征,所述第二局部特征图包括所述第二图像对应的局部特征。S230: Obtain a second global feature and a second local feature map, where the second global feature is a global feature corresponding to the second image, and the second local feature map includes local features corresponding to the second image.
S240:若第一全局特征与所述第二全局特征满足第一相似条件,且所述第一局部特征图与所述第二局部特征图满足第二相似条件,确定所述第一图像与第二图像相似。S240: If the first global feature and the second global feature satisfy a first similarity condition, and the first local feature map and the second local feature map satisfy a second similarity condition, determine that the first image and the second The two images are similar.
其中,作为一种方式,在获取到第一全局特征、第一局部特征图、第二全局特征以及第二局部特征图以后,可以基于下图所示的流程来确定第一图像和第二图像是否相似,如图9所示,该流程包括:In one way, after the first global feature, the first local feature map, the second global feature, and the second local feature map are acquired, the first image and the second image can be determined based on the process shown in the following figure Is it similar, as shown in Figure 9, the process includes:
S250:检测所述第一全局特征与所述第二全局特征是否满足第一相似条件。S250: Detect whether the first global feature and the second global feature satisfy a first similarity condition.
S251:若第一全局特征与所述第二全局特征不满足所述第一相似条件,确定所述第一图像与第二图像不相似。S251: If the first global feature and the second global feature do not satisfy the first similarity condition, determine that the first image and the second image are not similar.
需要说明的是,在本实施例中全局特征可以理解为一个表征图像的整体特征的向量。在本实施例中局部特征图中会包括有图像的多个区域各自的局部特征,也就是说,在局部特征图中会包括有多个局部特征。那么对应的第一全局特征则可以理解为表征第一图像的整体特征的向量,而第一局部特征图则会包括有多个表征第一图像中多个位置各自对应的局部特征。对应的,第二全局特征则可以理解为表征第二图像的整体特征的向量,而第二局部特征图则会包括有多个表征第二图像中多个位置各自对应的局部特征。It should be noted that, in this embodiment, the global feature can be understood as a vector representing the overall feature of the image. In this embodiment, the local feature map will include respective local features of multiple regions of the image, that is, the local feature map will include multiple local features. Then the corresponding first global feature can be understood as a vector representing the overall feature of the first image, and the first local feature map includes a plurality of local features representing respective corresponding positions of multiple positions in the first image. Correspondingly, the second global feature can be understood as a vector representing the overall feature of the second image, and the second local feature map includes a plurality of local features representing respective corresponding positions of multiple positions in the second image.
那么在基于全局特征进行相似比对的过程中,则可以理解为是比对两个向量之间的距离,在基于局部特征图进行相似比对的过程中,则会是基于多个特征向量进行比对,那么可以确定的是因为所需比对的特征的数量更多,基于局部特征进行相似性比对相比于基于全局特征进行相似比对则会更为消耗时间以及计算资源。那么为了避免资源的浪费,则可以在对比第一图像和第二图 像的相似性的过程中,可以先基于第一全局特征与所述第二全局特征进行比对,即先确定第一全局特征与所述第二全局特征是否满足第一相似条件。Then, in the process of similarity comparison based on global features, it can be understood as comparing the distance between two vectors. In the process of similarity comparison based on local feature maps, it will be based on multiple feature vectors. For comparison, it can be determined that because there are more features to be compared, similarity comparison based on local features consumes more time and computing resources than similarity comparison based on global features. Then, in order to avoid waste of resources, in the process of comparing the similarity between the first image and the second image, the first global feature can be compared with the second global feature, that is, the first global feature can be determined first. and whether the second global feature satisfies the first similarity condition.
若确定第一全局特征与所述第二全局特征满足所述第一相似条件,那么则初步确定第一图像和第二图像是很有可能相似的,进而为了进一步的确认是否真的相似,则可以基于第一局部特征图和第二局部特征图进行比对。对应的,若确定第一全局特征与所述第二全局特征不满足所述第一相似条件,则可以直接确定第一图像与第二图像不相似。If it is determined that the first global feature and the second global feature satisfy the first similarity condition, it is preliminarily determined that the first image and the second image are likely to be similar, and further to confirm whether they are really similar, then The alignment may be performed based on the first local feature map and the second local feature map. Correspondingly, if it is determined that the first global feature and the second global feature do not satisfy the first similarity condition, it may be directly determined that the first image and the second image are not similar.
S252:若第一全局特征与所述第二全局特征满足第一相似条件,检测所述第一局部特征图与所述第二局部特征图是否满足第二相似条件;S252: If the first global feature and the second global feature satisfy the first similarity condition, detect whether the first local feature map and the second local feature map satisfy the second similarity condition;
S253:若所述第一局部特征图与所述第二局部特征图满足第二相似条件,确定所述第一图像与第二图像相似。S253: If the first local feature map and the second local feature map satisfy a second similarity condition, determine that the first image is similar to the second image.
S254:若第一局部特征图与所述第二局部特征图不满足第二相似条件,确定所述第一图像与第二图像不相似。S254: If the first local feature map and the second local feature map do not satisfy the second similarity condition, determine that the first image and the second image are not similar.
其中,可选的,若第一全局特征与所述第二全局特征之间的距离小于第一距离阈值,确定所述第一全局特征与所述第二全局特征满足第一相似条件。其中,作为一种方式,可以基于欧氏距离或者余弦距离来计算第一全局特征与所述第二全局特征之间的距离。在本实施例中,可以基于下列公式来计算第一全局特征与第二全局特征之间的距离,该公式为:Wherein, optionally, if the distance between the first global feature and the second global feature is less than a first distance threshold, it is determined that the first global feature and the second global feature satisfy a first similarity condition. Wherein, as an approach, the distance between the first global feature and the second global feature may be calculated based on the Euclidean distance or the cosine distance. In this embodiment, the distance between the first global feature and the second global feature can be calculated based on the following formula, where the formula is:
D G=||G 1-G 2|| 2 D G =||G 1 -G 2 || 2
其中,D G表征所计算出的第一全局特征与第二全局特征之间的距离,G 1表征第一全局特征,G 2表征第二全局特征。 Wherein, D G represents the calculated distance between the first global feature and the second global feature, G 1 represents the first global feature, and G 2 represents the second global feature.
可选的,计算第一局部特征图与第二局部特征图是否满足第二相似条件可以包括:Optionally, calculating whether the first local feature map and the second local feature map satisfy the second similarity condition may include:
计算相互对应的第一局部特征以及第二局部特征之间的特征距离,所述第一局部特征为所述第一局部特征图包括的局部特征,所述第二局部特征为所述第二局部特征图包括的局部特征。Calculate the feature distance between the corresponding first local feature and the second local feature, the first local feature is the local feature included in the first local feature map, and the second local feature is the second local feature The local features included in the feature map.
需要说明的是,第一局部特征图是由前述第一初始特征图中的多个位置各自对应的局部特征组合得到的。对应的,第二局部特征图是由前述第二初始特征图中的多个位置各自对应的局部特征组合得到的。可选的,可以基于坐标来标识第一初始特征图以及第二初始特征图中的位置,进而可以将对应坐标相同的位置作为相互对应的位置。示例的,第一局部特征图的位置(i 1,j 1),和第二局部特征图的位置(i 1,j 1)的坐标均为(i 1,j 1),那么则第一局部特征图中的位置(i 1,j 1)和第二局部特征图中的位置(i 1,j 1)为位置相互对应的两个位置。对应的,相互对应的两个位置各自所对应的局部特征,则为对应的局部特征。那么相互对应的第一局部特征以及第二局部特征,可以理解为该第一局部特征对应的位置,和该第二局部特征对应的位置是相互对应。 It should be noted that the first local feature map is obtained by combining local features corresponding to multiple positions in the aforementioned first initial feature map. Correspondingly, the second local feature map is obtained by combining local features corresponding to multiple positions in the aforementioned second initial feature map. Optionally, the positions in the first initial feature map and the second initial feature map may be identified based on coordinates, and then positions with the same corresponding coordinates may be used as mutually corresponding positions. For example, the coordinates of the position (i 1 , j 1 ) of the first local feature map and the position (i 1 , j 1 ) of the second local feature map are both (i 1 , j 1 ), then the first local The position (i 1 , j 1 ) in the feature map and the position (i 1 , j 1 ) in the second local feature map are two positions whose positions correspond to each other. Correspondingly, the local features corresponding to the two positions corresponding to each other are the corresponding local features. Then, the first local feature and the second local feature corresponding to each other can be understood as the position corresponding to the first local feature, and the position corresponding to the second local feature is corresponding to each other.
如图10所示,示出了第一初始特征图20以及第二初始特征图30,其中,第一初始特征图20的位置21的坐标为(1,1),第二初始特征图30的位置31对应的坐标也为(1,1),因为位置21在第一初始特征图20中的坐标和位置31在第二初始特征图30中的坐标是相同的,那么位置21和位置征31为对应的位置,进而位置21所对应的第一局部特征,与位置31所对应的第一局部特征为对应的第一局部特征以及第二局部特征。As shown in FIG. 10 , the first initial feature map 20 and the second initial feature map 30 are shown, wherein the coordinates of the position 21 of the first initial feature map 20 are (1, 1), and the coordinates of the second initial feature map 30 are The coordinates corresponding to the position 31 are also (1, 1), because the coordinates of the position 21 in the first initial feature map 20 and the coordinates of the position 31 in the second initial feature map 30 are the same, then the position 21 and the position feature 31 is the corresponding position, and the first local feature corresponding to the position 21 and the first local feature corresponding to the position 31 are the corresponding first local feature and the second local feature.
那么作为一种方式,在第一图像和第二图像的尺寸相同的情况下,第一初始特征图和第二初始特征图的尺寸也是相同的。那么对于第一初始特征图中的每个位置都会在第二初始特征图中有对应的位置。Then, as a way, in the case where the sizes of the first image and the second image are the same, the sizes of the first initial feature map and the second initial feature map are also the same. Then, for each position in the first initial feature map, there will be a corresponding position in the second initial feature map.
作为一种方式,可以基于下列公式来计算相互对应的第一局部特征以及第二局部特征之间的特征距离,该公式为:As a way, the feature distance between the first local feature and the second local feature corresponding to each other can be calculated based on the following formula, which is:
D L(i,j)=||L 1(i,j)-L 2(i,j)|| 2 D L (i, j)=||L 1 (i, j)-L 2 (i, j)|| 2
其中,L 1(i,j)表征第一初始特征图中位置(i,j)处对应的局部特征。L 2(i,j)表征第二初始特征图中位置(i,j)处对应的局部特征。 Wherein, L 1 (i, j) represents the local feature corresponding to the position (i, j) in the first initial feature map. L 2 (i, j) represents the local feature corresponding to the position (i, j) in the second initial feature map.
将对应的所述特征距离小于第二距离阈值的第一局部特征作为目标局部特征。The first local feature whose corresponding feature distance is smaller than the second distance threshold is used as the target local feature.
如前述内容所示,在第一初始特征图中的每个位置在第二初始特征图中有对应的位置的情况下,可以计算得到第一初始特征图中的每个位置对应的第一局部特征所对应的特征距离。其中,第一局部特征所对应的特征距离可以理解为第一局部特征与位置对应的第二局部特征之间的特征距离。As shown in the foregoing, in the case where each position in the first initial feature map has a corresponding position in the second initial feature map, the first partial corresponding to each position in the first initial feature map can be obtained by calculation The feature distance corresponding to the feature. The feature distance corresponding to the first local feature may be understood as the feature distance between the first local feature and the second local feature corresponding to the position.
若所述目标局部特征的数量与所述第一局部特征图包括的局部特征的数量的比值大于比例阈值,确定所述第一局部特征图与所述第二局部特征图满足第二相似条件。If the ratio of the number of target local features to the number of local features included in the first local feature map is greater than a scale threshold, it is determined that the first local feature map and the second local feature map satisfy a second similarity condition.
其中,可以基于下列公式来计算该比值,该公式为:where the ratio can be calculated based on the following formula, which is:
Figure PCTCN2021122901-appb-000003
Figure PCTCN2021122901-appb-000003
其中,N L表征目标局部特征的数量,w表征第一初始特征图的宽度,h为第一初始特征图的高度。可选的,该R可以为0.6。 Among them, NL represents the number of target local features, w represents the width of the first initial feature map, and h is the height of the first initial feature map. Optionally, the R can be 0.6.
需要说明的是,第一初始特征图的宽度与第一初始特征图的高度的乘积则表征的是第一初始特征图中位置的数量,在每个位置都对应有一个局部特征的情况下,第一局部特征图包括的局部特征的数量则为第一初始特征图中位置的数量。It should be noted that the product of the width of the first initial feature map and the height of the first initial feature map represents the number of positions in the first initial feature map. In the case that each position corresponds to a local feature, The number of local features included in the first local feature map is the number of locations in the first initial feature map.
需要说明的是,作为一种方式,所述获取第一全局特征以及第一局部特征图之前还包括:若第一图像和第二图像的尺寸不同,将所述第一图像以及第二图像的尺寸更新为相同。It should be noted that, as a method, before acquiring the first global feature and the first local feature map, the method further includes: if the sizes of the first image and the second image are different, comparing the size of the first image and the second image. The dimensions are updated to be the same.
本申请提供的一种图像处理方法,在获取第一图像和第二图像后,会进一步的获取第一全局特征以及第一局部特征图,以及获取第二全局特征以及第二局部特征图,进而基于所述第一全局特征、第一局部特征图、第二全局特征以及第二局部特征图,确定所述第一图像与第二图像是否相似。从而在判断第一图像和第二图像的相似性的过程中,可以同时结合第一图像以及第二图像的全局特征以及局部特征进行相似性的检测,使得在进行图像相似检测过程中能够进行更为全面的检测,提升了进行相似检测的准确性。并且,在本实施例中,可以是先基于第一全局特征和第二全局特征来初步确定第一图像和第二图像相似的可能性,进而在第一全局特征与所述第二全局特征满足第一相似条件后,再检测所述第一局部特征图与所述第二局部特征图是否满足第二相似条件,以提升计算资源的有效利用率。In an image processing method provided by the present application, after acquiring the first image and the second image, it further acquires the first global feature and the first local feature map, and acquires the second global feature and the second local feature map, and further acquires the second global feature and the second local feature map. Based on the first global feature, the first local feature map, the second global feature, and the second local feature map, it is determined whether the first image and the second image are similar. Therefore, in the process of judging the similarity between the first image and the second image, the similarity detection can be carried out in combination with the global features and local features of the first image and the second image, so that it is possible to perform more similarity detection in the process of image similarity detection. For comprehensive detection, the accuracy of similar detection is improved. Moreover, in this embodiment, the possibility that the first image and the second image are similar may be preliminarily determined based on the first global feature and the second global feature, and then the first global feature and the second global feature satisfy After the first similarity condition is met, it is then detected whether the first local feature map and the second local feature map satisfy the second similarity condition, so as to improve the effective utilization of computing resources.
请参阅图11,本申请实施例提供的一种图像处理方法,所述方法包括:Referring to FIG. 11 , an image processing method provided by an embodiment of the present application includes:
S310:获取第一图像以及第一图像集合。S310: Acquire a first image and a first set of images.
其中,第一图像集合为进行图像相似匹配的图像所在的集合。在本实施例中,可以将第一图像集合中的图像与第一图像进行匹配,以获取到第一图像集合中与第一图像相似的图像。Wherein, the first image set is a set of images for which image similarity matching is performed. In this embodiment, the images in the first image set may be matched with the first image to obtain images in the first image set that are similar to the first image.
S320:获取第一全局特征以及第一局部特征图,所述第一全局特征为所述第一图像对应的全局特征,所述第一局部特征图包括所述第一图像对应的局部特征。S320: Obtain a first global feature and a first local feature map, where the first global feature is a global feature corresponding to the first image, and the first local feature map includes local features corresponding to the first image.
S330:获取所述第一图像集合中每个图像对应的全局特征以及局部特征图。S330: Acquire a global feature and a local feature map corresponding to each image in the first image set.
可选的,可以基于前述获取第一全局特征以及第一局部特征图的方式,来获取到第一图像集合中每个图像对应的全局特征以及局部特征图。Optionally, the global feature and the local feature map corresponding to each image in the first image set may be obtained based on the foregoing method of obtaining the first global feature and the first local feature map.
S340:基于所述第一全局特征以及所述第一图像集合中每个图像对应的全局特征,从所述第一图像集合中确定第二图像集合。S340: Determine a second image set from the first image set based on the first global feature and the global feature corresponding to each image in the first image set.
需要说明的是,在本实施例中,可以将第一图像集合中的每个图像对应的全局特征分别与该第一图像的第一全局特征进行比对,进而将对应的比对结果满足前述第一相似条件的全局特征对应的图像组合为第二图像集合。示例性的,第一图像集合中包括有图像A、图像B以及图像C,其中,图像A对应的全局特征为全局特征t1,图像B对应的全局特征为全局特征t2,图像C对应的全局特征为全局特征t3。那么将该全局特征t1与第一全局特征进行比对,那么该比对结果对应的全局特征为该全局特征t1,该全局特征t1对应的图像为图像A。It should be noted that, in this embodiment, the global feature corresponding to each image in the first image set may be compared with the first global feature of the first image, and then the corresponding comparison result satisfies the aforementioned The images corresponding to the global features of the first similarity condition are combined into a second image set. Exemplarily, the first image set includes image A, image B, and image C, wherein the global feature corresponding to image A is global feature t1, the global feature corresponding to image B is global feature t2, and the global feature corresponding to image C is is the global feature t3. Then, the global feature t1 is compared with the first global feature, then the global feature corresponding to the comparison result is the global feature t1, and the image corresponding to the global feature t1 is the image A.
S350:基于所述第一局部特征图以及所述第二图像集合中每个图像的局部特征图,确定所述第二图像集合中与所述第一图像相似的图像。S350: Based on the first local feature map and the local feature map of each image in the second image set, determine an image in the second image set that is similar to the first image.
在得到第二图像集合后,则可以将第二图像集合中每个图像的局部特征图与第一局部特征图进行比对,进而将对应的比对结果满足前述第二相似条件的局部特征图对应的图像作为与所述第一图像相似的图像。示例性的,第一图像集合中包括有图像A、图像B以及图像C,而筛选出的第二图像集合包括有图像B以及图像C,那么若对应的比对结果满足前述第二相似条件的局部特征图对应的图像为图像B,则可以确定图像B为与第一图像相似的图像。After the second image set is obtained, the local feature map of each image in the second image set can be compared with the first local feature map, and then the corresponding comparison result satisfies the second similarity condition of the local feature map. The corresponding image is an image similar to the first image. Exemplarily, the first image set includes image A, image B, and image C, and the screened second image set includes image B and image C, then if the corresponding comparison result satisfies the aforementioned second similarity condition. If the image corresponding to the local feature map is image B, it can be determined that image B is an image similar to the first image.
本申请提供的一种图像处理方法,在获取第一图像和第二图像后,会进一步的获取第一全局特征以及第一局部特征图,以及获取所述第一图像集合中每个图像对应的全局特征以及局部特征图,进而基于所述第一全局特征以及所述第一图像集合中每个图像对应的全局特征,从所述第一图像集合中确定第二图像集合,然后再基于所述第一局部特征图以及所述第二图像集合中每个图像的局部特征图,确定所述第二图像集合中与所述第一图像相似的图像。In an image processing method provided by the present application, after acquiring the first image and the second image, it further acquires the first global feature and the first local feature map, and acquires the corresponding image of each image in the first image set. global feature and local feature map, and then based on the first global feature and the global feature corresponding to each image in the first image set, determine a second image set from the first image set, and then based on the first image set The first local feature map and the local feature map of each image in the second image set determine images in the second image set that are similar to the first image.
从而在以第一图像为基准从第一图像集合中筛选与第一图像相似的图像的过程中,可以基于第一全局特征与第一图像集合中每个图像对应的全局特征进行初步的筛选,得到第二图像集合,以便可以更为快速的排除掉第一图像集合中实际与第一图像不相似的图像,进而再基于第一局部特征图以及所述第二图像集合中每个图像的局部特征,确定所述第二图像集合中与所述第一图像相似的图像,从而使得可以在相对更小的范围内基于图像的局部特征来确定实际相似的图像。Therefore, in the process of screening images similar to the first image from the first image set based on the first image, preliminary screening can be performed based on the first global feature and the global feature corresponding to each image in the first image set, Obtain the second image set, so that the images in the first image set that are actually not similar to the first image can be excluded more quickly, and then based on the first local feature map and the local part of each image in the second image set feature to determine images in the second set of images that are similar to the first image, so that actually similar images can be determined based on local features of the images in a relatively smaller range.
请参阅图12,本申请实施例提供的一种图像处理装置400,所述装置400包括:Referring to FIG. 12, an image processing apparatus 400 provided by an embodiment of the present application, the apparatus 400 includes:
图像获取单元410,用于获取第一图像以及第二图像。The image acquisition unit 410 is used for acquiring the first image and the second image.
特征获取单元420,用于获取第一全局特征以及第一局部特征图,所述第一全局特征为所述第一图像对应的全局特征,所述第一局部特征图包括所述第一图像对应的局部特征。A feature acquisition unit 420 is configured to acquire a first global feature and a first local feature map, where the first global feature is a global feature corresponding to the first image, and the first local feature map includes a corresponding global feature of the first image. local features.
所述特征获取单元420,还用于获取第二全局特征以及第二局部特征图,所述第二全局特征为所述第二图像对应的全局特征,所述第二局部特征图包括所述第二图像对应的局部特征。The feature acquisition unit 420 is further configured to acquire a second global feature and a second local feature map, where the second global feature is a global feature corresponding to the second image, and the second local feature map includes the first The local features corresponding to the two images.
作为一种方式,特征获取单元420,具体用于将所述第一图像输入到目标神经网络,获取所述目标神经网络输出的特征图作为初始特征图;对于所述初始特征图进行全局平均池化处理,得到第一全局特征;获取所述初始特征图中多个位置各自对应的特征集合,每个所述位置对应的特征集合包括每个位置的特征,以及每个位置的相邻位置的特征;对每个所述位置各自对应的特征集合进行平均处理,得到每个所述位置对应的局部特征;基于所述每个所述位置对应的局部特征得到所述第一局部特征图。In one way, the feature acquisition unit 420 is specifically configured to input the first image into the target neural network, and obtain a feature map output by the target neural network as an initial feature map; perform global average pooling on the initial feature map process to obtain the first global feature; obtain the feature sets corresponding to multiple positions in the initial feature map, and the feature set corresponding to each position includes the feature of each position, and the adjacent positions of each position. feature; perform average processing on the feature sets corresponding to each of the positions to obtain local features corresponding to each of the positions; and obtain the first local feature map based on the local features corresponding to each of the positions.
作为一种方式,特征获取单元420,具体用于将所述第二图像输入到目标神经网络,获取所述目标神经网络输出的特征图作为第二初始特征图;对于所述第二初始特征图进行全局平均池化处理,得到第二全局特征;获取所述第二初始特征图中多个位置各自对应的特征集合,每个所述位置对应的特征集合包括每个位置的特征,以及每个位置的相邻位置的特征;对每个所述位置各自对应的特征集合进行平均处理,得到每个所述位置对应的局部特征;基于所述每个所述位置对应的局部特征得到所述第二局部特征图。In one way, the feature acquisition unit 420 is specifically configured to input the second image into the target neural network, and obtain the feature map output by the target neural network as the second initial feature map; for the second initial feature map Perform global average pooling processing to obtain a second global feature; obtain feature sets corresponding to multiple positions in the second initial feature map, and the feature set corresponding to each position includes the feature of each position, and each The features of the adjacent positions of the positions; the average processing of the corresponding feature sets for each of the positions to obtain the local features corresponding to each of the positions; based on the local features corresponding to each of the positions to obtain the first Two local feature maps.
图像比对单元430,用于基于所述第一全局特征、第一局部特征图、第二全局特征以及第二局部特征图,确定所述第一图像与第二图像是否相似。The image comparison unit 430 is configured to determine whether the first image and the second image are similar based on the first global feature, the first local feature map, the second global feature and the second local feature map.
其中,可选的,图像比对单元430,具体用于若第一全局特征与所述第二全局特征满足第一相似条件,且所述第一局部特征图与所述第二局部特征图满足第二相似条件,确定所述第一图像与第二图像相似。Wherein, optionally, the image comparison unit 430 is specifically configured to, if the first global feature and the second global feature satisfy the first similarity condition, and the first local feature map and the second local feature map satisfy The second similarity condition determines that the first image is similar to the second image.
可选的,图像比对单元430,具体用于若第一全局特征与所述第二全局特征满足第一相似条件,检测所述第一局部特征图与所述第二局部特征图是否满足第二相似条件;若第一全局特征与所述第二全局特征不满足所述第一相似条件,确定所述第一图像与第二图像不相似。Optionally, the image comparison unit 430 is specifically configured to detect whether the first local feature map and the second local feature map satisfy the first similarity condition if the first global feature and the second global feature satisfy the first similarity condition. Two similarity conditions; if the first global feature and the second global feature do not satisfy the first similarity condition, it is determined that the first image and the second image are not similar.
作为一种方式,图像比对单元430,具体用于若第一全局特征与所述第二全局特征之间的距离小于第一距离阈值,确定所述第一全局特征与所述第二全局特征满足第一相似条件。In one way, the image comparison unit 430 is specifically configured to determine the first global feature and the second global feature if the distance between the first global feature and the second global feature is less than a first distance threshold The first similarity condition is satisfied.
作为一种方式,图像比对单元430,具体用于计算相互对应的第一局部特征以及第二局部特征之间的特征距离,所述第一局部特征为所述第一局部特征图包括的局部特征,所述第二局部特征为所述第二局部特征图包括的局部特征;将对应的所述特征距离小于第二距离阈值的第一局部特征作为目标局部特征;若所述目标局部特征的数量与所述第一局部特征图包括的局部特征的数量的比值大于比例阈值,确定所述第一局部特征与所述第二局部特征满足第一相似条件。In one way, the image comparison unit 430 is specifically configured to calculate the feature distance between the corresponding first local features and the second local features, where the first local features are the local features included in the first local feature map feature, the second local feature is the local feature included in the second local feature map; the first local feature whose corresponding feature distance is less than the second distance threshold is used as the target local feature; if the target local feature is If the ratio of the number to the number of local features included in the first local feature map is greater than a scale threshold, it is determined that the first local feature and the second local feature satisfy a first similarity condition.
如图13所示,所述装置400,还包括:As shown in Figure 13, the device 400 further includes:
尺寸处理单元440,用于若第一图像和第二图像的尺寸不同,将所述第一图像以及第二图像的尺寸更新为相同。The size processing unit 440 is configured to update the size of the first image and the second image to be the same if the sizes of the first image and the second image are different.
请参阅图14,本申请实施例提供的一种图像处理装置500,所述装置500包括:Referring to FIG. 14, an image processing apparatus 500 provided by an embodiment of the present application, the apparatus 500 includes:
图像获取单元510,用于获取第一图像以及第一图像集合;an image acquisition unit 510, configured to acquire a first image and a first image set;
特征获取单元520,用于获取第一全局特征以及第一局部特征图,所述第一全局特征为所述第一图像对应的全局特征,所述第一局部特征图包括所述第一图像对应的局部特征;A feature acquisition unit 520 is configured to acquire a first global feature and a first local feature map, where the first global feature is a global feature corresponding to the first image, and the first local feature map includes the corresponding first image. local features;
所述特征获取单元520,还用于获取所述第一图像集合中每个图像对应的全局特征以及局部特征图;The feature obtaining unit 520 is further configured to obtain a global feature and a local feature map corresponding to each image in the first image set;
第一图像确定单元530,用于基于所述第一全局特征以及所述第一图像集合中每个图像对应的全局特征,从所述第一图像集合中确定第二图像集合;a first image determination unit 530, configured to determine a second image set from the first image set based on the first global feature and the global feature corresponding to each image in the first image set;
第二图像确定单元540,用于基于所述第一局部特征图以及所述第二图像集合中每个图像的局部特征图,确定所述第二图像集合中与所述第一图像相似的图像。A second image determining unit 540, configured to determine an image in the second image set that is similar to the first image based on the first local feature map and the local feature map of each image in the second image set .
本申请提供的一种图像处理装置,在获取第一图像和第二图像后,会进一步的获取第一全局特征以及第一局部特征图,以及获取第二全局特征以及第二局部特征图,进而基于所述第一全局特征、第一局部特征图、第二全局特征以及第二局部特征图,确定所述第一图像与第二图像是否相似。从而在判断第一图像和第二图像的相似性的过程中,可以同时结合第一图像以及第二图像的全局特征以及局部特征进行相似性的检测,使得在进行图像相似检测过程中能够进行更为全面的检测,提升了进行相似检测的准确性。An image processing apparatus provided by the present application, after acquiring the first image and the second image, further acquires the first global feature and the first local feature map, and acquires the second global feature and the second local feature map, and further Based on the first global feature, the first local feature map, the second global feature, and the second local feature map, it is determined whether the first image and the second image are similar. Therefore, in the process of judging the similarity between the first image and the second image, the similarity detection can be carried out in combination with the global features and local features of the first image and the second image, so that the image similarity detection process can be more accurate. For comprehensive detection, the accuracy of similar detection is improved.
需要说明的是,本申请中装置实施例与前述方法实施例是相互对应的,装置实施例中具体的原理可以参见前述方法实施例中的内容,此处不再赘述。It should be noted that the apparatus embodiments in the present application correspond to the foregoing method embodiments, and the specific principles in the apparatus embodiments may refer to the content in the foregoing method embodiments, which will not be repeated here.
下面将结合图15对本申请提供的一种电子设备进行说明。An electronic device provided by the present application will be described below with reference to FIG. 15 .
请参阅图15,基于上述的图像处理方法、装置,本申请实施例还提供的另一种可以执行前述图像处理方法的电子设备200。电子设备200包括相互耦合的一个或多个(图中仅示出一个)处理器102、存储器104以及网络模块106。其中,该存储器104中存储有可以执行前述实施例中内容的程序,而处理 器102可以执行该存储器104中存储的程序。Referring to FIG. 15 , based on the above-mentioned image processing method and apparatus, an embodiment of the present application further provides another electronic device 200 that can execute the above-mentioned image processing method. The electronic device 200 includes one or more (only one shown in the figure) a processor 102, a memory 104, and a network module 106 that are coupled to each other. Wherein, the memory 104 stores programs that can execute the contents of the foregoing embodiments, and the processor 102 can execute the programs stored in the memory 104.
其中,处理器102可以包括一个或者多个用于处理数据的核。处理器102利用各种接口和线路连接整个电子设备200内的各个部分,通过运行或执行存储在存储器104内的指令、程序、代码集或指令集,以及调用存储在存储器104内的数据,执行电子设备200的各种功能和处理数据。可选地,处理器102可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器102可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器102中,单独通过一块通信芯片进行实现。The processor 102 may include one or more cores for processing data. The processor 102 uses various interfaces and lines to connect various parts of the entire electronic device 200, and executes by running or executing the instructions, programs, code sets or instruction sets stored in the memory 104, and calling the data stored in the memory 104. Various functions of the electronic device 200 and processing data. Optionally, the processor 102 may adopt at least one of digital signal processing (Digital Signal Processing, DSP), field-programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). A hardware form is implemented. The processor 102 may integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU), a modem, and the like. Among them, the CPU mainly handles the operating system, user interface and application programs, etc.; the GPU is used for rendering and drawing of the display content; the modem is used to handle wireless communication. It can be understood that, the above-mentioned modem may not be integrated into the processor 102, and is implemented by a communication chip alone.
存储器104可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory,ROM)。存储器104可用于存储指令、程序、代码、代码集或指令集。存储器104可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。例如,存储器104中可以存储有图像处理的装置。其中,该图像处理的装置可以为前述的装置400或前述的装置500。存储数据区还可以存储电子设备100在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。The memory 104 may include a random access memory (Random Access Memory, RAM), or may include a read-only memory (Read-Only Memory, ROM). Memory 104 may be used to store instructions, programs, codes, sets of codes, or sets of instructions. The memory 104 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing the operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.) , instructions for implementing the following method embodiments, and the like. For example, the memory 104 may store means for image processing. The apparatus for image processing may be the aforementioned apparatus 400 or the aforementioned apparatus 500 . The storage data area may also store data (such as phone book, audio and video data, chat record data) created by the electronic device 100 during use.
所述网络模块106用于接收以及发送电磁波,实现电磁波与电信号的相互转换,从而与通讯网络或者其他设备进行通讯,例如和音频播放设备进行通讯。所述网络模块106可包括各种现有的用于执行这些功能的电路元件,例如,天线、射频收发器、数字信号处理器、加密/解密芯片、用户身份模块(SIM)卡、存储器等等。所述网络模块106可与各种网络如互联网、企业内部网、无线网络进行通讯或者通过无线网络与其他设备进行通讯。上述的无线网络可包括蜂窝式电话网、无线局域网或者城域网。例如,网络模块106可以与基站进行信息交互。The network module 106 is used for receiving and sending electromagnetic waves, realizing mutual conversion between electromagnetic waves and electrical signals, so as to communicate with a communication network or other devices, for example, communicate with an audio playback device. The network module 106 may include various existing circuit elements for performing these functions, eg, antennas, radio frequency transceivers, digital signal processors, encryption/decryption chips, subscriber identity module (SIM) cards, memory, etc. . The network module 106 can communicate with various networks such as the Internet, an intranet, a wireless network, or communicate with other devices through a wireless network. The aforementioned wireless network may include a cellular telephone network, a wireless local area network, or a metropolitan area network. For example, the network module 106 may interact with the base station for information.
请参考图16,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读存储介质1100中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。Please refer to FIG. 16 , which shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application. The computer-readable storage medium 1100 stores program codes, and the program codes can be invoked by the processor to execute the methods described in the above method embodiments.
计算机可读存储介质1100可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质1100包括非易失性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质1100具有执行上述方法中的任何方法步骤的程序代码1110的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码1110可以例如以适当形式进行压缩。The computer-readable storage medium 1100 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 1100 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 1100 has storage space for program code 1110 that performs any of the method steps in the above-described methods. The program codes can be read from or written to one or more computer program products. Program code 1110 may be compressed, for example, in a suitable form.
综上所述,本申请提供的一种图像处理方法、装置、电子设备及存储介质,在获取第一图像和第二图像后,会进一步的获取第一全局特征以及第一局部特征图,以及获取第二全局特征以及第二局部特征图,进而基于所述第一全局特征、第一局部特征图、第二全局特征以及第二局部特征图,确定所述第一图像与第二图像是否相似。从而在判断第一图像和第二图像的相似性的过程中,可以同时结合第一图像以及第二图像的全局特征以及局部特征进行相似性的检测,使得在进行图像相似检测过程中能够进行更为全面的检测,提升了进行相似检测的准确性。To sum up, an image processing method, device, electronic device and storage medium provided by this application, after acquiring the first image and the second image, will further acquire the first global feature and the first local feature map, and Obtain a second global feature and a second local feature map, and then determine whether the first image and the second image are similar based on the first global feature, the first local feature map, the second global feature, and the second local feature map . Therefore, in the process of judging the similarity between the first image and the second image, the similarity detection can be carried out in combination with the global features and local features of the first image and the second image, so that the image similarity detection process can be more accurate. For comprehensive detection, the accuracy of similar detection is improved.
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征图进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand: it can still be Modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements to some of the technical feature diagrams; and these modifications or replacements do not drive the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions in the embodiments of the present application .

Claims (20)

  1. 一种图像处理方法,其特征在于,所述方法包括:An image processing method, characterized in that the method comprises:
    获取第一图像以及第二图像;obtain the first image and the second image;
    获取第一全局特征以及第一局部特征图,所述第一全局特征为所述第一图像对应的全局特征,所述第一局部特征图包括所述第一图像对应的局部特征;acquiring a first global feature and a first local feature map, where the first global feature is a global feature corresponding to the first image, and the first local feature map includes a local feature corresponding to the first image;
    获取第二全局特征以及第二局部特征图,所述第二全局特征为所述第二图像对应的全局特征,所述第二局部特征图包括所述第二图像对应的局部特征;acquiring a second global feature and a second local feature map, where the second global feature is a global feature corresponding to the second image, and the second local feature map includes a local feature corresponding to the second image;
    基于所述第一全局特征、第一局部特征图、第二全局特征以及第二局部特征图,确定所述第一图像与第二图像是否相似。Based on the first global feature, the first local feature map, the second global feature, and the second local feature map, it is determined whether the first image and the second image are similar.
  2. 根据权利要求1所述的方法,其特征在于,所述基于所述第一全局特征、第一局部特征图、第二全局特征以及第二局部特征图,确定所述第一图像与第二图像是否相似,包括:The method according to claim 1, wherein the first image and the second image are determined based on the first global feature, the first local feature map, the second global feature and the second local feature map Are they similar, including:
    若第一全局特征与所述第二全局特征满足第一相似条件,且所述第一局部特征图与所述第二局部特征图满足第二相似条件,确定所述第一图像与第二图像相似。If the first global feature and the second global feature satisfy the first similarity condition, and the first local feature map and the second local feature map satisfy the second similarity condition, determine the first image and the second image resemblance.
  3. 根据权利要求2所述的方法,其特征在于,所述方法还包括:The method according to claim 2, wherein the method further comprises:
    若第一全局特征与所述第二全局特征满足第一相似条件,检测所述第一局部特征图与所述第二局部特征图是否满足第二相似条件;If the first global feature and the second global feature satisfy the first similarity condition, detecting whether the first local feature map and the second local feature map satisfy the second similarity condition;
    若第一全局特征与所述第二全局特征不满足所述第一相似条件,确定所述第一图像与第二图像不相似。If the first global feature and the second global feature do not satisfy the first similarity condition, it is determined that the first image and the second image are not similar.
  4. 根据权利要求2或3所述的方法,其特征在于,所述方法还包括:The method according to claim 2 or 3, wherein the method further comprises:
    若第一全局特征与所述第二全局特征之间的距离小于第一距离阈值,确定所述第一全局特征与所述第二全局特征满足第一相似条件。If the distance between the first global feature and the second global feature is less than a first distance threshold, it is determined that the first global feature and the second global feature satisfy a first similarity condition.
  5. 根据权利要求4所述的方法,其特征在于,所述若第一全局特征与所述第二全局特征之间的距离小于第一距离阈值,确定所述第一全局特征与所述第二全局特征满足第一相似条件之前还包括:The method according to claim 4, wherein, if the distance between the first global feature and the second global feature is less than a first distance threshold, determining the first global feature and the second global feature Before the feature satisfies the first similarity condition, it further includes:
    基于欧氏距离或者余弦距离计算所述第一全局特征与所述第二全局特征之间的距离。The distance between the first global feature and the second global feature is calculated based on the Euclidean distance or the cosine distance.
  6. 根据权利要求2或3所述的方法,其特征在于,所述方法还包括:The method according to claim 2 or 3, wherein the method further comprises:
    计算相互对应的第一局部特征以及第二局部特征之间的特征距离,所述第一局部特征为所述第一局部特征图包括的局部特征,所述第二局部特征为所述第二局部特征图包括的局部特征;Calculate the feature distance between the corresponding first local feature and the second local feature, the first local feature is the local feature included in the first local feature map, and the second local feature is the second local feature The local features included in the feature map;
    将对应的所述特征距离小于第二距离阈值的第一局部特征作为目标局部特征;Taking the first local feature whose corresponding feature distance is less than the second distance threshold as the target local feature;
    若所述目标局部特征的数量与所述第一局部特征图包括的局部特征的数量的比值大于比例阈值,确定所述第一局部特征图与所述第二局部特征图满足第二相似条件。If the ratio of the number of target local features to the number of local features included in the first local feature map is greater than a scale threshold, it is determined that the first local feature map and the second local feature map satisfy a second similarity condition.
  7. 根据权利要求6所述的方法,其特征在于,所述第一局部特征图包括的局部特征的数量为第一初始特征图中位置的数量,所述第一初始特征图中位置的数量为所述第一初始特征图的宽度与所述第一初始特征图的高度的乘积。The method according to claim 6, wherein the number of local features included in the first local feature map is the number of locations in the first initial feature map, and the number of locations in the first initial feature map is all The product of the width of the first initial feature map and the height of the first initial feature map.
  8. 根据权利要求1-7任一所述的方法,其特征在于,所述获取第一全局特征以及第一局部特征图,包括:The method according to any one of claims 1-7, wherein the acquiring the first global feature and the first local feature map comprises:
    将所述第一图像输入到目标神经网络,获取所述目标神经网络输出的特征图作为第一初始特征图;Inputting the first image to the target neural network, and obtaining the feature map output by the target neural network as the first initial feature map;
    对于所述第一初始特征图进行全局平均池化处理,得到第一全局特征;Perform a global average pooling process on the first initial feature map to obtain a first global feature;
    获取所述第一初始特征图中多个位置各自对应的特征集合,每个所述位置对应的特征集合包括每个位置的特征,以及每个位置的相邻位置的特征;Obtaining feature sets corresponding to multiple positions in the first initial feature map, where the feature sets corresponding to each position include features of each position and features of adjacent positions of each position;
    对每个所述位置各自对应的特征集合进行平均处理,得到每个所述位置对应的局部特征;Average processing is performed on the respective feature sets corresponding to each of the positions to obtain local features corresponding to each of the positions;
    基于所述每个所述位置对应的局部特征得到所述第一局部特征图。The first local feature map is obtained based on the local features corresponding to each of the positions.
  9. 根据权利要求1-8任一所述的方法,其特征在于,所述获取第二全局特征以及第二局部特征图,包括:The method according to any one of claims 1-8, wherein the acquiring the second global feature and the second local feature map comprises:
    将所述第二图像输入到目标神经网络,获取所述目标神经网络输出的特征图作为第二初始特征图;The second image is input into the target neural network, and the feature map output by the target neural network is obtained as the second initial feature map;
    对于所述第二初始特征图进行全局平均池化处理,得到第二全局特征;Perform a global average pooling process on the second initial feature map to obtain a second global feature;
    获取所述第二初始特征图中多个位置各自对应的特征集合,每个所述位置对应的特征集合包括每个位置的特征,以及每个位置的相邻位置的特征;Obtaining feature sets corresponding to multiple positions in the second initial feature map, where the feature sets corresponding to each position include features of each position and features of adjacent positions of each position;
    对每个所述位置各自对应的特征集合进行平均处理,得到每个所述位置对应的局部特征;Average processing is performed on the respective feature sets corresponding to each of the positions to obtain local features corresponding to each of the positions;
    基于所述每个所述位置对应的局部特征得到所述第二局部特征图。The second local feature map is obtained based on the local features corresponding to each of the positions.
  10. 根据权利要求1-9任一所述的方法,其特征在于,所述获取第一全局特征以及第一局部特征图之前还包括:The method according to any one of claims 1-9, wherein before acquiring the first global feature and the first local feature map, the method further comprises:
    若第一图像和第二图像的尺寸不同,将所述第一图像以及第二图像的尺寸更新为相同。If the sizes of the first image and the second image are different, the sizes of the first image and the second image are updated to be the same.
  11. 根据权利要求1-10任一所述的方法,其特征在于,所述第一全局特征为表征所述第一图像的整体特征的向量;所述第二全局特征为表征所述第二图像的整体特征的向量。The method according to any one of claims 1-10, wherein the first global feature is a vector representing the overall feature of the first image; the second global feature is a vector representing the second image A vector of overall features.
  12. 根据权利要求1-10任一所述的方法,其特征在于,所述第一局部特征图包括多个表征所述第一图像中多个位置各自对应的局部特征;所述第二局部特征图包括多个所述第二图像中多个位置各自对应的局部特征。The method according to any one of claims 1-10, wherein the first local feature map comprises a plurality of local features representing respective corresponding positions of a plurality of positions in the first image; the second local feature map Including a plurality of local features corresponding to a plurality of positions in the second image.
  13. 一种图像处理方法,其特征在于,所述方法包括:An image processing method, characterized in that the method comprises:
    获取第一图像以及第一图像集合;obtaining a first image and a first set of images;
    获取第一全局特征以及第一局部特征图,所述第一全局特征为所述第一图像对应的全局特征,所述第一局部特征图包括所述第一图像对应的局部特征;acquiring a first global feature and a first local feature map, where the first global feature is a global feature corresponding to the first image, and the first local feature map includes a local feature corresponding to the first image;
    获取所述第一图像集合中每个图像对应的全局特征以及局部特征图;Obtain the global feature and local feature map corresponding to each image in the first image set;
    基于所述第一全局特征以及所述第一图像集合中每个图像对应的全局特征,从所述第一图像集合中确定第二图像集合;determining a second set of images from the first set of images based on the first global feature and a global feature corresponding to each image in the first set of images;
    基于所述第一局部特征图以及所述第二图像集合中每个图像的局部特征图,确定所述第二图像集合中与所述第一图像相似的图像。Based on the first local feature map and the local feature map of each image in the second set of images, an image in the second set of images that is similar to the first image is determined.
  14. 根据权利要求13所述的方法,其特征在于,所述基于所述第一全局特征以及所述第一图像集合中每个图像对应的全局特征,从所述第一图像集合中确定第二图像集合,包括:The method according to claim 13, wherein the second image is determined from the first image set based on the first global feature and the global feature corresponding to each image in the first image set Collection, including:
    将所述第一图像集合中的每个图像对应的全局特征分别与所述第一图像的第一全局特征进行比对;Comparing the global feature corresponding to each image in the first image set with the first global feature of the first image respectively;
    将所述第一图像集合中对应的比对结果满足第一相似条件的全局特征对应的图像组合为第二图像集合。The images corresponding to the global features whose corresponding comparison results satisfy the first similarity condition in the first image set are combined into a second image set.
  15. 根据权利要求13所述的方法,其特征在于,所述基于所述第一局部特征图以及所述第二图像集合中每个图像的局部特征图,确定所述第二图像集合中与所述第一图像相似的图像,包括:The method according to claim 13, characterized in that, based on the first local feature map and the local feature map of each image in the second image set, determining the relationship between the second image set and the second image set Images similar to the first image, including:
    将所述第二图像集合中每个图像的局部特征图与所述第一局部特征图进行比对;comparing the local feature map of each image in the second image set with the first local feature map;
    将所述第二图像集合中对应的比对结果满足第二相似条件的局部特征图对应的图像作为与所述第一图像相似的图像。The image corresponding to the local feature map whose corresponding comparison result satisfies the second similarity condition in the second image set is regarded as an image similar to the first image.
  16. 一种图像处理装置,其特征在于,所述装置包括:An image processing device, characterized in that the device comprises:
    图像获取单元,用于获取第一图像以及第二图像;an image acquisition unit for acquiring the first image and the second image;
    特征获取单元,用于获取第一全局特征以及第一局部特征图,所述第一全局特征为所述第一图像对应的全局特征,所述第一局部特征图包括所述第一图像对应的局部特征;A feature acquisition unit, configured to acquire a first global feature and a first local feature map, where the first global feature is a global feature corresponding to the first image, and the first local feature map includes the first local feature map corresponding to the first image. local features;
    所述特征获取单元,还用于获取第二全局特征以及第二局部特征图,所述第二全局特征为所述第二图像对应的全局特征,所述第二局部特征图包括所述第二图像对应的局部特征;The feature acquisition unit is further configured to acquire a second global feature and a second local feature map, where the second global feature is a global feature corresponding to the second image, and the second local feature map includes the second Local features corresponding to the image;
    图像比对单元,用于基于所述第一全局特征、第一局部特征图、第二全局特征以及第二局部特征图,确定所述第一图像与第二图像是否相似。An image comparison unit, configured to determine whether the first image and the second image are similar based on the first global feature, the first local feature map, the second global feature, and the second local feature map.
  17. 根据权利要求16所述的装置,其特征在于,所述装置包括:The apparatus of claim 16, wherein the apparatus comprises:
    尺寸处理单元,用于若第一图像和第二图像的尺寸不同,将所述第一图像以及第二图像的尺寸更新为相同。A size processing unit, configured to update the size of the first image and the second image to be the same if the sizes of the first image and the second image are different.
  18. 一种图像处理装置,其特征在于,所述装置包括:An image processing device, characterized in that the device comprises:
    图像获取单元,用于获取第一图像以及第一图像集合;an image acquisition unit for acquiring a first image and a first image set;
    特征获取单元,用于获取第一全局特征以及第一局部特征图,所述第一全局特征为所述第一图像对应的全局特征,所述第一局部特征图包括所述第一图像对应的局部特征;A feature acquisition unit, configured to acquire a first global feature and a first local feature map, where the first global feature is a global feature corresponding to the first image, and the first local feature map includes the first local feature map corresponding to the first image. local features;
    所述特征获取单元,还用于获取所述第一图像集合中每个图像对应的全局特征以及局部特征图;The feature obtaining unit is further configured to obtain a global feature and a local feature map corresponding to each image in the first image set;
    第一图像确定单元,用于基于所述第一全局特征以及所述第一图像集合中每个图像对应的全局特征,从所述第一图像集合中确定第二图像集合;a first image determining unit, configured to determine a second image set from the first image set based on the first global feature and the global feature corresponding to each image in the first image set;
    第二图像确定单元,用于基于所述第一局部特征图以及所述第二图像集合中每个图像的局部特征图,确定所述第二图像集合中与所述第一图像相似的图像。A second image determining unit, configured to determine an image in the second image set that is similar to the first image based on the first local feature map and the local feature map of each image in the second image set.
  19. 一种电子设备,其特征在于,包括处理器以及存储器;An electronic device, comprising a processor and a memory;
    一个或多个程序被存储在所述存储器中并被配置为由所述处理器执行以实现权利要求1-12任一所述的方法或者权利要求13-15任一所述的方法。One or more programs are stored in the memory and configured to be executed by the processor to implement the method of any of claims 1-12 or the method of any of claims 13-15.
  20. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有程序代码,其中,在所述程序代码被处理器运行时执行权利要求1-12任一所述的方法或者权利要求13-15任一所述的方法。A computer-readable storage medium, wherein a program code is stored in the computer-readable storage medium, wherein, when the program code is executed by a processor, the method according to any one of claims 1-12 or The method of any of claims 13-15.
PCT/CN2021/122901 2020-11-26 2021-10-09 Image processing method and apparatus, and electronic device and storage medium WO2022111070A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011356038.4A CN112329889A (en) 2020-11-26 2020-11-26 Image processing method and device and electronic equipment
CN202011356038.4 2020-11-26

Publications (1)

Publication Number Publication Date
WO2022111070A1 true WO2022111070A1 (en) 2022-06-02

Family

ID=74308072

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/122901 WO2022111070A1 (en) 2020-11-26 2021-10-09 Image processing method and apparatus, and electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN112329889A (en)
WO (1) WO2022111070A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112329889A (en) * 2020-11-26 2021-02-05 Oppo广东移动通信有限公司 Image processing method and device and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857889A (en) * 2018-12-19 2019-06-07 苏州科达科技股份有限公司 A kind of image search method, device, equipment and readable storage medium storing program for executing
CN111353062A (en) * 2018-12-21 2020-06-30 华为技术有限公司 Image retrieval method, device and equipment
US20200242422A1 (en) * 2019-01-29 2020-07-30 Boe Technology Group Co., Ltd. Method and electronic device for retrieving an image and computer readable storage medium
CN112329889A (en) * 2020-11-26 2021-02-05 Oppo广东移动通信有限公司 Image processing method and device and electronic equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109948666A (en) * 2019-03-01 2019-06-28 广州杰赛科技股份有限公司 Image similarity recognition methods, device, equipment and storage medium
CN111522986B (en) * 2020-04-23 2023-10-10 北京百度网讯科技有限公司 Image retrieval method, device, equipment and medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857889A (en) * 2018-12-19 2019-06-07 苏州科达科技股份有限公司 A kind of image search method, device, equipment and readable storage medium storing program for executing
CN111353062A (en) * 2018-12-21 2020-06-30 华为技术有限公司 Image retrieval method, device and equipment
US20200242422A1 (en) * 2019-01-29 2020-07-30 Boe Technology Group Co., Ltd. Method and electronic device for retrieving an image and computer readable storage medium
CN112329889A (en) * 2020-11-26 2021-02-05 Oppo广东移动通信有限公司 Image processing method and device and electronic equipment

Also Published As

Publication number Publication date
CN112329889A (en) 2021-02-05

Similar Documents

Publication Publication Date Title
CN111368893B (en) Image recognition method, device, electronic equipment and storage medium
US9697416B2 (en) Object detection using cascaded convolutional neural networks
US20140233800A1 (en) Method of tracking object and electronic device supporting the same
WO2018133717A1 (en) Image thresholding method and device, and terminal
WO2018228118A1 (en) Method and device for identifying similar pictures and storage medium
CN109598250B (en) Feature extraction method, device, electronic equipment and computer readable medium
CN110909209B (en) Live video searching method and device, equipment, server and storage medium
CN111091572B (en) Image processing method and device, electronic equipment and storage medium
WO2022127912A1 (en) Image segmentation method, network training method, electronic equipment and storage medium
WO2022012123A1 (en) Data processing method and apparatus, electronic device, and storage medium
CN114926726B (en) Unmanned ship sensing method based on multitask network and related equipment
WO2022033264A1 (en) Human body feature point screening method and apparatus, electronic device and storage medium
US20160110356A1 (en) Hash table construction for utilization in recognition of target object in image
WO2021164328A1 (en) Image generation method, device, and storage medium
CN112668577A (en) Method, terminal and device for detecting target object in large-scale image
WO2022111070A1 (en) Image processing method and apparatus, and electronic device and storage medium
CN114359665A (en) Training method and device of full-task face recognition model and face recognition method
CN109408659B (en) Image retrieval method, device, computing equipment and medium based on small world network
CN112541489A (en) Image detection method and device, mobile terminal and storage medium
WO2022121701A1 (en) Image processing method and apparatus, electronic device, and storage medium
CN111783777A (en) Image processing method, image processing device, electronic equipment and computer readable medium
CN113392820B (en) Dynamic gesture recognition method and device, electronic equipment and readable storage medium
CN115100536A (en) Building identification method, building identification device, electronic equipment and computer readable medium
US9542043B2 (en) Facilitation of error tolerant image tracing optimization
CN111401383A (en) Target frame estimation method, system, device and medium based on image detection

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: 21896572

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: 21896572

Country of ref document: EP

Kind code of ref document: A1