Image processing method, device and computer readable storage medium
By identifying common viewing regions and adjusting scale differences in image processing, common viewing feature points are extracted, solving the problems of low image processing speed and poor accuracy in existing technologies, and achieving more efficient feature point matching and image processing.
Patent Information
- Application Number
- CN202210088988.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-25
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-01-25
AI Technical Summary
Existing image processing methods involve stepwise matching of feature points in an image, resulting in low processing speed and efficiency, especially when matching feature points between images with large scale differences, where the accuracy is poor.
By acquiring the associated features of image pairs, identifying co-view regions and calculating scale differences, and then extracting co-view feature points after adjusting the image size, the feature point matching rate and accuracy are improved.
It improves the accuracy and speed of image processing, and is suitable for tasks such as large-scale scene reconstruction, image registration and visual positioning, thereby improving image processing efficiency.
Smart Images

Figure CN114445633B
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to an image processing method, device and computer-readable storage medium. Background Art
[0002] With the rapid development of Internet technology, image processing has become more and more diverse. For example, in the application scenario of large-scale scene reconstruction (Structure from Motion, SFM for short), two corresponding local feature points between two images of the same scene imaged at different perspectives are matched. In the existing image processing method, each feature point in the two images is gradually extracted and matched by estimating the area with the same scale of feature points in the two images.
[0003] In the process of research and practice of the prior art, the inventors of the present invention discovered that in the existing image processing method, the image is processed by performing single-point step-by-step matching of the feature points in the image. This method has a slow processing rate for the feature points in the image, resulting in a low image processing rate, which leads to low image processing efficiency. Summary of the invention
[0004] The embodiments of the present application provide an image processing method, device, and computer-readable storage medium, which can increase the image processing rate and thereby improve the image processing efficiency.
[0005] The present application provides an image processing method, including:
[0006] Acquire a pair of images to be processed, and perform image feature extraction on the image to be processed in the pair of images to be processed to obtain image features of the image to be processed;
[0007] Extracting correlation features of the pair of images to be processed from the image features, wherein the correlation features are used to characterize mutual information between the images to be processed in the pair of images to be processed;
[0008] According to the associated features, the co-viewing images in the co-viewing area are identified in the image to be processed, and the scale difference between the co-viewing images is calculated;
[0009] Based on the scale difference, the size of the common view image is adjusted to obtain an adjusted common view image;
[0010] At least one common view feature point is extracted from each of the adjusted common view images, and the pair of images to be processed is processed based on the common view feature point.
[0011] Accordingly, an embodiment of the present application provides an image processing device, including:
[0012] An acquisition unit, used for acquiring a pair of images to be processed, and performing image feature extraction on the image to be processed in the pair of images to be processed to obtain image features of the image to be processed;
[0013] An extraction unit, configured to extract correlation features of the pair of images to be processed from the image features, wherein the correlation features are used to characterize mutual information between the images to be processed in the pair of images to be processed;
[0014] an identification unit, configured to identify, in the image to be processed, co-viewing images in a co-viewing area according to the associated features, and calculate a scale difference between the co-viewing images;
[0015] an adjusting unit, configured to adjust the size of the common vision image based on the scale difference to obtain an adjusted common vision image;
[0016] A processing unit is used to extract at least one common view feature point from each of the adjusted common view images, and process the pair of images to be processed based on the common view feature point.
[0017] In one embodiment, the identification unit includes:
[0018] An initial region feature extraction subunit is used to obtain preset region features and extract features from the preset region features using a trained image processing model to obtain initial region features;
[0019] A cross feature extraction subunit, used for performing cross feature extraction on the initial region feature and the associated feature to obtain a common view region feature corresponding to the initial region feature;
[0020] The common view image recognition subunit is used to recognize the common view image in the common view area in the image to be processed based on the common view area feature and the associated feature.
[0021] In one embodiment, the initial region feature extraction subunit includes:
[0022] A region association feature extraction module, used to extract features from the preset region features using a trained image processing model, and obtain region association features corresponding to each region sub-feature in the preset region features;
[0023] A region association weight determination module, used to determine the region association weight corresponding to each region sub-feature in the preset region feature based on the region association feature;
[0024] The initial regional feature fusion module is used to fuse each regional sub-feature in the preset regional feature according to the regional association weight to obtain the initial regional feature.
[0025] In one embodiment, the cross feature extraction subunit includes:
[0026] A cross feature extraction module, used for performing feature extraction on the initial region feature and the associated feature to obtain an image associated feature corresponding to the associated feature and an initial region associated feature corresponding to the initial region feature;
[0027] An association weight determination module, used to determine the image association weight corresponding to the association feature according to the image association feature and the initial region association feature;
[0028] The common view weighting module is used to weight the associated features based on the image association weights to obtain common view image features, and fuse the common view image features with the initial region features to obtain common view region features.
[0029] In one embodiment, the co-viewing image recognition subunit includes:
[0030] A common view weight calculation module, used for calculating the common view weight corresponding to the associated feature based on the common view area feature and the associated feature;
[0031] A module for determining the coordinates of the center of interest, configured to determine the coordinates of the center of interest in the image to be processed according to the common view weight and the associated features;
[0032] A relative center point offset regression module is used to perform regression processing on the common view area features to obtain a relative center point offset corresponding to the common view area;
[0033] A common view image recognition module is used to recognize the common view image in the common view area in the image to be processed according to the focus center coordinates and the relative center point offset.
[0034] In one embodiment, the co-viewing image recognition module includes:
[0035] A geometric center coordinate and boundary size information calculation submodule, used to calculate the geometric center coordinate and boundary size information of the common viewing area in the image to be processed according to the focus center coordinate and the relative center point offset;
[0036] A common view area determination submodule, used to determine the common view area of the image to be processed in the image to be processed based on the geometric center coordinates and the boundary size information;
[0037] The common view image segmentation submodule is used to segment the common view area in the image to be processed to obtain the common view image in the common view area.
[0038] In one embodiment, the module for determining the coordinates of the center of interest includes:
[0039] An attention weight calculation submodule, used for calculating the attention weight of each preset coordinate point in the common vision area according to the common vision weight and the common vision image feature;
[0040] A coordinate point weighting submodule, used for weighting the preset coordinate point based on the attention weight to obtain a weighted coordinate point;
[0041] The coordinate point accumulation submodule is used to accumulate the weighted coordinate points to obtain the coordinates of the center of interest in the image to be processed.
[0042] In one embodiment, the image processing apparatus further includes:
[0043] An image sample pair acquisition unit, used to acquire an image sample pair, wherein the image sample pair includes an image pair with a common viewing area marked;
[0044] A predicted common view area prediction unit, used to predict the common view area of each image sample in the image sample pair by using a preset image processing model to obtain a predicted common view area;
[0045] A convergence unit is used to converge the preset image processing model according to the marked common view area and the predicted common view area to obtain the trained image processing model.
[0046] In one embodiment, the convergence unit includes:
[0047] A predicted geometric center coordinate and predicted boundary size information extraction subunit, used to extract, in the predicted common view area, the predicted geometric center coordinate and predicted boundary size information corresponding to the predicted common view area;
[0048] The annotation geometric center coordinates and annotation boundary size information extraction subunit is used to extract the annotation geometric center coordinates and annotation boundary size information corresponding to the annotation common view area in the annotation common view area;
[0049] The convergence subunit is used to converge the preset image processing model according to the predicted geometric center coordinates, the predicted boundary size information, the annotated geometric center coordinates and the annotated boundary size information to obtain a trained image processing model.
[0050] In one embodiment, the predicted geometric center coordinates and predicted boundary size information extraction subunit is used to:
[0051] Extracting the predicted center of interest coordinates and the predicted center point offset corresponding to the predicted common view area in the predicted common view area;
[0052] The predicted geometric center coordinates and predicted boundary size information corresponding to the predicted common view area are determined according to the predicted attention center coordinates and the predicted center point offset.
[0053] In one embodiment, the convergence subunit includes:
[0054] A first loss information calculation module, used to calculate the cycle consistency loss information corresponding to the preset image processing model based on the predicted geometric center coordinates and the marked geometric center coordinates;
[0055] A second loss information calculation module, used to calculate the boundary loss information and the mean absolute error loss information corresponding to the preset image processing model based on the predicted geometric center coordinates and the predicted boundary size information, and the annotated geometric center coordinates and the annotated boundary size information;
[0056] A convergence module is used to use the cycle consistency loss information, the mean absolute error loss information and the boundary loss information as the loss information corresponding to the preset image processing model, and converge the preset image processing model according to the loss information to obtain a trained image processing model.
[0057] In one embodiment, the extraction unit comprises:
[0058] A flattening processing subunit, used for performing flattening processing on the image features to obtain flattened image features of the image to be processed;
[0059] An initial attention feature extraction subunit, used to extract features of the flat image to obtain initial attention features corresponding to the image to be processed;
[0060] The associated feature cross extraction subunit is used to perform cross feature extraction on the initial attention features to obtain the associated features of each of the images to be processed in the pair of images to be processed.
[0061] In one embodiment, the initial attention feature extraction subunit includes:
[0062] An initial correlation feature extraction module, used to extract features from the flat image feature to obtain an initial correlation feature corresponding to each sub-flat image feature in the flat image feature;
[0063] An initial association weight determination module, used to determine the initial association weight corresponding to each sub-flat image feature in the flat image feature based on the initial association feature;
[0064] The initial attention feature fusion module is used to fuse each sub-flat image feature in the flat image feature according to the initial association weight to obtain the initial attention feature corresponding to the image to be processed.
[0065] In one embodiment, the correlation feature cross extraction subunit includes:
[0066] A cross-correlation feature extraction module, used to perform cross-feature extraction on the image features and the initial attention features to obtain cross-correlation features corresponding to each of the images to be processed;
[0067] A cross-correlation weight determination module, used to determine the cross-correlation weight corresponding to the image to be processed according to the cross-correlation feature;
[0068] The cross-correlation weighting module is used to weight the initial attention feature corresponding to each of the images to be processed based on the cross-correlation weight to obtain the correlation feature corresponding to the image to be processed.
[0069] In one embodiment, the acquisition unit includes:
[0070] A feature mapping subunit, used for performing feature mapping on the image to be processed in the pair of images to be processed to obtain a feature map corresponding to the image to be processed;
[0071] A dimensionality reduction processing subunit is used to perform dimensionality reduction processing on the feature map corresponding to the image to be processed to obtain a feature map after dimensionality reduction;
[0072] The scale image feature extraction subunit is used to perform multi-scale feature extraction on the feature map after dimensionality reduction to obtain the scale image features corresponding to each scale of the image to be processed;
[0073] The image feature fusion subunit is used to fuse the scale image features corresponding to each scale of the image to be processed to obtain the image features of the image to be processed.
[0074] In one embodiment, the identification unit includes:
[0075] A size information acquisition subunit, used to acquire size information of the co-visual image corresponding to each of the images to be processed;
[0076] a size difference calculation subunit, configured to calculate at least one size difference between the images to be processed based on the size information;
[0077] The scale difference screening subunit is used to screen out target size differences that meet preset conditions from the size differences, and use the target size differences as the scale differences between the co-viewing images.
[0078] In one embodiment, the processing unit includes:
[0079] A common view feature point matching subunit, configured to perform feature point matching on common view feature points of each of the images to be processed in the image pair to be processed in the adjusted common view image to obtain matched common view feature points;
[0080] A source feature point determination subunit, configured to determine, in the image to be processed, source feature points corresponding to the matched common view feature points based on the scale difference and the size information of the adjusted common view image;
[0081] The processing subunit is used to process the to-be-processed image pair based on the source feature points.
[0082] In addition, an embodiment of the present application also provides a computer-readable storage medium, which stores multiple instructions, and the instructions are suitable for a processor to load to execute the steps in any image processing method provided in the embodiment of the present application.
[0083] In addition, an embodiment of the present application also provides a computer device, including a processor and a memory, wherein the memory stores an application program, and the processor is used to run the application program in the memory to implement the image processing method provided in the embodiment of the present application.
[0084] The embodiment of the present application also provides a computer program product or a computer program, wherein the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the image processing method provided in the embodiment of the present application.
[0085] The embodiment of the present application obtains the image features of the image to be processed by acquiring the image pair to be processed, and extracts the image features of the image to be processed in the image pair to be processed; extracts the associated features of the image pair to be processed from the image features; identifies the common view image of the common view area in the image to be processed based on the associated features, and calculates the scale difference between the common view images; adjusts the size of the common view image based on the scale difference to obtain the adjusted common view image; extracts at least one common view feature point in each adjusted common view image, and processes the image pair to be processed based on the common view feature points. In this way, by extracting the associated features representing the mutual information between the images to be processed from the image features, and identifying the common view image of the common view area between the two images to be processed in the image to be processed based on the associated features, the common view feature points in the common view area are quickly extracted and matched based on the common view images, thereby improving the rate and accuracy of feature point matching, thereby improving the accuracy and speed of image processing, and thus improving the image processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0086] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0087] Figure 1 It is a schematic diagram of an implementation scenario of an image processing method provided in an embodiment of the present application;
[0088] Figure 2 It is a flowchart of an image processing method provided in an embodiment of the present application;
[0089] Figure 3a is a schematic diagram of multi-scale feature extraction of an image processing method provided in an embodiment of the present application;
[0090] Figure 3b It is a specific flow chart of an image processing method provided in an embodiment of the present application;
[0091] Figure 4a It is a schematic diagram of the structure of an image processing model of an image processing method provided in an embodiment of the present application;
[0092] Figure 4b This is a schematic diagram of the focus center coordinates and relative center point offset of an image processing method provided in an embodiment of the present application;
[0093] Figure 5 It is a schematic diagram of the overall process of an image processing method provided by an embodiment of the present application;
[0094] Figure 6 is another flowchart of an image processing method provided by an embodiment of the present application;
[0095] Figure 7 is a structural schematic diagram of an image processing device provided in an embodiment of the present application;
[0096] Figure 8 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0097] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0098] The embodiments of the present application provide an image processing method, device and computer-readable storage medium. The image processing device can be integrated in a computer device, which can be a server or a terminal.
[0099] Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms. Terminal B may include but is not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, etc. The terminal and the server can be directly or indirectly connected via wired or wireless communication, and this application does not limit this.
[0100] See also Figure 1 , taking the image processing device integrated into a computer device as an example, Figure 1A schematic diagram of an implementation scenario of the image processing method provided in an embodiment of the present application, wherein the computer device can be a server or a terminal, and the computer device can obtain a pair of images to be processed, and perform image feature extraction on the image to be processed in the pair of images to be processed to obtain image features of the image to be processed; extract associated features of the image pair to be processed from the image features; identify the common view images of the common view area in the image to be processed based on the associated features, and calculate the scale difference between the common view images; adjust the size of the common view images based on the scale difference to obtain adjusted common view images; extract at least one common view feature point in each adjusted common view image, and process the image pair to be processed based on the common view feature points.
[0101] It should be noted that the embodiments of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, etc. Figure 1 The implementation environment scenario diagram of the image processing method shown is only an example. The implementation environment scenario of the image processing method described in the embodiment of the present application is to more clearly illustrate the technical solution of the embodiment of the present application, and does not constitute a limitation on the technical solution provided by the embodiment of the present application. It is known to those skilled in the art that with the evolution of image processing and the emergence of new business scenarios, the technical solution provided by the present application is also applicable to similar technical problems.
[0102] In order to better illustrate the embodiments of the present application, please refer to the following terms for reference:
[0103] Artificial Intelligence (AI): It is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.
[0104] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0105] Among them, Computer Vision (CV) is a science that studies how to make machines "see". To put it more specifically, it refers to the use of cameras and computers to replace human eyes to identify, locate and measure targets, and further perform graphic processing to make computer processing into images that are more suitable for human eye observation or transmission to instruments for detection. As a scientific discipline, computer vision studies related theories and technologies, and attempts to establish an artificial intelligence system that can obtain information from images or multi-dimensional data. Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous positioning and map construction, and other technologies, as well as common biometric recognition technologies such as face recognition and fingerprint recognition.
[0106] Common viewing area: A rectangular area that is the same scene in the image formed at different viewing angles.
[0107] Feature point: In image processing, a feature point refers to a point where the grayscale value of an image changes dramatically or a point with a large curvature on the edge of an image (i.e., the intersection of two edges). Image feature points play a very important role in image matching algorithms based on feature points. Image feature points can reflect the essential features of an image and identify the target object in the image. Image matching can be completed by matching feature points.
[0108] Feature matching: Obtaining pixel-level or sub-pixel correspondence between images of the same object imaged from two different perspectives.
[0109] Scale: describes the size of the object's image on the camera plane. The smaller the scale, the smaller the image of the object on the camera plane. The larger the scale, the larger the image of the object on the camera plane.
[0110] With the research and advancement of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, automatic driving, drones, robots, smart medical care, smart customer service, etc. I believe that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0111] The solutions provided in the embodiments of the present application involve technologies such as artificial intelligence computer vision, which are specifically described by the following embodiments. It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.
[0112] This embodiment will be described from the perspective of an image processing apparatus. The image processing apparatus may be integrated into a computer device, which may be a server. This application does not limit this.
[0113] See also Figure 2 , Figure 2 : is a flow chart of an image processing method provided in an embodiment of the present application. The image processing method comprises:
[0114] 101. Obtain a to-be-processed image pair, and perform image feature extraction on the to-be-processed image in the to-be-processed image pair to obtain image features of the to-be-processed image.
[0115] The image pair to be processed may be a whole composed of multiple images to be processed, for example, may be a whole composed of two images to be processed. The images to be processed in the image pair to be processed may be images with a common viewing area, that is, two images of the same scene or the same object taken at different viewing angles, different distances or different times. The image feature may be feature information characterizing the image to be processed.
[0116] There are many ways to obtain the image pair to be processed, for example, it can be obtained from a memory connected to the image processing device, or from other data storage terminals. It can also be obtained from the memory of a physical terminal, or from a virtual storage space such as a data set or corpus, which is not limited here.
[0117] After obtaining the image pair to be processed, image feature extraction can be performed on the image to be processed in the image pair to be processed. There are many ways to extract image features from the image to be processed in the image pair to be processed. For example, feature mapping can be performed on the image to be processed in the image pair to be processed to obtain a feature map corresponding to the image to be processed; dimension reduction processing can be performed on the feature map corresponding to the image to be processed to obtain a feature map after dimension reduction; multi-scale feature extraction can be performed on the feature map after dimension reduction to obtain the scale image features corresponding to the image to be processed at each scale; the scale image features corresponding to the image to be processed at each scale can be fused to obtain the image features of the image to be processed.
[0118] The feature map may be feature information representing the image to be processed in each channel. In each convolution layer of the convolutional neural network, the data exists in a three-dimensional form and can be regarded as a plurality of two-dimensional images superimposed together, wherein each two-dimensional image may be referred to as a feature map. The reduced-dimensional feature map may be a feature map obtained after the image to be processed is reduced in dimensionality, and the scale image feature may be an image feature corresponding to each scale obtained after multi-scale feature extraction of the image to be processed.
[0119] There are many ways to perform feature mapping on the image to be processed in the image pair to be processed. For example, a convolution kernel can be used to perform convolution processing on the image to be processed to map the features of the image to be processed into a feature mapping layer to obtain a feature map corresponding to the image to be processed.
[0120] In order to reduce the amount of model calculation and control the size of the model, after the feature mapping of the image to be processed in the image pair to be processed is performed, the feature map corresponding to the image to be processed can be reduced in dimension. There are many ways to reduce the dimension of the feature map corresponding to the image to be processed. For example, the feature map corresponding to the image to be processed can be convolved at the channel level to obtain a feature map after dimension reduction. For example, please refer to Figure 3a , Figure 3a This is a schematic diagram of multi-scale feature extraction of an image processing method provided in an embodiment of the present application. Assume that the dimension of the feature map corresponding to the image to be processed is w×h×1024, wherein w represents the width corresponding to the image to be processed, h represents the length corresponding to the image to be processed, and 1024 represents the number of channels corresponding to the feature map. The feature map corresponding to the image to be processed can be convolved to reduce the number of channels from 1024 to 256, and the dimension corresponding to the feature map after dimensionality reduction is w×h×256.
[0121] After the feature map corresponding to the image to be processed is reduced in dimension, multi-scale feature extraction can be performed on the reduced feature map. There are many ways to extract multi-scale features from the reduced feature map. For example, convolution kernels of different sizes can be used to convolve the reduced feature map to obtain scale image features of multiple scales, that is, the scale image features corresponding to each scale of the image to be processed can be obtained. For example, please continue to refer to Figure 3a , k represents the convolution kernel size (Kernel size), s represents the stride (Stride, also called stride) of the convolution. In this way, the convolution kernel size of 4×4 and the stride of 2×2 can be used to convolve the reduced dimension feature map, and the scale image feature of the dimension w / 2×h / 2×256 corresponding to the scale can be obtained. At the same time, the convolution kernel size of 8×8 and the stride of 2×2 can be used to convolve the reduced dimension feature map, and the scale image feature of the dimension w / 2×h / 2×128 corresponding to the scale can be obtained. The convolution kernel size of 16×16 and the stride of 2×2 can also be used to convolve the reduced dimension feature map, and the scale image feature of the dimension w / 2×h / 2×128 corresponding to the scale can be obtained. The scale image features corresponding to these three scales can be spliced to obtain a multi-scale image feature of dimension w / 2×h / 2×512.
[0122] After performing multi-scale feature extraction on the feature map after dimensionality reduction, the scale image features corresponding to each scale of the image to be processed can be fused. There are many ways to fuse the scale image features corresponding to each scale of the image to be processed. For example, please continue to refer to Figure 3a , the scale image features corresponding to each scale can be fused at the channel level to obtain the image features with a dimension of w / 2×h / 2×256 corresponding to the image to be processed.
[0123] In one embodiment, please refer to Figure 3b , Figure 3b : is a specific flow chart of an image processing method provided by an embodiment of the present application, wherein the steps indicated by solid arrows represent steps in the model training and application stage, and the steps indicated by dotted arrows represent steps only in the model training stage. It can be assumed that the image pair to be processed includes images Ia and Ib to be processed, with a length of H and a width of W (i.e., H×W). The images Ia and Ib to be processed are downsampled through a residual network (Resnet50). For example, Resnet50-Layer3 (Shared Layer3, i.e., the third layer structure in Resnet50) can be used to downsample the feature maps of the images Ia and Ib to be processed by 8 times, and the number of channels can be 1024, so that the dimension corresponding to the feature map after dimensionality reduction is W / 16×H / 16×256, so that the feature maps corresponding to the images Ia and Ib to be processed after dimensionality reduction can be respectively input into the multi-scale feature extraction module (Multi-Scale Feature Extractor) to perform multi-scale feature extraction and fusion, and obtain image features with dimensions of W / 32×H / 32×256 corresponding to the images to be processed Ia and Ib.
[0124] 102. Extract the associated features of the image pair to be processed from the image features.
[0125] The correlation feature can be used to characterize the mutual information between the images to be processed in the image pair to be processed. The mutual information can be information characterizing the correlation relationship between the images to be processed, for example, information characterizing the same scene or object between the images to be processed. The correlation feature can be a 256-dimensional feature map, which can be expressed as F∈R h ×w×256 .
[0126] There are many ways to extract the associated features of the image pair to be processed from the image features. For example, the image features can be flattened to obtain the flattened image features of the image to be processed, and feature extraction can be performed on the flattened image features to obtain the initial attention features corresponding to the image to be processed, and cross-feature extraction can be performed on the initial attention features to obtain the associated features of each image to be processed in the image pair to be processed.
[0127] Among them, the flat image feature can be a feature obtained by flattening the image feature corresponding to the image to be processed, and the initial attention feature can be understood as a feature used to characterize the correlation relationship between each feature in the image feature corresponding to the image to be processed and other features.
[0128] There are many ways to flatten the image features. For example, a flattening layer can be used to flatten the image features to flatten the image features with a dimension of w / 2×h / 2×256 to obtain a one-dimensional flat image feature corresponding to the image to be processed.
[0129] After the image feature is flattened, the flat image feature can be feature extracted to obtain the initial attention feature corresponding to the image to be processed. There are many ways to extract the feature of the flat image feature. For example, the flat image feature can include multiple sub-flat image features. The flat image feature can be feature extracted to obtain the initial association feature corresponding to each sub-flat image feature in the flat image feature. Based on the initial association feature, the initial association weight corresponding to each sub-flat image feature in the flat image feature is determined. According to the initial association weight, each sub-flat image feature in the flat image feature is fused to obtain the initial attention feature corresponding to the image to be processed.
[0130] The sub-flat image feature may be at least one feature in the flat image feature. For example, the flat image feature may be divided into a plurality of regions, and the feature corresponding to each region is a sub-flat image feature. The initial association feature may be feature information characterizing the association relationship between each sub-flat image feature and other sub-flat image features in the flat image feature. The initial association weight may be the importance of each sub-flat image feature in the flat image feature.
[0131] There are many ways to extract features from the flat image feature and obtain initial associated features corresponding to each sub-flat image feature in the flat image feature. For example, an attention network (Attention) can be used to extract features from the flat image feature to obtain initial associated features corresponding to each sub-flat image feature in the flat image feature. For example, each flat image feature can be converted into a three-dimensional spatial vector, including a query vector (Query, abbreviated as Q), a key vector (Key, abbreviated as K) and a value vector (Value, abbreviated as V). The specific conversion method can be understood as the fusion of each flat image feature with the three-dimensional conversion parameters, and the query vector, key vector and value vector are used as the initial associated features corresponding to each flat image feature.
[0132] After extracting features from the flat image feature and obtaining the initial association features corresponding to each sub-flat image feature in the flat image feature, the initial association weight corresponding to each sub-flat image feature in the flat image feature can be determined based on the initial association features. There can be multiple ways to determine the initial association weight corresponding to each sub-flat image feature in the flat image feature based on the initial association features. For example, an attention network can be used to perform dot product between the query vector corresponding to each sub-flat image feature in the flat image feature and the key vectors of other sub-flat image features to obtain the attention score (Score) corresponding to each sub-flat image feature. Then, based on the attention score corresponding to each sub-flat image feature, the initial association weight corresponding to each sub-flat image feature can be calculated.
[0133] Among them, in addition to using the attention network to extract the features of the flat image feature and obtaining the initial correlation features corresponding to each sub-flat image feature in the flat image feature, and then determining the initial correlation weights corresponding to each sub-flat image feature in the flat image feature based on the initial correlation features, other networks that can capture the correlation relationship between each sub-flat image feature and other sub-flat image features, and then determine the weight of each sub-flat image feature in the flat image feature, can also be used.
[0134] After determining the initial association weight corresponding to each sub-flat image feature in the flat image feature based on the initial association feature, each sub-flat image feature in the flat image feature can be fused according to the initial association weight. There are multiple ways to fuse each sub-flat image feature in the flat image feature according to the initial association weight. For example, each sub-flat image feature in the flat image feature can be weighted based on the initial association weight, and the weighted sub-flat image features can be accumulated. The initial attention feature corresponding to the image to be processed can be obtained according to the accumulation result. For example, suppose that the image pair to be processed includes image A to be processed and image B to be processed, wherein the flat image feature corresponding to image A to be processed includes four sub-flat image features, namely G, B, C and D, and the initial association weights corresponding to each sub-flat image feature are determined, namely g, b, c and d, and then each sub-flat image feature in the flat image feature can be weighted based on the initial association weight to obtain Gg, Bb, Cc and Dd, so that the weighted sub-flat image features can be accumulated to obtain the accumulated result of Gg+Bb+Cc+Dd. According to the accumulated result, the initial attention feature corresponding to the image to be processed can be obtained as Gg+Bb+Cc+Dd.
[0135] In one embodiment, please refer to Figure 3b , the flattened image features can be input into the encoding module (TransformerEncoder) to obtain the initial attention features corresponding to the image to be processed. Optional, please refer to Figure 4a , Figure 4a : is a schematic diagram of an image processing model structure of an image processing method provided by an embodiment of the present application, wherein, assuming that the image pair to be processed includes the images to be processed Ia and Ib, taking the initial attention feature corresponding to the image to be processed Ia as an example, the flat image feature corresponding to the image to be processed Ia can be The input is then fed into the self-attention submodule of the Transformer Encoder module on the left side of the figure to obtain the initial attention features corresponding to the image to be processed. Specifically, the flat image features corresponding to the image to be processed Ia can be The image is converted into a spatial vector of three dimensions K, Q and V, and is input into the self-attention submodule of the Transformer Encoder module. In the self-attention submodule, the flat image feature is extracted by a multi-head attention unit to obtain the initial association weight corresponding to each sub-flat image feature in the flat image feature. Each sub-flat image feature in the flat image feature is weighted and merged according to the initial association weight to obtain the output of the multi-head attention unit. Then, the output of the multi-head attention unit and the flat image feature can be combined by a merging unit (Concat). The merged results can be normalized by the normalization unit (Layer Normalization), so that the normalized results can be fully connected by the feedforward network subunit (Feed Forward) in the feedforward network and the residual connection unit (FeedForward&Add), and the fully connected results and the merged results can be residually connected by the residual connection subunit (Add) in the feedforward network and the residual connection unit to obtain the initial attention features corresponding to the image Ia to be processed.
[0136] After extracting the features of the flat image to obtain the initial attention features corresponding to the image to be processed, the initial attention features can be cross-featured to obtain the associated features of each image to be processed in the image pair to be processed. There are many ways to perform cross-feature extraction on the initial attention features. For example, the image features and the initial attention features can be cross-featured to obtain the cross-correlation features corresponding to each image to be processed. According to the cross-correlation features, the cross-correlation weight corresponding to the image to be processed is determined. Based on the cross-correlation weight, the initial attention features corresponding to each image to be processed are weighted to obtain the associated features corresponding to the image to be processed.
[0137] Among them, the cross-correlation feature can be a feature that characterizes the correlation relationship between the images to be processed in the image pair to be processed, the cross-correlation weight can be a feature that characterizes the degree of correlation between the images to be processed in the image pair to be processed, and the image feature can be an image feature after flattening, that is, a flat image feature.
[0138] There are many ways to perform cross-feature extraction on the image feature and the initial attention feature to obtain the cross-correlation features corresponding to each image to be processed. For example, an attention network can be used to perform cross-feature extraction on the image feature and the initial attention feature. For example, the initial attention feature corresponding to a certain image to be processed can be converted into a query vector, and the image feature of another image to be processed (the image feature can be converted into a flat image feature) can be converted into a key vector and a value vector. The specific conversion method can be understood as the fusion of the image feature and the initial attention feature with the conversion parameters of the corresponding dimension, and the corresponding query vector, key vector and value vector are used as the cross-correlation features corresponding to each image feature.
[0139] After cross-feature extraction is performed on the image feature and the initial attention feature to obtain the cross-correlation feature corresponding to each image to be processed, the cross-correlation weight corresponding to the image to be processed can be determined based on the cross-correlation feature. There can be multiple ways to determine the cross-correlation weight corresponding to the image to be processed based on the cross-correlation feature. For example, an attention network can be used to perform dot product between the query vector corresponding to the initial attention feature corresponding to a certain image to be processed in the image pair to be processed and the key vectors of the image features corresponding to other images to be processed. The attention scores of the image feature corresponding to a certain image to be processed in the image pair to be processed and the corresponding initial attention feature can be obtained respectively, and then the cross-correlation weight of each image feature and the corresponding initial attention feature can be calculated based on the attention score.
[0140] After determining the cross-correlation weight corresponding to the image to be processed according to the cross-correlation feature, the initial attention feature corresponding to each image to be processed can be weighted based on the cross-correlation weight to obtain the correlation feature corresponding to the image to be processed. There are multiple ways to weight the initial attention feature corresponding to each image to be processed based on the cross-correlation weight. For example, assuming that the image pair to be processed includes image A to be processed and image B to be processed, taking the correlation feature corresponding to image A to be processed as an example, assuming that the initial attention feature corresponding to image A to be processed is E, and the image feature corresponding to image B to be processed is And the cross-correlation weight corresponding to the initial attention feature E is determined to be e, and the image feature The corresponding cross-correlation weight is f, and then the initial attention feature E and image feature can be calculated based on the cross-correlation weight: To obtain the associated features, for example, the initial attention feature E and the image feature can be fused based on the cross-correlation weight Weighted and summed, the associated features are obtained as
[0141] In one embodiment, please refer to Figure 4a , where it is assumed that the image pair to be processed includes the images to be processed Ia and Ib, taking the associated features corresponding to the image to be processed Ia as an example, the flat image features corresponding to the image to be processed Ia can be The initial attention features corresponding to the image to be processed are input into the self-attention submodule of the Transformer Encoder module on the left side of the figure to obtain the initial attention features corresponding to the image to be processed, and the initial attention features are input into the cross-attention submodule of the Transformer Encoder module. Specifically, the initial attention features corresponding to the image to be processed Ia can be converted into a query vector Q, and the flattened image features corresponding to the image to be processed Ib can be converted into a query vector Q. The key vector K and the value vector V are converted into a key vector K and a value vector V, which can then be input into the multi-head attention unit of the cross-attention submodule. The multi-head attention unit performs cross-feature extraction on the image feature and the initial attention feature to obtain the cross-correlation feature corresponding to each image to be processed. According to the cross-correlation feature, the cross-correlation weight corresponding to the image to be processed is determined. Based on the cross-correlation weight, the initial attention feature corresponding to the image to be processed Ia and the flattened image feature corresponding to the image to be processed Ib are extracted. Weighted and merged processing is performed to obtain the output of the multi-head attention unit, and then the output of the multi-head attention unit and the initial attention features corresponding to the image to be processed Ia can be merged through the merging unit, and the merged result can be normalized through the normalization unit, so that the normalized result can be fully connected through the feedforward network and the feedforward network subunit in the residual connection unit, and the fully connected result and the merged result can be residually connected through the residual connection subunit in the feedforward network and the residual connection unit to obtain the associated features corresponding to the image to be processed Ia.
[0142] Similarly, the method of obtaining the associated features corresponding to the image to be processed Ia can be used to obtain the associated features corresponding to the image to be processed Ib, which will not be described in detail here.
[0143] 103. According to the associated features, the co-viewing images in the co-viewing area are identified in the image to be processed, and the scale difference between the co-viewing images is calculated.
[0144] The co-viewed image may be an image in each of the images to be processed that corresponds to a co-viewing region between the images to be processed, and the scale difference may be a value representing the scale difference between the co-viewed images in a pair of images to be processed.
[0145] Among them, there can be multiple ways to identify the common vision image in the common vision area in the image to be processed based on the associated features. For example, a preset area feature can be obtained, and the trained image processing model can be used to perform feature extraction on the preset area feature to obtain the initial area feature. The initial area feature and the associated feature can be cross-feature extracted to obtain the common vision area feature corresponding to the initial area feature. Based on the common vision area feature and the associated feature, the common vision image in the common vision area is identified in the image to be processed.
[0146] The preset region feature may be a pre-set feature information of a bounding box used to characterize the common view region, which may be understood as an abstract expression of the pre-learned information of the bounding box for detecting the common view region. The preset region feature may be a 256-dimensional feature vector (Q∈R 1×256 ). The initial region feature may be feature information obtained by fusing the correlation between each feature in the preset region feature, and the common view region feature may be feature information representing the bounding box corresponding to the common view region in the image to be processed. The trained image processing model may be a trained model for processing the image to be processed in the image pair to be processed, and may be a Transformer model. The specific structure of the trained image processing model may refer to Figure 4a Schematic diagram of the structure of the image processing model provided in .
[0147] There are many ways to obtain preset regional features. For example, they can be designed and input in advance by developers, or they can be automatically generated directly based on pre-acquired regional feature templates, etc., which are not limited here.
[0148] After obtaining the preset regional features, the trained image processing model can be used to extract features from the preset regional features to obtain the initial regional features. There are multiple ways to extract features from the preset regional features using the trained image processing model. For example, the preset regional features can include multiple regional sub-features. The trained image processing model can be used to extract features from the preset regional features to obtain regional association features corresponding to each regional sub-feature in the preset regional features. Based on the regional association features, the regional association weight corresponding to each regional sub-feature in the preset regional features is determined. According to the regional association weight, each regional sub-feature in the preset regional features is fused to obtain the initial regional features.
[0149] The regional sub-feature may be at least one feature in the preset regional features. For example, the preset regional features may be divided into a plurality of regions, and the feature corresponding to each region is the regional sub-feature. The regional association feature may be feature information characterizing the association relationship between each regional sub-feature in the preset regional features and other regional sub-features. The regional association weight may be a representation of the importance of each regional sub-feature in the preset regional features in the preset regional features.
[0150] Among them, there are many ways to use the trained image processing model to extract features from the preset region features, and obtain the region association features corresponding to each region sub-feature in the preset region features. For example, an attention network can be used to extract features from the preset region features to obtain the region association features corresponding to each region sub-feature in the preset region features. For example, each region sub-feature can be converted into a three-dimensional spatial vector, including a query vector, a key vector and a value vector. The specific conversion method can be understood as the result of fusing each region sub-feature with the three-dimensional conversion parameters, and using the query vector, key vector and value vector as the region association features corresponding to each region sub-feature.
[0151] After the trained image processing model is used to extract features of the preset regional feature and the regional association features corresponding to each regional sub-feature in the preset regional feature are obtained, the regional association weight corresponding to each regional sub-feature in the preset regional feature can be determined based on the regional association features. There can be multiple ways to determine the regional association weight corresponding to each regional sub-feature in the preset regional feature based on the regional association features. For example, an attention network can be used to perform dot product between the query vector corresponding to each regional sub-feature in the preset regional feature and the key vectors of other regional sub-features to obtain the attention score corresponding to each regional sub-feature, and then the regional association weight corresponding to each regional sub-feature can be calculated based on the attention score corresponding to each regional sub-feature.
[0152] After determining the regional association weight corresponding to each regional sub-feature in the preset regional feature based on the regional association feature, each regional sub-feature in the preset regional feature can be fused according to the regional association weight. There are multiple ways to fuse each regional sub-feature in the preset regional feature according to the regional association weight. For example, each regional sub-feature in the preset regional feature can be weighted based on the regional association weight, and the weighted regional sub-features can be accumulated. The initial regional feature corresponding to the preset regional feature can be obtained according to the accumulated result.
[0153] In one embodiment, please continue to refer to Figure 4a, the feature extraction of the preset region feature can be performed through the decoding module (Transformer Decoder) in the trained image processing model on the right side of the figure to obtain the region association feature corresponding to each region sub-feature in the preset region feature. Specifically, assuming that the image pair to be processed includes the images to be processed Ia and Ib, taking the acquisition of the regional association features corresponding to the image to be processed Ia as an example, the preset regional features (SingleQuery) can be converted into spatial vectors of three dimensions K, Q and V, and input into the normalization unit of the Transformer Decoder module for normalization processing, and the three normalized spatial vectors K, Q and V are input into the multi-head self-attention unit (Multi-head Self-Attention), and the preset regional features are extracted by the multi-head self-attention unit to obtain the regional association features corresponding to each regional sub-feature in the preset regional features, and based on the regional association features, the regional association weights corresponding to each regional sub-feature in the preset regional features are determined, and then each regional sub-feature in the preset regional features is weighted according to the regional association weights, so that the weighted results are input into the regularization and residual connection unit (Dropout&Add) for feature fusion to obtain the initial regional features corresponding to the image to be processed Ia.
[0154] After the pre-trained image processing model is used to extract the features of the preset region and obtain the initial region features, cross-feature extraction can be performed on the initial region features and the associated features. There can be multiple ways to perform cross-feature extraction on the initial region features and the associated features. For example, feature extraction can be performed on the initial region features and the associated features to obtain image associated features corresponding to the associated features and initial region associated features corresponding to the initial region features. The image association weight corresponding to the associated features is determined based on the image association features and the initial region association features. Based on the image association weight, the associated features are weighted to obtain common view image features, and the common view image features and the initial region features are fused to obtain common view region features.
[0155] Among them, the image association feature can be feature information representing the association relationship between the association feature and the initial region feature in the association feature corresponding to the image to be processed, the initial region association feature can be feature information representing the association relationship between the association feature and the initial region feature in the initial region feature corresponding to the image to be processed, the image association weight can be the degree of association between the association feature and the initial region feature, and the co-viewing image feature can be feature information representing the association relationship between the association feature and the initial region feature.
[0156] There are many ways to extract features from the initial region feature and the associated feature to obtain image associated features corresponding to the associated features and initial region associated features corresponding to the initial region feature. For example, an attention network can be used to extract features from the initial region feature and the associated feature. For example, the initial region feature corresponding to a certain image to be processed can be converted into a query vector, and the corresponding associated feature can be converted into a key vector and a value vector. The specific conversion method can be understood as fusing the initial region feature and the associated feature with the conversion parameters of the corresponding dimensions, using the corresponding query vector as the initial region associated feature corresponding to the initial region feature, and using the corresponding key vector and value vector as the image associated feature corresponding to the associated feature.
[0157] After extracting features from the initial region feature and the associated feature to obtain image associated features corresponding to the associated features and initial region associated features corresponding to the initial region features, the image associated weight corresponding to the associated feature can be determined based on the image associated features and the initial region associated features. There can be multiple ways to determine the image associated weight corresponding to the associated feature based on the image associated features and the initial region associated features. For example, an attention network can be used to perform a dot product between a query vector of an image associated feature corresponding to the associated feature and a key vector of an initial region associated feature corresponding to the initial region feature. The attention score of each feature in the associated feature can be obtained respectively, and then based on the attention score, the image associated weight of the associated feature corresponding to the image to be processed can be calculated.
[0158] After determining the image association weight corresponding to the association feature according to the image association feature and the initial region association feature, the association feature can be weighted based on the image association weight. There are multiple ways to weight the association feature based on the image association weight. For example, the value vector in the image association feature corresponding to the association feature can be weighted according to the image association weight, and the weighted value vector can be fused to obtain the co-viewing image feature.
[0159] After weighting the associated features based on the image association weights, the common view image features and the initial region features can be fused to obtain the common view region features. There are many ways to fuse the common view image features and the initial region features. For example, please refer to Figure 4a, where it is assumed that the image pair to be processed includes the images to be processed Ia and Ib, and taking the common view region feature corresponding to the image to be processed Ia as an example, the associated feature fa corresponding to the image to be processed Ia can be input into the Transformer Decoder module on the right side of the figure to obtain the common view region feature corresponding to the image to be processed Ia. Specifically, the initial region feature and the associated feature can be extracted. For example, the initial region feature corresponding to the image to be processed Ia and the corresponding preset region feature can be weighted, and the weighted result can be converted into a query vector Q, that is, the initial region associated feature, and the associated feature fa corresponding to the image to be processed Ia can be converted into a value vector V, and the associated feature fa can be transmitted through the position encoding module (Positional Encoding) performs position encoding, and converts the position encoding result corresponding to fa into a key vector K. Based on the value vector V and the key vector K, the image association feature corresponding to the association feature can be obtained, and then the image association feature and the initial region association feature can be normalized by the normalization unit, and the normalization result is input into the multi-head attention unit. The multi-head attention unit determines the image association weight corresponding to the association feature according to the image association feature and the initial region association feature. Based on the image association weight, the association feature is weighted to obtain the co-viewing image feature to obtain the output of the multi-head attention unit, and then the image association feature and the initial region association feature can be normalized by the normalization unit. The output of the multi-head attention unit can be regularized through the regularization and residual connection unit, and then the regularization processing result and the initial area feature can be residually connected. Then, the residual connection processing result can be normalized through the normalization unit, and then the normalization processing result can be fully connected through the feedforward network and the feedforward network subunit in the residual connection unit, and the fully connected processing result and the residual connection processing result in the regularization and residual connection unit can be residually connected through the residual connection subunit in the feedforward network and the residual connection unit to obtain the common view area feature qa corresponding to the image to be processed Ia.
[0160] Similarly, the method of acquiring the common view area feature corresponding to the image to be processed Ia can be used to acquire the common view area feature corresponding to the image to be processed Ib, which will not be described in detail here.
[0161] After cross-feature extraction of the initial area feature and the associated feature, the common view image in the common view area can be identified in the image to be processed based on the common view area feature and the associated feature. There can be multiple ways to identify the common view image in the common view area in the image to be processed based on the common view area feature and the associated feature. For example, the common view weight corresponding to the associated feature can be calculated based on the common view area feature and the associated feature, and the focus center coordinates can be determined in the image to be processed based on the common view weight and the associated feature. The common view area feature is regressed to obtain the relative center point offset corresponding to the common view area, and the common view image in the common view area is identified in the image to be processed based on the focus center coordinates and the relative center point offset.
[0162] Among them, the common view weight (Attention Map) can represent the importance of the features at each position in the associated features in the associated features, the attention center coordinates (Centerness) can be the coordinates of the center with higher importance in the common view area determined based on the common view weight, which can be understood as the attention center of the common view area, and the relative center point offset can be the offset distance of the attention center coordinates relative to the bounding box of the common view area. According to the attention center coordinates and the corresponding relative center point offset, a rectangular box can be determined, that is, the common view area can be determined.
[0163] There are multiple ways to calculate the common view weight corresponding to the associated feature based on the common view area feature and the associated feature. For example, the common view area feature and the associated feature corresponding to the image to be processed can be subjected to a dot product operation (also known as a scalar product) to obtain the common view weight according to the operation result. Optionally, the common view weight can be expressed as
[0164] A=dot(Q,F)∈R h×w
[0165] Among them, A represents the common view weight corresponding to the image to be processed, dot() represents the dot product operation function, Q represents the association feature, F represents the common view area feature, R represents the dimension, h represents the length of the common view weight distribution, and w represents the width of the common view weight distribution.
[0166] After calculating the common vision weight corresponding to the associated feature based on the common vision area feature and the associated feature, the focus center coordinates can be determined in the image to be processed according to the common vision weight and the associated feature. There are multiple ways to determine the focus center coordinates in the image to be processed according to the common vision weight and the associated feature. For example, the focus weight of each preset coordinate point in the common vision area can be calculated according to the common vision weight and the associated feature, and the preset coordinate point can be weighted based on the focus weight to obtain the weighted coordinate point, and the weighted coordinate point can be accumulated to obtain the focus center coordinates in the image to be processed.
[0167] Among them, the attention weight can characterize the degree of attention to each preset coordinate point in the common vision area, which can be understood as the probability of characterizing each preset coordinate point in the common vision area being the geometric center point of the common vision area. The preset coordinate point can be a coordinate point in a preset relative coordinate diagram. For example, an image with a size of w*h can be divided into multiple 1*1 coordinate grids (Grid), and then a relative coordinate diagram can be obtained. The coordinates of each Grid in the relative coordinate diagram are the coordinates of the preset coordinate point, and the weighted coordinate point can be a coordinate point weighted based on the attention weight.
[0168] There are many ways to calculate the attention weight of each preset coordinate point in the common view area according to the common view weight and the associated feature. For example, please continue to refer to Figure 3b , the attention weight of each preset coordinate point in the common vision area can be calculated through the feature fusion module and the weighted sum attention center module (WS-Centerness) to obtain the attention center coordinates of the common vision area. Specifically, the associated features can be converted into the form of feature maps, so that the common vision weight and the associated features can be cross-multiplied, that is, A×F, and the result of the cross multiplication operation is residually connected with the associated features to obtain the residual connection processing result A×F+F, and then the residual connection processing result A×F+F is convolved through a fully convolutional network (Fully Convolution Network, FCN) to generate a common vision area probability map P, that is, the probability distribution of the center coordinates Pc(x, y) in the common vision area, which can be used to characterize the attention weight corresponding to each preset coordinate point in the common vision area, wherein the common vision area probability map P can be expressed as
[0169] P = softmax(conv 3×3 (A×F+F)
[0170] Among them, × represents the cross multiplication operation, + represents the residual connection processing, softmax() represents the logistic regression function, conv 3×3 It can represent a convolution process with a convolution kernel size of 3×3.
[0171] After calculating the attention weight of each preset coordinate point in the common vision area according to the common vision weight and the associated feature, the preset coordinate point can be weighted based on the attention weight to obtain the weighted coordinate point, and the weighted coordinate point can be accumulated to obtain the attention center coordinates in the image to be processed. There are many ways to perform weighted summation on the preset coordinate points based on the attention weight. For example, the center coordinate probability distribution Pc (x, y) in the common vision area and the corresponding preset coordinate point in the relative coordinate map can be weighted and summed to obtain the attention center coordinates of the common vision area, which can be expressed as
[0172]
[0173] in, represents the horizontal coordinate in the center of attention coordinates, represents the ordinate in the center of attention coordinates, H represents the length of the image to be processed, W represents the width of the image to be processed, x represents the abscissa in the relative coordinate diagram, y represents the ordinate in the relative coordinate diagram, and ∑ represents the summation symbol.
[0174] After determining the focus center coordinates in the image to be processed according to the common view weight and the associated features, the common view area features can be regressed to obtain the relative center point offset corresponding to the common view area. There are many ways to regress the common view area features. For example, please continue to refer to Figure 3b , the common view area feature can be regressed through the common view box regression module (Box Regression). Specifically, it can be assumed that the common view area feature can be a 256-dimensional vector, and the common view area feature can be fully connected through the fully connected layer, and then the result of the fully connected processing can be activated by the activation function (linear rectification function, ReLU function), so that the activation result can be fully connected through the fully connected layer to obtain the 4-dimensional vector corresponding to the common view area feature, and then the normalized 4-dimensional center point offset (L, T, M, J) can be obtained through the activation function (Sigmoid). Finally, L and M are multiplied by the width W of the image to be processed, and T and J are multiplied by the image length H to obtain the relative center point offset (l, t, m, j). For example, please refer to Figure 4b , Figure 4b This is a schematic diagram of the focus center coordinates and relative center point offset of an image processing method provided in an embodiment of the present application.
[0175] After the common vision area feature is regressed, the common vision image in the common vision area can be identified in the image to be processed according to the focus center coordinates and the relative center point offset. There are multiple ways to identify the common vision image in the common vision area in the image to be processed according to the focus center coordinates and the relative center point offset. For example, the geometric center coordinates and boundary size information of the common vision area in the image to be processed can be calculated according to the focus center coordinates and the relative center point offset. Based on the geometric center coordinates and the boundary size information, the common vision area of the image to be processed is determined in the image to be processed, and the common vision area is segmented in the image to be processed to obtain the common vision image in the common vision area.
[0176] The geometric center coordinates may be coordinates of the geometric center of the rectangular frame corresponding to the common viewing area, and the boundary size information may be information including the size of the side length of the rectangular frame corresponding to the common viewing area.
[0177] There are many ways to calculate the geometric center coordinates and boundary size information of the common viewing area in the image to be processed according to the focus center coordinates and the relative center point offset. For example, please continue to refer to Figure 4b , assuming that the coordinates of the center of attention are (x c ,y c ), the relative center point offset (l, t, m, j), and assuming that j is greater than t, m is greater than l, and the common view area is located in the first quadrant of the relative coordinate diagram, the horizontal coordinate of the geometric center coordinate can be calculated as [(l+m) / 2]-l+x c , the ordinate of the geometric center coordinate can be calculated as [(t+j) / 2]+y c -j, that is, the geometric center coordinates are ([(l+m) / 2]-l+x c , [(t+j) / 2]+y c -j), the boundary size information of the rectangular frame corresponding to the common viewing area can be calculated as a length of t+j and a width of l+m.
[0178] In one embodiment, the image processing model may be trained to obtain a trained image processing model. There may be multiple ways to train the image processing model. For example, please continue to refer to Figure 3b , the image processing model can be trained by symmetric center consistency loss. Specifically, an image sample pair can be obtained, and a preset image processing model can be used to predict the common view area of each image sample in the image sample pair to obtain the predicted common view area. The preset image processing model is converged according to the labeled common view area and the predicted common view area to obtain the trained image processing model.
[0179] Among them, the image sample pair can be an image pair sample for training a preset image processing model, the image sample pair can include an image pair with annotated common view areas, the image pair with annotated common view areas contains image samples annotated with annotated common view areas, the preset image processing model can be a pre-designed image processing model that has not yet been trained, the predicted common view area can be the common view area corresponding to the image sample predicted by the preset image processing model based on the input image sample pair, and the annotated common view area can be a pre-annotated common view area corresponding to the image sample.
[0180] Among them, there can be multiple ways to converge the preset image processing model based on the annotated common view area and the predicted common view area. For example, the predicted geometric center coordinates and predicted boundary size information corresponding to the predicted common view area can be extracted in the predicted common view area, and the annotated geometric center coordinates and annotated boundary size information corresponding to the annotated common view area can be extracted in the annotated common view area. Based on the predicted geometric center coordinates, the predicted boundary size information, the annotated geometric center coordinates and the annotated boundary size information, the preset image processing model is converged to obtain a trained image processing model.
[0181] Among them, the predicted geometric center coordinates can be the coordinates of the geometric center of the rectangular box corresponding to the predicted common view area, the predicted boundary size information can be information including the size of the side length of the rectangular box corresponding to the predicted common view area, the marked geometric center coordinates can be the coordinates of the geometric center of the rectangular box corresponding to the marked common view area, and the marked boundary size information can be information including the size of the side length of the rectangular box corresponding to the marked common view area.
[0182] Among them, there can be multiple ways to extract the predicted geometric center coordinates and predicted boundary size information corresponding to the predicted common view area in the predicted common view area. For example, the predicted attention center coordinates and the predicted center point offset corresponding to the predicted common view area can be extracted in the predicted common view area, and the predicted geometric center coordinates and predicted boundary size information corresponding to the predicted common view area can be determined based on the predicted attention center coordinates and the predicted center point offset.
[0183] Among them, the predicted attention center coordinates can be the coordinates of the center with higher importance in the predicted common vision area, which can be understood as the attention center of the predicted common vision area, and the predicted center point offset can be the offset distance of the predicted attention center coordinates relative to the bounding box of the predicted common vision area.
[0184] In the predicted common view area, after extracting the predicted geometric center coordinates and predicted boundary size information corresponding to the predicted common view area, the preset image processing model can be converged according to the predicted geometric center coordinates, the predicted boundary size information, the annotated geometric center coordinates and the annotated boundary size information to obtain a trained image processing model. There are multiple ways to converge the preset image processing model according to the predicted geometric center coordinates, the predicted boundary size information, the annotated geometric center coordinates and the annotated boundary size information. For example, the cycle consistency loss information corresponding to the preset image processing model can be calculated based on the predicted geometric center coordinates and the annotated geometric center coordinates, and the boundary loss information and the mean absolute error loss information corresponding to the preset image processing model can be calculated based on the predicted geometric center coordinates and the predicted boundary size information, and the annotated geometric center coordinates and the annotated boundary size information. The cycle consistency loss information, the mean absolute error loss information and the boundary loss information are used as the loss information corresponding to the preset image processing model, and the preset image processing model is converged according to the loss information to obtain a trained image processing model.
[0185] Among them, the cycle consistency loss information can be the loss information of the preset image processing model determined based on the cycle consistency loss function (cycleconsistency loss), which is used to prevent the samples generated by the two generators from contradicting each other. The mean absolute error loss information can be the loss information determined based on the regression loss function (L1 Loss), which is used to measure the average error size in a set of predicted values. The boundary loss information can be the loss information determined based on the boundary loss function (Generalized Intersection over Union), which is used to determine the loss function of the gap between the bounding box of the predicted common view area and the bounding box of the annotated common view area.
[0186] There are multiple ways to calculate the cycle consistency loss information corresponding to the preset image processing model based on the predicted geometric center coordinates and the annotated geometric center coordinates. For example, the cycle consistency loss information can be expressed as
[0187]
[0188] Among them, L loc represents the cycle consistency loss information, and |||| represents the norm symbol, where the norm is a function with the concept of "length". In linear algebra, functional analysis and related mathematical fields, the norm is a function that gives all vectors in the vector space a non-zero positive length or size. ||||1 represents the 1-norm, c i Indicates the coordinates of the annotation geometric center. The center point coordinates obtained after exchanging the associated features between the input image pairs to be processed in the preset image processing model.
[0189] There are multiple ways to calculate the boundary loss information and the mean absolute error loss information corresponding to the preset image processing model based on the predicted geometric center coordinates and the predicted boundary size information, as well as the annotated geometric center coordinates and the annotated boundary size information. For example, the mean absolute error loss information can be expressed as
[0190]
[0191] Among them, L L1 represents the mean absolute error loss information, b i Indicates the normalized annotation common view area corresponding to the annotation geometric center coordinates and annotation boundary size information, represents the predicted geometric center coordinates and predicted boundary size information corresponding to the normalized predicted common view area, b i ∈[0,1] 4 .
[0192] The boundary loss information can be expressed as
[0193]
[0194] Among them, L giou Represents boundary loss information, represents the boundary loss function, b i Indicates the normalized annotation common view area corresponding to the annotation geometric center coordinates and annotation boundary size information, Represents the predicted geometric center coordinates and predicted boundary size information corresponding to the normalized predicted common view area.
[0195] In this way, the cycle consistency loss information, the mean absolute error loss information and the boundary loss information are used as the loss information corresponding to the preset image processing model. Optionally, the loss information corresponding to the preset image processing model can be expressed as
[0196]
[0197] in, Represents the loss information corresponding to the preset image processing model, represents the loss information between the predicted geometric center coordinates and the labeled geometric center coordinates, λ con is its corresponding hyperparameter, λ loc ,λ iou and λ L1 They are the hyperparameters corresponding to the cycle consistency loss information, boundary loss information and mean absolute error loss information respectively.
[0198] Optionally, two V100 graphics cards may be used to train a preset image processing model by reproducing 35 generations (i.e., 35 epochs) of training on a dataset (Megadepth), for example, for 48 hours.
[0199] In this way, the preset image processing model can be trained based on the loss information corresponding to the preset image processing model. When the loss information converges, that is, the preset image processing model meets the convergence condition, the trained image processing model can be obtained based on the preset image processing model that meets the convergence condition.
[0200] After the co-viewing images of the co-viewing area are identified in the image to be processed according to the associated features, the scale difference between the co-viewing images can be calculated. There are many ways to calculate the scale difference between the co-viewing images. For example, the size information of the co-viewing images corresponding to each of the images to be processed can be obtained, and at least one size difference between the images to be processed can be calculated based on the size information. A target size difference that meets a preset condition is screened out from the size differences, and the target size difference is used as the scale difference between the co-viewing images.
[0201] The size information may be information including the size of the co-visual image corresponding to each image to be processed, for example, may include size information such as the length and width of the co-visual image. The size difference may be a value representing the difference between the size information of the images to be processed, and the target size difference may be a size difference selected from the size differences as a scale difference.
[0202] There may be many ways to calculate at least one size difference between the images to be processed based on the size information. For example, the ratio between the width and the length of each co-viewing image may be calculated to obtain at least one size difference between the co-viewing images. For example, assuming that the image pair to be processed includes images Ia and Ib to be processed, the co-viewing image corresponding to the image Ia to be processed is Ia', and the size information corresponding to the co-viewing image Ia' is a length of ha and a width of wa, and the co-viewing image corresponding to the image Ib to be processed is Ib', and the size information corresponding to the co-viewing image Ib' is a length of hb and a width of wb. Then, four size differences may be obtained, namely ha / hb, hb / ha, wa / wb, and wb / wa.
[0203] After at least one size difference between the images to be processed is calculated based on the size information, a target size difference that meets a preset condition can be screened out from the size differences. There are many ways to filter out the target size difference that meets the preset conditions from the size difference. For example, the size difference with the largest value can be filtered out from the size difference to serve as the target size difference. For example, assuming that the image pair to be processed includes images Ia and Ib to be processed, the co-viewing image corresponding to the image Ia to be processed is Ia', and the size information corresponding to the co-viewing image Ia' is length ha and width wa, and the co-viewing image corresponding to the image Ib to be processed is Ib', and the size information corresponding to the co-viewing image Ib' is length hb and width wb. Then, four size differences can be obtained, namely (ha / hb, hb / ha, wa / wb, wb / wa), and the target size difference can be S(Ia', Ib') = max(ha / hb, hb / ha, wa / wb, wb / wa), wherein max() can be expressed as a function that takes the maximum value, so that the maximum size difference can be used as the scale difference between the co-viewing images.
[0204] 104. Based on the scale difference, the size of the common view image is adjusted to obtain an adjusted common view image.
[0205] The adjusted co-viewing image may be a co-viewing image obtained by adjusting the scale difference between the co-viewing images.
[0206] In order to improve the accuracy of feature point extraction and matching between common view images, the size of each common view image based on the scale difference can be adjusted so that feature point extraction and matching and other processing can be performed in the common view images of the same scale. There are many ways to adjust the size of the common view images based on the scale difference. For example, the original length and original width of the common view image can be obtained, and the original length and original width of the common view image can be multiplied by the scale difference respectively to obtain the adjusted scale and adjusted width, so that the common view image can be scaled based on the adjusted scale and adjusted width to adjust the size of the common view image to obtain the adjusted common view image.
[0207] 105. Extract at least one common view feature point from each adjusted common view image, and process the image pair to be processed based on the common view feature point.
[0208] The common view feature point may be a feature point extracted from the adjusted common view image.
[0209] There are many ways to extract at least one common view feature point in each adjusted common view image. For example, feature point extraction methods such as corner detection algorithm (FAST algorithm), scale-invariant feature transform (SIFT), and accelerated robust feature algorithm (SURF) can be used to extract at least one common view feature point in each adjusted common view image.
[0210] After extracting at least one common view feature point from each adjusted common view image, the image pair to be processed can be processed based on the common view feature point. There are multiple ways to process the image pair to be processed based on the common view feature point. For example, feature point matching can be performed on the common view feature points of each image to be processed in the adjusted common view image to obtain matched common view feature points. Based on the scale difference and the size information of the adjusted common view image, the source feature points corresponding to the matched common view feature points are determined in the image to be processed, and the image pair to be processed is processed based on the source feature points.
[0211] Among them, the matched common view feature point can be a common view feature point in an adjusted common view image of a certain image to be processed that matches the common view feature point in other adjusted common view images, and the source feature point can be a corresponding feature point in the image to be processed corresponding to the matched common view feature point.
[0212] There are many ways to match the feature points of the common view feature points of each image to be processed in the pair of images to be processed in the adjusted common view image. For example, a distance matching method (Brute-FroceMatcher) can be used to calculate the distance between a certain common view feature point descriptor and all the common view feature point descriptors in other adjusted common view images, and then the obtained distances are sorted, and the common view feature point with the closest distance is taken as the matching point to obtain the matched common view feature points.
[0213] After feature point matching is performed on the common view feature points of each image to be processed in the adjusted common view image in the pair of images to be processed, the source feature points corresponding to the matched common view feature points can be determined in the image to be processed based on the scale difference and the size information of the adjusted common view image. There can be multiple ways to determine the source feature points corresponding to the matched common view feature points in the image to be processed based on the scale difference and the size information of the adjusted common view image. For example, pose estimation of the adjusted common view image can be performed based on the matched common view feature points in the adjusted common view image to obtain adjusted pose information corresponding to the adjusted common view image, so that the original pose information corresponding to the image to be processed can be calculated based on the adjusted pose information, the scale difference and the size information of the adjusted common view image, so that the positions of the matched common view feature points in the adjusted common view image can be inversely transformed to the image to be processed based on the original pose information, so that the source feature points corresponding to the matched common view feature points can be determined in the image to be processed.
[0214] Optionally, a random sampling consensus algorithm (RANdom SAmple Consensus, referred to as RANSAC) can be used to estimate the pose of the adjusted common view image based on the matched common view feature points in the adjusted common view image. The RANSAC algorithm is an algorithm that estimates the parameters of a model in an iterative manner in a data set containing outliers.
[0215] After determining the source feature point corresponding to the matched common view feature point in the image to be processed based on the scale difference and the size information of the common view image, the image pair to be processed can be processed based on the source feature point. There can be many ways to process the image pair to be processed based on the source feature point. For example, feature points in the image to be processed can be extracted, matched, and located. The image to be processed can also be further applied on this basis. For example, data positioning can be performed in a virtual map application, etc., which is not limited here.
[0216] With the rapid development of Internet technology, image processing has become more and more diverse. For example, in the application scenario of large-scale scene reconstruction (Structure from Motion, SFM for short), two corresponding local feature points between two images of the same scene that are imaged at different viewing angles are matched. In the existing image processing methods, most of them extract and match each feature point in the two images step by step by estimating the area with the same scale of feature points in the two images. However, this method only estimates the area with the same scale of feature points in the two images. When the scale difference between the two images is large, the existing image processing method cannot accurately extract and match the feature points, resulting in poor accuracy of image processing. In addition, the existing image processing method matches the feature points step by step at a single point, resulting in a slow rate of processing the feature points in the image, thereby resulting in a low rate of image processing. Therefore, the efficiency of image processing in the prior art is low.
[0217] To this end, the present application embodiment provides an image processing method, please refer to Figure 5 , Figure 5 It is a schematic diagram of the overall process of an image processing method provided by an embodiment of the present application. In the first stage, the common view area of the two input images to be processed is regressed through the image processing model provided by the embodiment of the present application to obtain the location of the corresponding area, and the common view image is segmented. In the second stage, the common view image is scale-aligned at the image level, and feature points are extracted and matched on the common view image adjusted after scale alignment. On the one hand, it can ensure that the feature points are extracted on an image of one scale, which can reduce the difficulty of feature point extraction and matching and improve the efficiency of feature point extraction and matching. On the other hand, matching feature points in the common view area can effectively improve the external point filtering effect, improve the accuracy of feature point matching, and at the same time improve the rate of feature point matching. In the third stage, by calculating the original posture information corresponding to the image to be processed, the position of the matched common view feature point in the adjusted common view image can be inversely transformed to the image to be processed according to the original posture information, so that the source feature point corresponding to the matched common view feature point can be determined in the image to be processed. Therefore, the image processing method provided in the embodiment of the present application can effectively handle feature extraction, matching and positioning in cases with large scale differences. It is denser than the existing feature extraction and matching algorithm, and is suitable for tasks such as image registration, large-scale scene reconstruction, simultaneous localization and mapping (SLAM) and visual positioning. It can improve the accuracy and rate of image processing, thereby improving image processing efficiency.
[0218] As can be seen from the above, the embodiment of the present application obtains the image features of the image to be processed by acquiring the image pair to be processed, and extracting the image features of the image to be processed in the image pair to be processed; extracting the associated features of the image pair to be processed from the image features; identifying the common view image of the common view area in the image to be processed based on the associated features, and calculating the scale difference between the common view images; adjusting the size of the common view image based on the scale difference to obtain the adjusted common view image; extracting at least one common view feature point in each adjusted common view image, and processing the image pair to be processed based on the common view feature points. In this way, by extracting the associated features representing the mutual information between the images to be processed from the image features, and identifying the common view image of the common view area between the two images to be processed in the image to be processed based on the associated features, the common view feature points in the common view area are quickly extracted and matched based on the common view images, thereby improving the rate and accuracy of feature point matching, thereby improving the accuracy and speed of image processing, and thus improving the image processing efficiency.
[0219] According to the method described in the above embodiment, the following is further described in detail with examples.
[0220] In this embodiment, the image processing device is specifically integrated into a computer device as an example for description. The image processing method is specifically described with a server as the execution subject. For details, please refer to Figure 5 , Figure 5 A schematic diagram of a specific process of an image processing method provided in an embodiment of the present application.
[0221] For a better description of the embodiments of this application, please refer to Figure 6 .like Figure 6 As shown, Figure 6 This is another flowchart of the image processing method provided in the embodiment of the present application. The specific process is as follows:
[0222] In step 201, the server obtains an image sample pair, and uses a preset image processing model to predict the common view area of each image sample in the image sample pair to obtain a predicted common view area. In the predicted common view area, the predicted attention center coordinates and the predicted center point offset corresponding to the predicted common view area are extracted, and the predicted geometric center coordinates and predicted boundary size information corresponding to the predicted common view area are determined based on the predicted attention center coordinates and the predicted center point offset.
[0223] Among them, the image sample pair can be an image pair sample for training a preset image processing model, the image sample pair can include an image pair with annotated common view areas, the image pair with annotated common view areas contains image samples annotated with annotated common view areas, the preset image processing model can be a pre-designed image processing model that has not been trained, the predicted common view area can be the common view area corresponding to the image sample predicted by the preset image processing model based on the input image sample pair, and the annotated common view area can be the pre-annotated common view area corresponding to the image sample. The predicted attention center coordinates can be the coordinates of the center with a higher degree of importance in the predicted common view area, which can be understood as the attention center of the predicted common view area, and the predicted center point offset can be the offset distance of the predicted attention center coordinates relative to the bounding box of the predicted common view area.
[0224] In step 202, the server extracts the labeled geometric center coordinates and labeled boundary size information corresponding to the labeled common view area in the labeled common view area, calculates the cycle consistency loss information corresponding to the preset image processing model based on the predicted geometric center coordinates and the labeled geometric center coordinates, and calculates the boundary loss information and the mean absolute error loss information corresponding to the preset image processing model based on the predicted geometric center coordinates and the predicted boundary size information, as well as the labeled geometric center coordinates and the labeled boundary size information.
[0225] Among them, the cycle consistency loss information can be the loss information of the preset image processing model determined based on the cycle consistency loss function, which is used to prevent the samples generated by the two generators from contradicting each other. That is, it is required that the image in the X domain should be as consistent as possible with the original image after being mapped to the Y domain and then mapped back to the X domain. Vice versa, the Y domain image mapped from the Y domain to the X domain and then mapped back should also be consistent with the original image. The mean absolute error loss information can be the loss information determined based on the regression loss function, which is used to measure the average error size in a set of predicted values. The boundary loss information can be the loss information determined based on the boundary loss function, which is used to determine the loss function of the gap between the bounding box of the predicted common view area and the bounding box of the annotated common view area.
[0226] There are multiple ways for the server to calculate the cycle consistency loss information corresponding to the preset image processing model based on the predicted geometric center coordinates and the marked geometric center coordinates. For example, the cycle consistency loss information can be expressed as
[0227]
[0228] Among them, L locrepresents the cycle consistency loss information, and |||| represents the norm symbol, where the norm is a function with the concept of "length". In linear algebra, functional analysis and related mathematical fields, the norm is a function that gives all vectors in the vector space a non-zero positive length or size. ||||1 represents the 1-norm, c i Indicates the coordinates of the annotation geometric center. The center point coordinates obtained after exchanging the associated features between the input image pairs to be processed in the preset image processing model.
[0229] There are multiple ways for the server to calculate the boundary loss information and the mean absolute error loss information corresponding to the preset image processing model based on the predicted geometric center coordinates and the predicted boundary size information, as well as the annotated geometric center coordinates and the annotated boundary size information. For example, the mean absolute error loss information can be expressed as
[0230]
[0231] Among them, L L1 represents the mean absolute error loss information, b i Indicates the normalized annotation common view area corresponding to the annotation geometric center coordinates and annotation boundary size information, represents the predicted geometric center coordinates and predicted boundary size information corresponding to the normalized predicted common view area, b i ∈[0,1] 4 .
[0232] The boundary loss information can be expressed as
[0233]
[0234] Among them, L giou Represents boundary loss information, represents the boundary loss function, b i Indicates the normalized annotation common view area corresponding to the annotation geometric center coordinates and annotation boundary size information, Represents the predicted geometric center coordinates and predicted boundary size information corresponding to the normalized predicted common view area.
[0235] In step 203, the server uses the cycle consistency loss information, the mean absolute error loss information and the boundary loss information as the loss information corresponding to the preset image processing model, and converges the preset image processing model according to the loss information to obtain a trained image processing model.
[0236] In this way, the server can use the cycle consistency loss information, the mean absolute error loss information, and the boundary loss information as the loss information corresponding to the preset image processing model. Optionally, the loss information corresponding to the preset image processing model can be expressed as
[0237]
[0238] in, Represents the loss information corresponding to the preset image processing model, represents the loss information between the predicted geometric center coordinates and the labeled geometric center coordinates, λ con is its corresponding hyperparameter, λ loc ,λ iou and λ L1 They are the hyperparameters corresponding to the cycle consistency loss information, boundary loss information and mean absolute error loss information respectively.
[0239] In this way, the preset image processing model can be trained based on the loss information corresponding to the preset image processing model. When the loss information converges, that is, the preset image processing model meets the convergence condition, the trained image processing model can be obtained based on the preset image processing model that meets the convergence condition.
[0240] Optionally, two V100 graphics cards may be used to train a preset image processing model by reproducing 35 generations (i.e., 35 epochs) of training on a dataset (Megadepth), for example, for 48 hours.
[0241] In step 204, the server obtains a pair of images to be processed, performs feature mapping on the image to be processed in the pair of images to be processed to obtain a feature map corresponding to the image to be processed, performs dimensionality reduction processing on the feature map corresponding to the image to be processed to obtain a feature map after dimensionality reduction, performs multi-scale feature extraction on the feature map after dimensionality reduction to obtain scale image features corresponding to the image to be processed at each scale, and fuses the scale image features corresponding to the image to be processed at each scale to obtain image features of the image to be processed.
[0242] There are many ways for the server to obtain the image pair to be processed, for example, it can be obtained from a memory connected to the image processing device, or from other data storage terminals. It can also be obtained from the memory of a physical terminal, or from a virtual storage space such as a data set or corpus, which is not limited here.
[0243] After obtaining the image pair to be processed, the server can perform feature mapping on the image to be processed in the image pair to be processed. There can be multiple ways for the server to perform feature mapping on the image to be processed in the image pair to be processed. For example, the server can use a convolution kernel to perform convolution processing on the image to be processed to map the features of the image to be processed into a feature mapping layer to obtain a feature map corresponding to the image to be processed.
[0244] In order to reduce the amount of model calculation and control the size of the model, after the feature mapping of the image to be processed in the image pair to be processed is performed, the feature map corresponding to the image to be processed can be reduced in dimension. There are many ways for the server to reduce the dimension of the feature map corresponding to the image to be processed. For example, the feature map corresponding to the image to be processed can be convolved at the channel level to obtain a feature map after dimension reduction. For example, please refer to Figure 3a , assuming that the dimension of the feature map corresponding to the image to be processed is w×h×1024, where w represents the width of the image to be processed, h represents the length of the image to be processed, and 1024 represents the number of channels corresponding to the feature map. The feature map corresponding to the image to be processed can be convolved to reduce the number of channels from 1024 to 256, and the dimension of the feature map after dimensionality reduction is w×h×256.
[0245] After the feature map corresponding to the image to be processed is reduced in dimension, multi-scale feature extraction can be performed on the reduced feature map. There are many ways for the server to extract multi-scale features from the reduced feature map. For example, convolution kernels of different sizes can be used to convolve the reduced feature map to obtain scale image features of multiple scales, that is, the scale image features corresponding to each scale of the image to be processed can be obtained. For example, please continue to refer to Figure 3a , k represents the convolution kernel size, s represents the step size of the convolution, so that the convolution kernel size of 4×4 and the step size of 2×2 can be used to convolve the reduced dimension feature map, and the scale image feature with the dimension of w / 2×h / 2×256 corresponding to the scale can be obtained. At the same time, the convolution kernel size of 8×8 and the step size of 2×2 can be used to convolve the reduced dimension feature map, and the scale image feature with the dimension of w / 2×h / 2×128 corresponding to the scale can be obtained. The convolution kernel size of 16×16 and the step size of 2×2 can also be used to convolve the reduced dimension feature map, and the scale image feature with the dimension of w / 2×h / 2×128 corresponding to the scale can be obtained. The scale image features corresponding to these three scales can be spliced to obtain a multi-scale image feature with a dimension of w / 2×h / 2×512.
[0246] After performing multi-scale feature extraction on the feature map after dimensionality reduction, the scale image features corresponding to each scale of the image to be processed can be fused. There are many ways for the server to fuse the scale image features corresponding to each scale of the image to be processed. For example, please continue to refer to Figure 3a , the scale image features corresponding to each scale can be fused at the channel level to obtain the image features with a dimension of w / 2×h / 2×256 corresponding to the image to be processed.
[0247] In one embodiment, please refer to Figure 3b It can be assumed that the image pair to be processed includes the images to be processed Ia and Ib, with a length of H and a width of W (i.e., H×W). The images to be processed Ia and Ib are downsampled through the residual network (Resnet50). For example, the server can use Resnet50-Layer3 (i.e., the third layer structure in Resnet50) to downsample the feature maps of the images to be processed Ia and Ib by 8 times, and the number of channels can be 1024, so that the dimension corresponding to the feature map after dimensionality reduction can be W / 16×H / 16×256, so that the feature maps corresponding to the images to be processed Ia and Ib after dimensionality reduction can be respectively input into the multi-scale feature extraction module (Multi-Scale Feature Extractor) for multi-scale feature extraction and fusion, and the image features corresponding to the images to be processed Ia and Ib with a dimension of W / 32×H / 32×256 can be obtained.
[0248] In step 205, the server flattens the image feature to obtain the flat image feature of the image to be processed, performs feature extraction on the flat image feature to obtain the initial association feature corresponding to each sub-flat image feature in the flat image feature, determines the initial association weight corresponding to each sub-flat image feature in the flat image feature based on the initial association weight, fuses each sub-flat image feature in the flat image feature according to the initial association weight, and obtains the initial attention feature corresponding to the image to be processed.
[0249] Among them, the server can have multiple ways to flatten the image features. For example, a flattening layer can be used to flatten the image features to flatten the image features with a dimension of w / 2×h / 2×256 to obtain a one-dimensional flat image feature corresponding to the image to be processed.
[0250] After the image feature is flattened, the flat image feature can be feature extracted to obtain the initial associated features corresponding to each sub-flat image feature in the flat image feature. There are many ways for the server to extract the features of the flat image feature. For example, an attention network can be used to extract the features of the flat image feature to obtain the initial associated features corresponding to each sub-flat image feature in the flat image feature. For example, each flat image feature can be converted into a three-dimensional spatial vector, including a query vector, a key vector and a value vector. The specific conversion method can be understood as the fusion of each flat image feature with the three-dimensional conversion parameters, and the query vector, key vector and value vector are used as the initial associated features corresponding to each flat image feature.
[0251] After extracting features from the flat image feature and obtaining the initial association features corresponding to each sub-flat image feature in the flat image feature, the initial association weight corresponding to each sub-flat image feature in the flat image feature can be determined based on the initial association features. There can be multiple ways to determine the initial association weight corresponding to each sub-flat image feature in the flat image feature based on the initial association features. For example, an attention network can be used to perform dot product between the query vector corresponding to each sub-flat image feature in the flat image feature and the key vectors of other sub-flat image features to obtain the attention score (Score) corresponding to each sub-flat image feature. Then, based on the attention score corresponding to each sub-flat image feature, the initial association weight corresponding to each sub-flat image feature can be calculated.
[0252] Among them, in addition to using the attention network to extract the features of the flat image feature and obtaining the initial correlation features corresponding to each sub-flat image feature in the flat image feature, and then determining the initial correlation weights corresponding to each sub-flat image feature in the flat image feature based on the initial correlation features, other networks that can capture the correlation relationship between each sub-flat image feature and other sub-flat image features, and then determine the weight of each sub-flat image feature in the flat image feature, can also be used.
[0253] After determining the initial association weight corresponding to each sub-flat image feature in the flat image feature based on the initial association feature, each sub-flat image feature in the flat image feature can be fused according to the initial association weight. There are multiple ways for the server to fuse each sub-flat image feature in the flat image feature according to the initial association weight. For example, each sub-flat image feature in the flat image feature can be weighted based on the initial association weight, and the weighted sub-flat image features can be accumulated. The initial attention feature corresponding to the image to be processed can be obtained according to the accumulation result. For example, suppose that the image pair to be processed includes image A to be processed and image B to be processed, wherein the flat image feature corresponding to image A to be processed includes four sub-flat image features, namely G, B, C and D, and the initial association weights corresponding to each sub-flat image feature are determined, namely g, b, c and d, and then each sub-flat image feature in the flat image feature can be weighted based on the initial association weight to obtain Gg, Bb, Cc and Dd, so that the weighted sub-flat image features can be accumulated to obtain the accumulated result of Gg+Bb+Cc+Dd. According to the accumulated result, the initial attention feature corresponding to the image to be processed can be obtained as Gg+Bb+Cc+Dd.
[0254] In one embodiment, please refer to Figure 3b , the server can input the flattened image features into the encoding module to obtain the initial attention features corresponding to the image to be processed. Optional, please refer to Figure 4a , Figure 4a : is a schematic diagram of an image processing model structure of an image processing method provided by an embodiment of the present application, wherein, assuming that the image pair to be processed includes images to be processed Ia and Ib, taking the initial attention feature corresponding to the image to be processed Ia as an example, the server can obtain the flat image feature corresponding to the image to be processed Ia The input is then fed into the self-attention submodule of the Transformer Encoder module on the left side of the figure to obtain the initial attention features corresponding to the image to be processed. Specifically, the flat image features corresponding to the image to be processed Ia can be The image is converted into a spatial vector of three dimensions K, Q and V, and is input into the self-attention submodule of the Transformer Encoder module. In the self-attention submodule, the flat image feature is extracted by a multi-head attention unit to obtain the initial association weight corresponding to each sub-flat image feature in the flat image feature. Each sub-flat image feature in the flat image feature is weighted and merged according to the initial association weight to obtain the output of the multi-head attention unit. Then, the output of the multi-head attention unit and the flat image feature can be combined by the merging unit. The merged images are normalized by a normalization unit, so that the normalized image can be fully connected by a feedforward network subunit in a feedforward network and a residual connection unit, and the fully connected image and the merged image are residually connected by a residual connection subunit in a feedforward network and a residual connection unit to obtain the initial attention feature corresponding to the image to be processed Ia.
[0255] In step 206, the server performs cross-feature extraction on the image feature and the initial attention feature to obtain a cross-correlation feature corresponding to each image to be processed, determines a cross-correlation weight corresponding to the image to be processed based on the cross-correlation feature, and weights each initial attention feature corresponding to the image to be processed based on the cross-correlation weight to obtain a correlation feature corresponding to the image to be processed.
[0256] Among them, the server performs cross-feature extraction on the image feature and the initial attention feature, and there can be multiple ways to obtain the cross-correlation features corresponding to each of the images to be processed. For example, the server can use an attention network to perform cross-feature extraction on the image feature and the initial attention feature. For example, the initial attention feature corresponding to a certain image to be processed can be converted into a query vector, and the image feature of another image to be processed (the image feature can be converted into a flat image feature) can be converted into a key vector and a value vector. The specific conversion method can be understood as the fusion of the image feature and the initial attention feature with the conversion parameters of the corresponding dimension, and the corresponding query vector, key vector and value vector are used as the cross-correlation features corresponding to each image feature.
[0257] After the server performs cross-feature extraction on the image feature and the initial attention feature to obtain the cross-correlation feature corresponding to each image to be processed, the server can determine the cross-correlation weight corresponding to the image to be processed based on the cross-correlation feature. There are many ways for the server to determine the cross-correlation weight corresponding to the image to be processed based on the cross-correlation feature. For example, the server can use an attention network to perform a dot product between the query vector corresponding to the initial attention feature corresponding to a certain image to be processed in the image pair to be processed and the key vector of the image feature corresponding to other images to be processed, so as to obtain the attention scores of the image feature corresponding to a certain image to be processed in the image pair to be processed and the corresponding initial attention feature, respectively, and then calculate the cross-correlation weight of each image feature and the corresponding initial attention feature based on the attention score.
[0258] After determining the cross-correlation weight corresponding to the image to be processed according to the cross-correlation feature, the initial attention feature corresponding to each image to be processed can be weighted based on the cross-correlation weight to obtain the correlation feature corresponding to the image to be processed. There are multiple ways for the server to weight the initial attention feature corresponding to each image to be processed based on the cross-correlation weight. For example, assuming that the image pair to be processed includes image A to be processed and image B to be processed, taking the correlation feature corresponding to image A to be processed as an example, assuming that the initial attention feature corresponding to image A to be processed is E, and the image feature corresponding to image B to be processed is And the cross-correlation weight corresponding to the initial attention feature E is determined to be e, and the image feature The corresponding cross-correlation weight is f, and then the initial attention feature E and image feature can be calculated based on the cross-correlation weight: To obtain the associated features, for example, the initial attention feature E and the image feature can be fused based on the cross-correlation weight After weighting and summing, the associated features are obtained as
[0259] In one embodiment, please refer to Figure 4a , where it is assumed that the image pair to be processed includes the images to be processed Ia and Ib, and taking the associated features corresponding to the image to be processed Ia as an example, the server may obtain the flat image features corresponding to the image to be processed Ia The initial attention features corresponding to the image to be processed are input into the self-attention submodule of the Transformer Encoder module on the left side of the figure to obtain the initial attention features corresponding to the image to be processed, and the initial attention features are input into the cross-attention submodule of the Transformer Encoder module. Specifically, the initial attention features corresponding to the image to be processed Ia can be converted into a query vector Q, and the flattened image features corresponding to the image to be processed Ib can be converted into a query vector Q. The key vector K and the value vector V are converted into a key vector K and a value vector V, which can then be input into the multi-head attention unit of the cross-attention submodule. The multi-head attention unit performs cross-feature extraction on the image feature and the initial attention feature to obtain the cross-correlation feature corresponding to each image to be processed. According to the cross-correlation feature, the cross-correlation weight corresponding to the image to be processed is determined. Based on the cross-correlation weight, the initial attention feature corresponding to the image to be processed Ia and the flattened image feature corresponding to the image to be processed Ib are extracted. Weighted and merged processing is performed to obtain the output of the multi-head attention unit, and then the output of the multi-head attention unit and the initial attention features corresponding to the image to be processed Ia can be merged through the merging unit, and the merged result can be normalized through the normalization unit, so that the normalized result can be fully connected through the feedforward network and the feedforward network subunit in the residual connection unit, and the fully connected result and the merged result can be residually connected through the residual connection subunit in the feedforward network and the residual connection unit to obtain the associated features corresponding to the image to be processed Ia.
[0260] Similarly, the server may adopt the method of acquiring the associated features corresponding to the image to be processed Ia to acquire the associated features corresponding to the image to be processed Ib, which will not be elaborated here.
[0261] In step 207, the server obtains a preset region feature, uses a trained image processing model to perform feature extraction on the preset region feature, obtains a region association feature corresponding to each region sub-feature in the preset region feature, determines a region association weight corresponding to each region sub-feature in the preset region feature based on the region association feature, and fuses each region sub-feature in the preset region feature according to the region association weight to obtain an initial region feature.
[0262] There are many ways for the server to obtain preset regional features. For example, the server may design and input the features in advance by a developer, or the server may automatically generate the features based on a pre-acquired regional feature template, etc., which are not limited here.
[0263] Among them, the server uses the trained image processing model to extract features from the preset area features, and there can be multiple ways to obtain the area-related features corresponding to each area sub-feature in the preset area features. For example, the server can use an attention network to extract features from the preset area features to obtain the area-related features corresponding to each area sub-feature in the preset area features. For example, each area sub-feature can be converted into a three-dimensional spatial vector, including a query vector, a key vector and a value vector. The specific conversion method can be understood as the result of fusing each area sub-feature with the three-dimensional conversion parameters, and using the query vector, key vector and value vector as the area-related features corresponding to each area sub-feature.
[0264] After the pre-trained image processing model is used to extract features of the preset regional feature and the regional association features corresponding to each regional sub-feature in the preset regional feature are obtained, the regional association weight corresponding to each regional sub-feature in the preset regional feature can be determined based on the regional association features. There can be multiple ways for the server to determine the regional association weight corresponding to each regional sub-feature in the preset regional feature based on the regional association features. For example, an attention network can be used to perform dot product between the query vector corresponding to each regional sub-feature in the preset regional feature and the key vectors of other regional sub-features to obtain the attention score corresponding to each regional sub-feature, and then the regional association weight corresponding to each regional sub-feature can be calculated based on the attention score corresponding to each regional sub-feature.
[0265] After determining the regional association weight corresponding to each regional sub-feature in the preset regional feature based on the regional association feature, each regional sub-feature in the preset regional feature can be fused according to the regional association weight. There are multiple ways for the server to fuse each regional sub-feature in the preset regional feature according to the regional association weight. For example, each regional sub-feature in the preset regional feature can be weighted based on the regional association weight, and the weighted regional sub-features can be accumulated. The initial regional feature corresponding to the preset regional feature can be obtained according to the accumulated result.
[0266] In one embodiment, please continue to refer to Figure 4a , the server can extract features from the preset regional features through the decoding module in the trained image processing model on the right side of the figure, and obtain the regional association features corresponding to each regional sub-feature in the preset regional features. Specifically, assuming that the image pair to be processed includes the images to be processed Ia and Ib, taking the regional association features corresponding to the image to be processed Ia as an example, the server can convert the preset regional features into spatial vectors of three dimensions K, Q and V, and input them into the normalization unit of the Transformer Decoder module for normalization processing, and input the three normalized spatial vectors K, Q and V into the multi-head self-attention unit, and extract features from the preset regional features through the multi-head self-attention unit to obtain the regional association features corresponding to each regional sub-feature in the preset regional features, and based on the regional association features, determine the regional association weights corresponding to each regional sub-feature in the preset regional features, and then weight each regional sub-feature in the preset regional features according to the regional association weights, so as to input the weighted results into the regularization and residual connection unit for feature fusion to obtain the initial regional features corresponding to the image to be processed Ia.
[0267] In step 208, the server performs feature extraction on the initial region feature and the associated feature to obtain an image associated feature corresponding to the associated feature and an initial region associated feature corresponding to the initial region feature, determines an image associated weight corresponding to the associated feature based on the image associated feature and the initial region associated feature, weights the associated feature based on the image associated weight to obtain a common view image feature, and fuses the common view image feature with the initial region feature to obtain a common view region feature.
[0268] There are many ways for the server to perform feature extraction on the initial region feature and the associated feature to obtain the image associated feature corresponding to the associated feature and the initial region associated feature corresponding to the initial region feature. For example, the server can use an attention network to extract the initial region feature and the associated feature. For example, the server can convert the initial region feature corresponding to a certain image to be processed into a query vector, and convert the corresponding associated feature into a key vector and a value vector. The specific conversion method can be understood as fusing the initial region feature and the associated feature with the conversion parameters of the corresponding dimension, taking the corresponding query vector as the initial region associated feature corresponding to the initial region feature, and taking the corresponding key vector and value vector as the image associated feature corresponding to the associated feature.
[0269] After the server performs feature extraction on the initial region feature and the associated feature to obtain the image associated feature corresponding to the associated feature and the initial region associated feature corresponding to the initial region feature, the server can determine the image associated weight corresponding to the associated feature based on the image associated feature and the initial region associated feature. There can be multiple ways for the server to determine the image associated weight corresponding to the associated feature based on the image associated feature and the initial region associated feature. For example, the server can use an attention network to perform a dot product of a query vector of an image associated feature corresponding to the associated feature and a key vector of an initial region associated feature corresponding to the initial region feature, and can obtain the attention score of each feature in the associated feature, and then calculate the image associated weight of the associated feature corresponding to the image to be processed based on the attention score.
[0270] After the server determines the image association weight corresponding to the association feature according to the image association feature and the initial region association feature, it can weight the association feature based on the image association weight. There are multiple ways for the server to weight the association feature based on the image association weight. For example, the server can weight the value vector in the image association feature corresponding to the association feature according to the image association weight, and fuse the weighted value vector to obtain the co-viewing image feature.
[0271] After weighting the associated features based on the image association weight, the common view image features and the initial region features can be fused to obtain the common view region features. There are many ways for the server to fuse the common view image features and the initial region features. For example, please refer to Figure 4a , wherein, assuming that the image pair to be processed includes the images to be processed Ia and Ib, taking the common view region feature corresponding to the image to be processed Ia as an example, the server can input the associated feature fa corresponding to the image to be processed Ia into the Transformer Decoder module on the right side of the figure to obtain the common view region feature corresponding to the image to be processed Ia. Specifically, the initial region feature and the associated feature can be extracted. For example, the initial region feature corresponding to the image to be processed Ia and the corresponding preset region feature can be weighted, and the weighted result can be converted into a query vector Q, that is, the initial region associated feature, and the associated feature fa corresponding to the image to be processed Ia is converted into a value vector V, and the associated feature fa is position-encoded through a position encoding module, and the position encoding result corresponding to fa is converted into a key vector K. Based on the value vector V and the key vector K, the image associated feature corresponding to the associated feature can be obtained, and then the image associated feature and the initial region associated feature can be normalized by a normalization unit, and the normalized result is input into a multi-head attention unit, and the multi-head attention unit is used to obtain the image associated feature according to the image. The image association weight corresponding to the association feature is determined by the joint feature and the initial region association feature. Based on the image association weight, the association feature is weighted to obtain the common view image feature to obtain the output of the multi-head attention unit, and then the output of the multi-head attention unit can be regularized by the regularization and residual connection unit, and then the regularization processing result and the initial region feature can be residually connected, and then the residual connection processing result can be normalized by the normalization unit, and then the normalization processing result can be fully connected by the feedforward network and the feedforward network subunit in the residual connection unit, and the fully connected processing result and the residual connection processing result in the regularization and residual connection unit are residually connected by the residual connection subunit in the feedforward network and the residual connection unit to obtain the common view region feature qa corresponding to the image to be processed Ia.
[0272] Similarly, the server may adopt the method of acquiring the common viewing area features corresponding to the image to be processed Ia to acquire the common viewing area features corresponding to the image to be processed Ib, which will not be elaborated here.
[0273] In step 209, the server calculates the common view weight corresponding to the associated feature based on the common view area feature and the associated feature, calculates the attention weight of each preset coordinate point in the common view area according to the common view weight and the common view image feature, weights the preset coordinate point based on the attention weight to obtain the weighted coordinate point, accumulates the weighted coordinate point to obtain the attention center coordinates in the image to be processed.
[0274] There are multiple ways for the server to calculate the common view weight corresponding to the associated feature based on the common view area feature and the associated feature. For example, the server can perform a dot product operation (also known as a scalar product) on the common view area feature and the associated feature corresponding to the image to be processed to obtain the common view weight according to the operation result. Optionally, the common view weight can be expressed as
[0275] A=dot(Q,F)∈R h×w
[0276] Among them, A represents the common view weight corresponding to the image to be processed, dot() represents the dot product operation function, Q represents the association feature, F represents the common view area feature, R represents the dimension, h represents the length of the common view weight distribution, and w represents the width of the common view weight distribution.
[0277] After calculating the common view weight corresponding to the associated feature based on the common view area feature and the associated feature, the focus center coordinates can be determined in the image to be processed based on the common view weight and the associated feature. There are multiple ways for the server to determine the focus center coordinates in the image to be processed based on the common view weight and the associated feature. For example, the server can calculate the focus weight of each preset coordinate point in the common view area based on the common view weight and the associated feature, weight the preset coordinate point based on the focus weight to obtain the weighted coordinate point, and accumulate the weighted coordinate point to obtain the focus center coordinates in the image to be processed.
[0278] Among them, the attention weight can characterize the degree of attention to each preset coordinate point in the common vision area, which can be understood as the probability of characterizing each preset coordinate point in the common vision area being the geometric center point of the common vision area. The preset coordinate point can be a coordinate point in a preset relative coordinate diagram. For example, an image with a size of w*h can be divided into multiple 1*1 coordinate grids (Grid), and then a relative coordinate diagram can be obtained. The coordinates of each Grid in the relative coordinate diagram are the coordinates of the preset coordinate point, and the weighted coordinate point can be a coordinate point weighted based on the attention weight.
[0279] There are many ways for the server to calculate the attention weight of each preset coordinate point in the common view area according to the common view weight and the associated feature. For example, please continue to refer to Figure 3b, the attention weight of each preset coordinate point in the common vision area can be calculated through the feature fusion module and the weighted sum attention center module (WS-Centerness) to obtain the attention center coordinates of the common vision area. Specifically, the associated features can be converted into the form of feature maps, so that the common vision weight and the associated features can be cross-multiplied, that is, A×F, and the result of the cross multiplication operation is residually connected with the associated features to obtain the residual connection processing result A×F+F, and then the residual connection processing result A×F+F is convolved through a fully convolutional network to generate a common vision area probability map P, that is, the probability distribution of the center coordinates Pc(x, y) in the common vision area, which can be used to characterize the attention weight corresponding to each preset coordinate point in the common vision area, wherein the common vision area probability map P can be expressed as
[0280] P = softmax(conv 3×3 (A×F+F)
[0281] Among them, × represents the cross multiplication operation, + represents the residual connection processing, softmax() represents the logistic regression function, conv 3×3 It can represent a convolution process with a convolution kernel size of 3×3.
[0282] After calculating the attention weight of each preset coordinate point in the common vision area according to the common vision weight and the associated feature, the preset coordinate point can be weighted based on the attention weight to obtain the weighted coordinate point, and the weighted coordinate point can be accumulated to obtain the attention center coordinates in the image to be processed. Among them, the server can perform weighted summation of the preset coordinate points based on the attention weight in multiple ways. For example, the center coordinate probability distribution Pc (x, y) in the common vision area can be weighted and summed with the corresponding preset coordinate point in the relative coordinate map to obtain the attention center coordinates of the common vision area, which can be expressed as
[0283]
[0284] in, represents the horizontal coordinate in the center of attention coordinates, represents the ordinate in the center of attention coordinates, H represents the length of the image to be processed, W represents the width of the image to be processed, x represents the abscissa in the relative coordinate diagram, y represents the ordinate in the relative coordinate diagram, and ∑ represents the summation symbol.
[0285] In step 210, the server performs regression processing on the common view area feature to obtain the relative center point offset corresponding to the common view area, calculates the geometric center coordinates and boundary size information of the common view area in the image to be processed according to the focus center coordinates and the relative center point offset, determines the common view area of the image to be processed in the image to be processed based on the geometric center coordinates and the boundary size information, segments the common view area in the image to be processed, and obtains the common view image in the common view area.
[0286] After determining the focus center coordinates in the image to be processed according to the common view weight and the associated features, the common view area features can be regressed to obtain the relative center point offset corresponding to the common view area. There are many ways to regress the common view area features. For example, please continue to refer to Figure 3b , the common view area feature can be regressed through the common view frame regression module. Specifically, it can be assumed that the common view area feature can be a 256-dimensional vector, and the common view area feature can be fully connected through the fully connected layer, and then the result of the fully connected processing can be activated by the activation function (linear rectification function, ReLU function), so that the activation result can be fully connected through the fully connected layer to obtain the 4-dimensional vector corresponding to the common view area feature, and then the normalized 4-dimensional center point offset (L, T, M, J) can be obtained through the activation function (Sigmoid). Finally, L and M are multiplied by the width W of the image to be processed, and T and J are multiplied by the image length H to obtain the relative center point offset (l, t, m, j). For example, please refer to Figure 4b .
[0287] There are many ways for the server to calculate the geometric center coordinates and boundary size information of the common view area in the image to be processed according to the focus center coordinates and the relative center point offset. For example, please continue to refer to Figure 4b , assuming that the coordinates of the center of attention are (x c ,y c ), the relative center point offset (l, t, m, j), and assuming that j is greater than t, m is greater than l, and the common view area is located in the first quadrant of the relative coordinate diagram, the horizontal coordinate of the geometric center coordinate can be calculated as [(l+m) / 2]-l+x c , the ordinate of the geometric center coordinate can be calculated as [(t+j) / 2]+y c -j, that is, the geometric center coordinates are ([(l+m) / 2]-l+x c , [(t+j) / 2]+y c -j), the boundary size information of the rectangular frame corresponding to the common viewing area can be calculated as a length of t+j and a width of l+m.
[0288] In step 211, the server obtains the size information of the co-viewing image corresponding to each of the images to be processed, calculates at least one size difference between the images to be processed based on the size information, selects a target size difference that meets a preset condition from the size differences, and uses the target size difference as the scale difference between the co-viewing images, and adjusts the size of the co-viewing image based on the scale difference to obtain an adjusted co-viewing image.
[0289] There may be multiple ways for the server to calculate at least one size difference between the images to be processed based on the size information. For example, the server may calculate the ratio between the width and length of each co-viewing image to obtain at least one size difference between the co-viewing images. For example, assuming that the image pair to be processed includes images Ia and Ib to be processed, the co-viewing image corresponding to the image Ia to be processed is Ia', and the size information corresponding to the co-viewing image Ia' is length ha and width wa, and the co-viewing image corresponding to the image Ib to be processed is Ib', and the size information corresponding to the co-viewing image Ib' is length hb and width wb. Then, four size differences may be obtained, namely ha / hb, hb / ha, wa / wb, and wb / wa.
[0290] After at least one size difference between the images to be processed is calculated based on the size information, a target size difference that meets a preset condition can be screened out from the size differences. There are many ways for the server to filter out the target size difference that meets the preset conditions from the size difference. For example, the size difference with the largest value can be filtered out from the size difference to serve as the target size difference. For example, assuming that the image pair to be processed includes images Ia and Ib to be processed, the co-viewing image corresponding to the image Ia to be processed is Ia', and the size information corresponding to the co-viewing image Ia' is length ha and width wa, and the co-viewing image corresponding to the image Ib to be processed is Ib', and the size information corresponding to the co-viewing image Ib' is length hb and width wb. Then, four size differences can be obtained, namely (ha / hb, hb / ha, wa / wb, wb / wa), and the target size difference can be S(Ia', Ib') = max(ha / hb, hb / ha, wa / wb, wb / wa), wherein max() can be expressed as a function that takes the maximum value, so that the maximum size difference can be used as the scale difference between the co-viewing images.
[0291] In order to improve the accuracy of feature point extraction and matching between co-viewing images, the server can adjust the size of each co-viewing image based on the scale difference, so that feature point extraction and matching and other processing can be performed in the co-viewing images of the same scale. There are many ways for the server to adjust the size of the co-viewing images based on the scale difference. For example, the server can obtain the original length and original width of the co-viewing image, and multiply the original length and original width of the co-viewing image by the scale difference respectively to obtain the adjusted scale and adjusted width, so that the co-viewing image can be scaled based on the adjusted scale and adjusted width to adjust the size of the co-viewing image to obtain the adjusted co-viewing image.
[0292] In step 212, the server extracts at least one common view feature point from each of the adjusted common view images, performs feature point matching on the common view feature points of each of the images to be processed in the adjusted common view image to obtain matched common view feature points, determines source feature points corresponding to the matched common view feature points in the images to be processed based on the scale difference and the size information of the adjusted common view image, and processes the image pair to be processed based on the source feature points.
[0293] There are many ways for the server to extract at least one common view feature point in each adjusted common view image. For example, feature point extraction methods such as corner detection algorithm (FAST algorithm), scale-invariant feature transform (SIFT), and accelerated robust feature algorithm (SURF) can be used to extract at least one common view feature point in each adjusted common view image.
[0294] After extracting at least one common view feature point from each adjusted common view image, the image pair to be processed can be processed based on the common view feature points. There are multiple ways for the server to process the image pair to be processed based on the common view feature points. For example, the server can perform feature point matching on the common view feature points of each image to be processed in the adjusted common view image to obtain matched common view feature points, determine the source feature points corresponding to the matched common view feature points in the image to be processed based on the scale difference and the size information of the adjusted common view image, and process the image pair to be processed based on the source feature points.
[0295] Among them, the matched common view feature point can be a common view feature point in an adjusted common view image of a certain image to be processed that matches the common view feature point in other adjusted common view images, and the source feature point can be a corresponding feature point in the image to be processed corresponding to the matched common view feature point.
[0296] There are multiple ways for the server to match the feature points of the common view feature points of each image to be processed in the pair of images to be processed in the adjusted common view image. For example, the server can use a distance matching method (Brute-Froce Matcher) to calculate the distance between a certain common view feature point descriptor and all the common view feature point descriptors in other adjusted common view images, and then sort the obtained distances, and take the common view feature point with the closest distance as the matching point to obtain the matched common view feature points.
[0297] After feature point matching is performed on the common view feature points of each image to be processed in the adjusted common view image in the pair of images to be processed, the source feature points corresponding to the matched common view feature points can be determined in the image to be processed based on the scale difference and the size information of the adjusted common view image. There can be multiple ways for the server to determine the source feature points corresponding to the matched common view feature points in the image to be processed based on the scale difference and the size information of the adjusted common view image. For example, the server can perform pose estimation of the adjusted common view image based on the matched common view feature points in the adjusted common view image to obtain the adjusted pose information corresponding to the adjusted common view image, so that the original pose information corresponding to the image to be processed can be calculated based on the adjusted pose information, the scale difference and the size information of the adjusted common view image, so that the position of the matched common view feature points in the adjusted common view image can be inversely transformed to the image to be processed based on the original pose information, so that the source feature points corresponding to the matched common view feature points can be determined in the image to be processed.
[0298] Optionally, the server may use a random sampling consensus algorithm (RANdom SAmple Consensus, referred to as RANSAC) to estimate the pose of the adjusted common view image based on the matched common view feature points in the adjusted common view image. The RANSAC algorithm is an algorithm that estimates model parameters in an iterative manner in a data set containing outliers.
[0299] After determining the source feature point corresponding to the matched common view feature point in the image to be processed based on the scale difference and the size information of the common view image, the image pair to be processed can be processed based on the source feature point. There are many ways for the server to process the image pair to be processed based on the source feature point. For example, feature points in the image to be processed can be extracted, matched, and located. The image to be processed can also be further applied on this basis. For example, data positioning can be performed in a virtual map application, etc., which is not limited here.
[0300] As can be seen from the above, the embodiment of the present application obtains an image sample pair through a server, uses a preset image processing model to predict the common view area of each image sample in the image sample pair, and obtains a predicted common view area. In the predicted common view area, the predicted center of attention coordinates and the predicted center point offset corresponding to the predicted common view area are extracted, and the predicted geometric center coordinates and predicted boundary size information corresponding to the predicted common view area are determined according to the predicted center of attention coordinates and the predicted center point offset; the server extracts the annotated geometric center coordinates and the annotated boundary size information corresponding to the annotated common view area in the annotated common view area, and based on the predicted geometric center coordinates and the annotated geometric center coordinates, the server extracts the annotated geometric center coordinates and the annotated boundary size information corresponding to the annotated common view area. The server calculates the cycle consistency loss information corresponding to the preset image processing model based on the predicted geometric center coordinates and the predicted boundary size information, and the annotated geometric center coordinates and the annotated boundary size information, and respectively calculates the boundary loss information and the mean absolute error loss information corresponding to the preset image processing model; the server uses the cycle consistency loss information, the mean absolute error loss information, and the boundary loss information as the loss information corresponding to the preset image processing model, and converges the preset image processing model according to the loss information to obtain a trained image processing model; the server obtains an image pair to be processed, and converges the image pair to the image pair to be processed. The server performs feature mapping on the image to be processed to obtain a feature map corresponding to the image to be processed, performs dimensionality reduction processing on the feature map corresponding to the image to be processed to obtain a feature map after dimensionality reduction, performs multi-scale feature extraction on the feature map after dimensionality reduction to obtain scale image features corresponding to the image to be processed at each scale, and fuses the scale image features corresponding to the image to be processed at each scale to obtain image features of the image to be processed; the server performs flattening processing on the image features to obtain flat image features of the image to be processed, performs feature extraction on the flat image features to obtain initial correlation features corresponding to each sub-flat image feature in the flat image features, and the basis Based on the initial correlation feature, an initial correlation weight corresponding to each sub-flat image feature in the flat image feature is determined, and each sub-flat image feature in the flat image feature is fused according to the initial correlation weight to obtain an initial attention feature corresponding to the image to be processed; the server performs cross-feature extraction on the image feature and the initial attention feature to obtain a cross-correlation feature corresponding to each image to be processed, and determines a cross-correlation weight corresponding to the image to be processed according to the cross-correlation feature, and weights each initial attention feature corresponding to the image to be processed based on the cross-correlation weight to obtain a correlation feature corresponding to the image to be processed;The server obtains a preset area feature, uses a trained image processing model to perform feature extraction on the preset area feature, obtains an area association feature corresponding to each area sub-feature in the preset area feature, determines an area association weight corresponding to each area sub-feature in the preset area feature based on the area association feature, and fuses each area sub-feature in the preset area feature according to the area association weight to obtain an initial area feature; the server performs feature extraction on the initial area feature and the association feature to obtain an image association feature corresponding to the association feature, and an initial area association feature corresponding to the initial area feature, determines an image association weight corresponding to the association feature according to the image association feature and the initial area association feature, weights the association feature based on the image association weight to obtain a common view image feature, and fuses the common view image feature with the initial area feature to obtain a common view area feature; the server calculates a common view weight corresponding to the association feature based on the common view area feature and the association feature, and calculates the common view weight and the common view image feature for each preset area in the common view area. Set an attention weight of the coordinate point, weight the preset coordinate point based on the attention weight to obtain a weighted coordinate point, accumulate the weighted coordinate point to obtain the attention center coordinates in the image to be processed; the server performs regression processing on the common view area feature to obtain a relative center point offset corresponding to the common view area, calculates the geometric center coordinates and boundary size information of the common view area in the image to be processed according to the attention center coordinates and the relative center point offset, determines the common view area of the image to be processed in the image to be processed based on the geometric center coordinates and the boundary size information, and divides the common view area in the image to be processed to obtain a common view image in the common view area; the server obtains size information of the common view image corresponding to each of the images to be processed, calculates at least one size difference between the images to be processed based on the size information, selects a target size difference that meets a preset condition from the size differences, and uses the target size difference as the scale difference between the common view images, and adjusts the size of the common view image based on the scale difference to obtain an adjusted common view image;The server extracts at least one common view feature point from each of the adjusted common view images, performs feature point matching on the common view feature points of each of the images to be processed in the adjusted common view image in the image pair to be processed, obtains matched common view feature points, determines source feature points corresponding to the matched common view feature points in the image to be processed based on the scale difference and the size information of the adjusted common view image, and processes the image pair to be processed based on the source feature points, thereby extracting correlation features representing the mutual information between the images to be processed from the image features, and identifying the common view image of the common view area between the two images to be processed in the image to be processed according to the correlation features, so as to quickly extract and match the common view feature points in the common view area based on the common view image, thereby improving the speed and accuracy of feature point matching, and effectively processing the extraction, matching and positioning of feature points in the case of large scale differences, thereby improving the accuracy and speed of image processing, thereby improving the image processing efficiency. ;
[0301] In order to better implement the above method, an embodiment of the present invention further provides an image processing apparatus, which can be integrated in a computer device, and the computer device can be a server.
[0302] For example, Figure 7 As shown, it is a schematic diagram of the structure of the image processing device provided in an embodiment of the present application. The image processing device may include an acquisition unit 301, an extraction unit 302, a recognition unit 303, an adjustment unit 304 and a processing unit 305, as follows:
[0303] The acquisition unit 301 is used to acquire a pair of images to be processed, and perform image feature extraction on the image to be processed in the pair of images to be processed to obtain image features of the image to be processed;
[0304] An extraction unit 302 is used to extract the correlation feature of the to-be-processed image pair from the image features, where the correlation feature is used to characterize the mutual information between the to-be-processed images in the to-be-processed image pair;
[0305] An identification unit 303 is used to identify the co-viewing images in the co-viewing area in the image to be processed according to the associated features, and calculate the scale difference between the co-viewing images;
[0306] An adjusting unit 304 is used to adjust the size of the common view image based on the scale difference to obtain an adjusted common view image;
[0307] The processing unit 305 is configured to extract at least one common view feature point from each of the adjusted common view images, and process the image pair to be processed based on the common view feature point.
[0308] In one embodiment, the identification unit 303 includes:
[0309] The initial region feature extraction subunit is used to obtain the preset region feature and use the trained image processing model to extract the preset region feature to obtain the initial region feature;
[0310] A cross feature extraction subunit is used to perform cross feature extraction on the initial region feature and the associated feature to obtain a common view region feature corresponding to the initial region feature;
[0311] The common view image recognition subunit is used to recognize the common view image in the common view area in the image to be processed based on the common view area feature and the associated feature.
[0312] In one embodiment, the initial region feature extraction subunit includes:
[0313] A region association feature extraction module is used to extract features of the preset region features using a trained image processing model to obtain region association features corresponding to each region sub-feature in the preset region features;
[0314] A region association weight determination module, used to determine the region association weight corresponding to each region sub-feature in the preset region feature based on the region association feature;
[0315] The initial regional feature fusion module is used to fuse each regional sub-feature in the preset regional feature according to the regional association weight to obtain the initial regional feature.
[0316] In one embodiment, the cross feature extraction subunit includes:
[0317] A cross feature extraction module is used to extract features from the initial region feature and the associated feature to obtain an image associated feature corresponding to the associated feature and an initial region associated feature corresponding to the initial region feature;
[0318] An association weight determination module, used to determine the image association weight corresponding to the association feature according to the image association feature and the initial region association feature;
[0319] The common view weighting module is used to weight the associated features based on the image association weights to obtain common view image features, and fuse the common view image features with the initial region features to obtain common view region features.
[0320] In one embodiment, the common view image recognition subunit includes:
[0321] A common view weight calculation module, used to calculate the common view weight corresponding to the associated feature based on the common view area feature and the associated feature;
[0322] A module for determining the coordinates of the center of interest, configured to determine the coordinates of the center of interest in the image to be processed according to the common view weight and the associated feature;
[0323] A relative center point offset regression module is used to perform regression processing on the common view area feature to obtain a relative center point offset corresponding to the common view area;
[0324] The common view image recognition module is used to recognize the common view image in the common view area in the image to be processed according to the focus center coordinates and the relative center point offset.
[0325] In one embodiment, the co-viewing image recognition module includes:
[0326] A geometric center coordinate and boundary size information calculation submodule, used to calculate the geometric center coordinate and boundary size information of the common viewing area in the image to be processed according to the focus center coordinate and the relative center point offset;
[0327] A common view area determination submodule, used to determine the common view area of the image to be processed in the image to be processed based on the geometric center coordinates and the boundary size information;
[0328] The common view image segmentation submodule is used to segment the common view area in the image to be processed to obtain the common view image in the common view area.
[0329] In one embodiment, the attention center coordinate determination module includes:
[0330] An attention weight calculation submodule, used for calculating the attention weight of each preset coordinate point in the common vision area according to the common vision weight and the common vision image feature;
[0331] A coordinate point weighting submodule, used for weighting the preset coordinate point based on the attention weight to obtain a weighted coordinate point;
[0332] The coordinate point accumulation submodule is used to accumulate the weighted coordinate points to obtain the coordinates of the center of interest in the image to be processed.
[0333] In one embodiment, the image processing device further includes:
[0334] An image sample pair acquisition unit, used to acquire an image sample pair, wherein the image sample pair includes an image pair with a common viewing area marked;
[0335] A predicted common view area prediction unit, used to predict the common view area of each image sample in the image sample pair by using a preset image processing model to obtain a predicted common view area;
[0336] A convergence unit is used to converge the preset image processing model according to the marked common view area and the predicted common view area to obtain the trained image processing model.
[0337] In one embodiment, the convergence unit comprises:
[0338] A predicted geometric center coordinate and predicted boundary size information extraction subunit is used to extract the predicted geometric center coordinate and predicted boundary size information corresponding to the predicted common view area in the predicted common view area;
[0339] The annotation geometric center coordinates and annotation boundary size information extraction subunit is used to extract the annotation geometric center coordinates and annotation boundary size information corresponding to the annotation common view area in the annotation common view area;
[0340] The convergence subunit is used to converge the preset image processing model according to the predicted geometric center coordinates, the predicted boundary size information, the annotated geometric center coordinates and the annotated boundary size information to obtain a trained image processing model.
[0341] In one embodiment, the predicted geometric center coordinates and predicted boundary size information extraction subunit is used to:
[0342] Extracting the predicted center of attention coordinates and the predicted center point offset corresponding to the predicted common view area in the predicted common view area;
[0343] According to the predicted focus center coordinates and the predicted center point offset, the predicted geometric center coordinates and predicted boundary size information corresponding to the predicted common view area are determined.
[0344] In one embodiment, the convergence subunit includes:
[0345] A first loss information calculation module, used to calculate the cycle consistency loss information corresponding to the preset image processing model based on the predicted geometric center coordinates and the marked geometric center coordinates;
[0346] A second loss information calculation module is used to calculate the boundary loss information and the mean absolute error loss information corresponding to the preset image processing model based on the predicted geometric center coordinates and the predicted boundary size information, and the annotated geometric center coordinates and the annotated boundary size information;
[0347] A convergence module is used to use the cycle consistency loss information, the mean absolute error loss information and the boundary loss information as the loss information corresponding to the preset image processing model, and converge the preset image processing model according to the loss information to obtain a trained image processing model.
[0348] In one embodiment, the extraction unit 302 includes:
[0349] A flattening processing subunit is used to perform flattening processing on the image feature to obtain the flattened image feature of the image to be processed;
[0350] An initial attention feature extraction subunit is used to extract the features of the flat image to obtain the initial attention features corresponding to the image to be processed;
[0351] The associated feature cross extraction subunit is used to perform cross feature extraction on the initial attention feature to obtain the associated features of each image to be processed in the pair of images to be processed.
[0352] In one embodiment, the initial attention feature extraction subunit includes:
[0353] An initial correlation feature extraction module is used to extract features from the flat image feature to obtain initial correlation features corresponding to each sub-flat image feature in the flat image feature;
[0354] An initial association weight determination module, used to determine the initial association weight corresponding to each sub-flat image feature in the flat image feature based on the initial association feature;
[0355] The initial attention feature fusion module is used to fuse each sub-flat image feature in the flat image feature according to the initial association weight to obtain the initial attention feature corresponding to the image to be processed.
[0356] In one embodiment, the correlation feature cross extraction subunit includes:
[0357] A cross-correlation feature extraction module is used to perform cross-feature extraction on the image feature and the initial attention feature to obtain a cross-correlation feature corresponding to each image to be processed;
[0358] A cross-correlation weight determination module, used to determine the cross-correlation weight corresponding to the image to be processed according to the cross-correlation feature;
[0359] The cross-correlation weighting module is used to weight the initial attention feature corresponding to each image to be processed based on the cross-correlation weight to obtain the correlation feature corresponding to the image to be processed.
[0360] In one embodiment, the acquisition unit 301 includes:
[0361] A feature mapping subunit is used to perform feature mapping on the image to be processed in the pair of images to be processed to obtain a feature map corresponding to the image to be processed;
[0362] The dimensionality reduction processing subunit is used to perform dimensionality reduction processing on the feature map corresponding to the image to be processed to obtain a feature map after dimensionality reduction;
[0363] The scale image feature extraction subunit is used to perform multi-scale feature extraction on the feature map after dimensionality reduction to obtain the scale image features corresponding to each scale of the image to be processed;
[0364] The image feature fusion subunit is used to fuse the scale image features corresponding to each scale of the image to be processed to obtain the image features of the image to be processed.
[0365] In one embodiment, the identification unit 303 includes:
[0366] A size information acquisition subunit, used to acquire size information of the co-visual image corresponding to each image to be processed;
[0367] A size difference calculation subunit, used for calculating at least one size difference between the images to be processed based on the size information;
[0368] The scale difference screening subunit is used to screen out a target size difference that meets a preset condition from the size differences, and use the target size difference as the scale difference between the co-viewing images.
[0369] In one embodiment, the processing unit 305 includes:
[0370] A common view feature point matching subunit is used to match the common view feature points of each image to be processed in the image pair to be processed in the adjusted common view image to obtain matched common view feature points;
[0371] A source feature point determination subunit, configured to determine, in the image to be processed, a source feature point corresponding to the matched common view feature point based on the scale difference and size information of the adjusted common view image;
[0372] The processing subunit is used to process the pair of images to be processed based on the source feature points.
[0373] In specific implementation, the above units can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units can refer to the previous method embodiments, which will not be repeated here.
[0374] As can be seen from the above, the embodiment of the present application obtains the image pair to be processed by the acquisition unit 301, and extracts the image features of the image to be processed in the image pair to be processed to obtain the image features of the image to be processed; the extraction unit 302 extracts the associated features of the image pair to be processed from the image features; the identification unit 303 identifies the co-viewing image of the co-viewing area in the image to be processed according to the associated features, and calculates the scale difference between the co-viewing images; the adjustment unit 304 adjusts the size of the co-viewing image based on the scale difference to obtain the adjusted co-viewing image; the processing unit 305 extracts at least one co-viewing feature point in each adjusted co-viewing image, and processes the image pair to be processed based on the co-viewing feature points. In this way, by extracting the associated features representing the mutual information between the images to be processed from the image features, and identifying the co-viewing image of the co-viewing area between the two images to be processed in the image to be processed according to the associated features, the co-viewing feature points in the co-viewing area are quickly extracted and matched based on the co-viewing images, the rate and accuracy of feature point matching are improved, and then the accuracy and speed of image processing are improved, thereby improving the image processing efficiency.
[0375] The present application also provides a computer device, such as Figure 8 As shown, it shows a schematic diagram of the structure of a computer device involved in an embodiment of the present application, and the computer device may be a server, specifically:
[0376] The computer device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will appreciate that Figure 8 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:
[0377] The processor 401 is the control center of the computer device, and uses various interfaces and lines to connect various parts of the entire computer device. By running or executing software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, the processor 401 performs various functions of the computer device and processes data. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 401.
[0378] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and image processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0379] The computer device also includes a power supply 403 for supplying power to various components. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 403 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.
[0380] The computer device may further include an input unit 404, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0381] Although not shown, the computer device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 401 in the computer device will load the executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run the application programs stored in the memory 402, thereby realizing various functions, as follows:
[0382] A pair of images to be processed is obtained, and image features of the image to be processed in the pair of images to be processed are extracted to obtain image features of the image to be processed; associated features of the pair of images to be processed are extracted from the image features; based on the associated features, a common view image of a common view area is identified in the image to be processed, and the scale difference between the common view images is calculated; based on the scale difference, the size of the common view image is adjusted to obtain an adjusted common view image; at least one common view feature point is extracted from each adjusted common view image, and based on the common view feature point, the pair of images to be processed is processed.
[0383] The specific implementation of each of the above operations can be found in the previous embodiments, which will not be described in detail here. It should be noted that the computer device provided in the embodiment of the present application and the image processing method in the above embodiment belong to the same concept, and its specific implementation process is detailed in the above method embodiment, which will not be described in detail here.
[0384] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0385] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any one of the image processing methods provided in the embodiments of the present application. For example, the instructions can execute the following steps:
[0386] A pair of images to be processed is obtained, and image features are extracted from the image to be processed in the pair of images to be processed to obtain image features of the image to be processed; associated features of the image pair to be processed are extracted from the image features; co-viewing images of a co-viewing area are identified in the image to be processed according to the associated features, and the scale difference between the co-viewing images is calculated; the size of the co-viewing images is adjusted based on the scale difference to obtain adjusted co-viewing images; at least one co-viewing feature point is extracted from each adjusted co-viewing image, and the image pair to be processed is processed based on the co-viewing feature points.
[0387] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0388] Since the instructions stored in the computer-readable storage medium can execute the steps in any image processing method provided in the embodiments of the present application, the beneficial effects that can be achieved by any image processing method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0389] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the various optional implementations provided in the above embodiments.
[0390] The above is a detailed introduction to an image processing method, device and computer-readable storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. An image processing method, characterized in that: include: Acquire a pair of images to be processed, and perform image feature extraction on the image to be processed in the pair of images to be processed to obtain image features of the image to be processed; Extracting the associated features of the image pair to be processed from the image features, comprising: flattening the image features to obtain the flattened image features of the image to be processed; extracting features from the flattened image features to obtain initial attention features corresponding to the image to be processed; performing cross-feature extraction on the initial attention features to obtain associated features of each image to be processed in the image pair to be processed; wherein the associated features are used to characterize the mutual information between the images to be processed in the image pair to be processed, and the mutual information is information characterizing the associated relationship between the images to be processed; According to the associated features, the co-viewing images in the co-viewing area are identified in the image to be processed, and the scale difference between the co-viewing images is calculated; Based on the scale difference, the size of the common view image is adjusted to obtain an adjusted common view image; At least one common view feature point is extracted from each of the adjusted common view images, and the pair of images to be processed is processed based on the common view feature point.
2. The image processing method according to claim 1, characterized in that: The step of identifying a common vision image of a common vision area in the image to be processed according to the associated features includes: Acquire preset region features, and use the trained image processing model to perform feature extraction on the preset region features to obtain initial region features; Performing cross-feature extraction on the initial region features and the associated features to obtain common view region features corresponding to the initial region features; Based on the common view area features and the associated features, a common view image in the common view area is identified in the image to be processed.
3. The image processing method according to claim 2, characterized in that: The preset regional features include a plurality of regional sub-features, and the trained image processing model is used to extract features from the preset regional features to obtain initial regional features, including: Using the trained image processing model to extract features from the preset regional features, and obtaining regional association features corresponding to each regional sub-feature in the preset regional features; Based on the regional association feature, determining a regional association weight corresponding to each regional sub-feature in the preset regional feature; Each regional sub-feature in the preset regional feature is fused according to the regional association weight to obtain an initial regional feature.
4. The image processing method according to claim 2, wherein: The cross-feature extraction of the initial region feature and the associated feature to obtain the common view region feature corresponding to the initial region feature includes: Performing feature extraction on the initial region feature and the association feature to obtain an image association feature corresponding to the association feature and an initial region association feature corresponding to the initial region feature; Determining an image association weight corresponding to the association feature according to the image association feature and the initial region association feature; Based on the image association weight, the association features are weighted to obtain a common view image feature, and the common view image feature is fused with the initial region feature to obtain a common view region feature.
5. The image processing method according to claim 2, characterized in that: The identifying, in the image to be processed, a common viewing image in the common viewing area based on the common viewing area feature and the associated feature, comprises: Based on the common view area features and the associated features, calculating the common view weight corresponding to the associated features; Determining the focus center coordinates in the image to be processed according to the common view weight and the associated features; Performing regression processing on the common view area features to obtain a relative center point offset corresponding to the common view area; According to the focus center coordinates and the relative center point offset, a common vision image in the common vision area is identified in the image to be processed.
6. The image processing method according to claim 5, characterized in that: The step of identifying the common vision image in the common vision area in the image to be processed according to the focus center coordinates and the relative center point offset includes: Calculating the geometric center coordinates and boundary size information of the common viewing area in the image to be processed according to the focus center coordinates and the relative center point offset; Based on the geometric center coordinates and the boundary size information, determining a common viewing area of the image to be processed in the image to be processed; The common vision area is segmented in the image to be processed to obtain a common vision image in the common vision area.
7. The image processing method according to claim 5, characterized in that: The step of determining the focus center coordinates in the image to be processed according to the co-viewing weight and the co-viewing image feature includes: Calculating the attention weight of each preset coordinate point in the common view area according to the common view weight and the common view image feature; Weighting the preset coordinate point based on the attention weight to obtain a weighted coordinate point; The weighted coordinate points are accumulated to obtain the coordinates of the center of interest in the image to be processed.
8. The image processing method according to claim 2, characterized in that: Before extracting the features of the preset region using the trained image model to obtain the initial region features, the method further includes: Acquire an image sample pair, wherein the image sample pair includes an image pair with a common viewing area marked; Predicting the common view area of each image sample in the image sample pair using a preset image processing model to obtain a predicted common view area; The preset image processing model is converged according to the marked common view area and the predicted common view area to obtain the trained image processing model.
9. The image processing method according to claim 8, characterized in that: The step of converging the preset image processing model according to the marked common view area and the predicted common view area to obtain the trained image processing model includes: Extracting, from the predicted common view area, predicted geometric center coordinates and predicted boundary size information corresponding to the predicted common view area; Extracting the labeled geometric center coordinates and the labeled boundary size information corresponding to the labeled common view area in the labeled common view area; The preset image processing model is converged according to the predicted geometric center coordinates, the predicted boundary size information, the annotated geometric center coordinates and the annotated boundary size information to obtain a trained image processing model.
10. The image processing method according to claim 9, characterized in that: Extracting the predicted geometric center coordinates and predicted boundary size information corresponding to the predicted common view area in the predicted common view area includes: Extracting, in the predicted common view area, predicted focus center coordinates and predicted center point offset corresponding to the predicted common view area; The predicted geometric center coordinates and predicted boundary size information corresponding to the predicted common view area are determined according to the predicted attention center coordinates and the predicted center point offset.
11. The image processing method according to claim 10, characterized in that: The method of converging the preset image processing model according to the predicted geometric center coordinates, the predicted boundary size information, the annotated geometric center coordinates, and the annotated boundary size information to obtain a trained image processing model includes: Based on the predicted geometric center coordinates and the annotated geometric center coordinates, calculating the cycle consistency loss information corresponding to the preset image processing model; Based on the predicted geometric center coordinates and predicted boundary size information, and the annotated geometric center coordinates and annotated boundary size information, respectively calculating boundary loss information and mean absolute error loss information corresponding to the preset image processing model; The cycle consistency loss information, the mean absolute error loss information and the boundary loss information are used as loss information corresponding to the preset image processing model, and the preset image processing model is converged according to the loss information to obtain a trained image processing model.
12. The image processing method according to claim 1, characterized in that: The flat image feature includes a plurality of sub-flat image features, and the feature extraction of the flat image feature to obtain the initial attention feature corresponding to the image to be processed includes: Extracting features from the flat image feature to obtain initial correlation features corresponding to each sub-flat image feature in the flat image feature; Based on the initial association feature, determining an initial association weight corresponding to each sub-flat image feature in the flat image feature; Each sub-flat image feature in the flat image feature is fused according to the initial association weight to obtain an initial attention feature corresponding to the image to be processed.
13. The image processing method according to claim 1, characterized in that: The cross-feature extraction of the initial attention features to obtain the associated features of each of the to-be-processed images in the to-be-processed image pair includes: Performing cross-feature extraction on the image features and the initial attention features to obtain cross-correlation features corresponding to each of the images to be processed; Determining a cross-correlation weight corresponding to the image to be processed according to the cross-correlation feature; Based on the cross-correlation weight, the initial attention feature corresponding to each of the images to be processed is weighted to obtain the correlation feature corresponding to the image to be processed.
14. The image processing method according to claim 1, characterized in that: The step of extracting image features from the image to be processed in the pair of images to be processed to obtain image features of the image to be processed includes: Performing feature mapping on the image to be processed in the pair of images to be processed to obtain a feature map corresponding to the image to be processed; Performing dimensionality reduction processing on the feature map corresponding to the image to be processed to obtain a feature map after dimensionality reduction; Performing multi-scale feature extraction on the feature map after dimensionality reduction to obtain scale image features corresponding to each scale of the image to be processed; The scale image features corresponding to each scale of the image to be processed are fused to obtain the image features of the image to be processed.
15. The image processing method according to claim 1, characterized in that: The calculating the scale difference between the co-viewing images comprises: Obtaining size information of the co-visual image corresponding to each of the images to be processed; Calculate at least one size difference between the images to be processed based on the size information; A target size difference satisfying a preset condition is screened out from the size differences, and the target size difference is used as the scale difference between the co-viewing images.
16. The image processing method according to claim 1, characterized in that: The processing of the pair of images to be processed based on the common view feature points includes: Performing feature point matching on the common view feature points of each of the images to be processed in the image pair to be processed in the adjusted common view image to obtain matched common view feature points; Based on the scale difference and the size information of the adjusted common-view image, determining, in the image to be processed, a source feature point corresponding to the matched common-view feature point; Based on the source feature points, the pair of images to be processed is processed.
17. An image processing device, characterized in that: include: An acquisition unit, used for acquiring a pair of images to be processed, and performing image feature extraction on the image to be processed in the pair of images to be processed to obtain image features of the image to be processed; The extraction unit is used to extract the associated features of the image pair to be processed from the image features, including: flattening the image features to obtain the flat image features of the image to be processed; extracting features from the flat image features to obtain the initial attention features corresponding to the image to be processed; performing cross-feature extraction on the initial attention features to obtain the associated features of each image to be processed in the image pair to be processed; wherein the associated features are used to characterize the mutual information between the images to be processed in the image pair to be processed, and the mutual information is information characterizing the associated relationship between the images to be processed; an identification unit, configured to identify, in the image to be processed, co-viewing images in a co-viewing area according to the associated features, and calculate a scale difference between the co-viewing images; an adjusting unit, configured to adjust the size of the common vision image based on the scale difference to obtain an adjusted common vision image; A processing unit is used to extract at least one common view feature point from each of the adjusted common view images, and process the pair of images to be processed based on the common view feature point.
18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the image processing method according to any one of claims 1 to 16.
19. A computer device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the image processing method according to any one of claims 1 to 16 when executing the computer program.
Citation Information
Patent Citations
Method and device for reconstructing three-dimensional image, electronic equipment and medium
CN111784841A
Intelligent vehicle target real-time detection and positioning method based on bionic vision
CN111914715A
Training method and device of panoramic image feature point matching model, and server
CN113807451A
Image processing apparatus and method
US20120026296A1
3-d reconstruction using augmented reality frameworks
US20210183161A1
