A scene similarity judgment method, model and training method

Through the convolutional neural network training method, the overall contour of the scene image is extracted and the data is enhanced to generate samples. Combined with the ArcFace loss function, it solves the long time-consuming and low accuracy problems of the traditional pixel comparison method in scene similarity judgment, and achieves a better Efficient and accurate scene similarity judgment.

CN118506255BActive Publication Date: 2024-10-18CHENGDU ZVAN TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410973099.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2024-10-18
Estimated Expiration
2044-07-19

AI Technical Summary

Technical Problem

In the current scene similarity judgment, the traditional pixel point comparison method is time-consuming and has low accuracy, and is difficult to adapt to the lighting changes in different weather, seasons and time in outdoor scenes.

Method used

The convolutional neural network training method is used to obtain the overall contour of the sample image and data enhancement, generate positive samples and negative samples, perform multiple downsampling to extract feature maps, and use the ArcFace loss function to optimize the model, and finally obtain the scene through weighted summation Similarity value.

Benefits of technology

It improves the accuracy of scene similarity judgment, is suitable for multi-light outdoor scenes, reduces computational complexity and time-consuming, and improves judgment speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118506255B_ABST
    Figure CN118506255B_ABST
Patent Text Reader

Abstract

The present invention provides a scene similarity judgment method, model and training method, and relates to the technical field of image similarity judgment. The training method comprises: S1, obtaining a sample image; S2, extracting the overall contour and performing data enhancement and fusion; S3, splicing to obtain positive samples and negative samples; S4, scaling and making them into training samples; S5, passing the training samples into a convolutional neural network, performing multiple downsampling, extracting fusion image information, and finally obtaining a scaled feature map as a similarity feature map; S6, expanding the feature map obtained in step S5 into a 1×N vector, multiplying the vector by the weight of the input data, and adding all the results to obtain a weighted sum value; the value represents the similarity of the scenes in the two pictures. The present invention can judge the similarity of the scene features of the pictures, and can have both judgment accuracy and speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image similarity judgment, and in particular to a scene similarity judgment method, model and training method. Background Art

[0002] When comparing image similarity, the commonly used method is the pixel comparison method, which compares all the pixels of the target image and the original image one by one in order, and then obtains the similarity between the target image and the original image by calculating the Euclidean distance. This method requires comparing the pixels in the image one by one, which is time-consuming and has a high algorithm complexity.

[0003] In scene similarity judgment, since most scenes are outdoors and the same scene has large differences in color and lighting in different weather, seasons and times, the traditional pixel comparison method has low judgment accuracy, while methods such as multi-scale feature extraction models are time-consuming and complex.

[0004] Based on this, a similarity judgment technology is needed that can focus on scene features and have both judgment accuracy and speed.

[0005] Environmental change monitoring is an important part of environmental protection and urban planning. By making similarity judgments on a large amount of environmental data, the degree of environmental change can be evaluated. Summary of the invention

[0006] The purpose of the present invention is to overcome the shortcomings of the prior art, which is specifically achieved through the following technical solutions:

[0007] The present invention provides a method for training a scene similarity judgment model, comprising the following steps:

[0008] S1, obtain sample image;

[0009] S2, for the sample image obtained in step S1, extracting the overall contour of the sample image and performing data enhancement on the sample image, and fusing the extracted overall contour with the image after data enhancement;

[0010] S3, stitching the images obtained after fusion in step S2 to obtain positive samples and negative samples respectively; each sample image in the positive sample is formed by fusion and stitching of two different images with the same scene; each sample image in the negative sample is formed by fusion and stitching of two images with different scenes;

[0011] S4, scaling the positive samples and negative samples to the same size to make them into training samples;

[0012] S5, passing the training samples obtained in step S4 into the convolutional neural network, performing multiple downsampling, extracting the fused image information, and finally obtaining the scaled feature map;

[0013] S6. Expand the feature map obtained in step S5 into a 1×N vector, multiply the vector by the weight of the input data, and add all the results to obtain a weighted sum value; the value represents the similarity of the scenes in the two pictures.

[0014] Optionally or preferably, using canny The algorithm extracts the overall contour of the sample image, including the following steps:

[0015] A1. Perform Gaussian filtering to remove noise from the sample image and obtain the smoothed image pixel value. :

[0016] ;

[0017] in: The horizontal axis is , the vertical axis is Pixels of

[0018] , Represents the horizontal coordinate index value and the vertical coordinate index value relative to a specific position in the Gaussian kernel;

[0019] Relative to the pixel , lateral offset , longitudinal offset Pixels of

[0020] It's a pixel The original image pixel value;

[0021] It's a pixel The original image pixel value;

[0022] Indicates that the horizontal axis index value is , the vertical axis index value is , the weight value of the Gaussian kernel;

[0023] is the radius of the Gaussian kernel;

[0024] represents the sum of all items on its right side, where The lower bound of , The upper bound of , The lower bound of , The upper bound of .

[0025] A2. Calculate image gradient:

[0026] use Sobel The operator calculates the horizontal first-order derivative of an image and the vertical first-order derivative , and then according to the obtained , Two gradient images, find the gradient of the boundary and direction ,in:

[0027] ;

[0028] .

[0029] A3. According to the obtained gradient value, non-maximum suppression processing is performed on each pixel in the image. The gradient value of each pixel is compared with the gradient value of the two adjacent pixels in the gradient direction, and only the pixels with the largest gradient value are retained, so that the detected edge becomes thinner and smoother. The process is as follows:

[0030]

[0031] in, It's pixels p The gradient amplitude, is its gradient direction, Δ represents the pixel offset along the gradient direction; and Represents pixels p In the gradient direction The adjacent pixels on .

[0032] A4. Confirm the contour edge through the hysteresis threshold: Compare the grayscale gradient value of the edge pixel point extracted in step A3 with maxVal Compare and compare the grayscale gradient value higher than maxVal Pixels with grayscale gradient values ​​lower than minVal The pixels with gray values ​​in maxVal and of minVal The pixels between them are considered as weak edges;

[0033] A5. Edge tracking: If a weak edge pixel is connected to a contour pixel and has the same gradient direction, the weak edge pixel is considered to be part of the contour.

[0034] Optionally or preferably, when performing data augmentation, the sample image is converted into HVS Image, perform data augmentation on sample images.

[0035] Optionally or preferably, use opencv The images obtained after fusion in step S2 are stitched together to obtain positive samples and negative samples respectively; the stitching can be performed by any of interval insertion stitching, channel stitching, and left-right stitching.

[0036] Optionally or preferably, when obtaining positive samples and negative samples, the following steps are included:

[0037] B1. Create multiple folders;

[0038] B2. Classify the sample images and add them to the above-mentioned multiple folders, where the multiple images in any of the folders meet all of the following conditions: 1. They are in the same scene; 2. They are in different times, seasons or weather, etc.;

[0039] B3. Image extraction: When making positive samples, randomly select any two images from the same folder; when making negative samples, randomly select any two images from different folders;

[0040] B4, fusion stitching: stitch the images extracted in step B3, and the stitched image is the image in the positive sample / negative sample.

[0041] Optionally or preferably, the convolutional neural network structure is as follows:

[0042] First layer: CONV , the channel is 64, the convolution kernel is 3×3, and the image features are simply extracted, making the length and width of the image become 1 / 2 of the original image;

[0043] Second layer: CONV , the channel is 128, 3×3 convolution kernel, further extracts information features, and the length and width of the image become 1 / 4 of the original image;

[0044] Third layer: C2F , the channel is 128, 3×3 convolution kernel, processing and fusing spatial feature information;

[0045] Fourth floor: CONV , the channel is 256, 3×3 convolution kernel, further extracts information features, and the length and width of the image become 1 / 8 of the original image;

[0046] Fifth floor: C2F , the channel is 256, 3×3 convolution kernel, processing and fusing spatial feature information;

[0047] Sixth floor: CONV, the channel is 512, 3×3 convolution kernel, further extracts information features, and the length and width of the image become 1 / 16 of the original image;

[0048] Seventh floor: C2F , the channel is 512, 3×3 convolution kernel, processing and fusing spatial feature information;

[0049] Eighth floor: CONV , the channel is 1024, 3×3 convolution kernel, further extracts information features, and the length and width of the image become 1 / 32 of the original image;

[0050] Tenth floor: C2F , the channel is 1024, 3×3 convolution kernel, processing and fusing spatial feature information;

[0051] The last layer: fully connected, connects all neurons in the previous layer, maps the input data to an output, and learns the complex relationship between features.

[0052] Optionally or preferably, the C2F The processing steps include:

[0053] C1. Use bilinear interpolation to upsample the image:

[0054] ;

[0055] in, is the image before shallow sampling, is the image after shallow sampling, It is bilinear interpolation processing;

[0056] C2. Fusion of features. The specific calculation process is as follows:

[0057] ;

[0058] in, Represents the shallow layer; Represents the deep layer after convolution;

[0059] and are the weight parameters for shallow and deep learning respectively;

[0060] It is the deep graph after convolution;

[0061] is the bias term, represents the activation function, It is the fusion feature.

[0062] Optionally or preferably, the convolutional neural network structure adoptsArcFace The function is used as the loss function, and its formula is as follows:

[0063] ;

[0064] in, Indicates the number of samples in the batch;

[0065] n Indicates the total number of target categories;

[0066] represents the environmental feature vector;

[0067] Represents the weight vector and the input feature vector The angle between

[0068] represents the weight matrix of the deep learning model Column, representing feature vector of target categories;

[0069] Represents the input feature vector, which is a high-dimensional feature extracted by the deep learning model;

[0070] Indicates target categories;

[0071] Indicates the target category The weight vector With the eigenvector The angle between

[0072] Said and are obtained by calculating the cosine value between vectors. and The value range is ;

[0073] is the additive angular margin parameter, which is used to enhance intra-class compactness and inter-class diversity;

[0074] is the temperature parameter, controlling

[0075] The smoothness of the distribution;

[0076] Compared to conventional MSE Regression loss, ArcFace The loss function can pay more attention to global features and enable the model to learn more decentralized and discernible feature representations.

[0077] The present invention also provides a scene similarity judgment model, which is obtained by training using the above training method.

[0078] The present invention also provides a scene similarity judgment method, which adopts the above-mentioned scene similarity judgment model and includes the following steps:

[0079] D1. Splice the two pictures whose scene similarity needs to be judged to produce a test image;

[0080] D2, input the image to be tested into the scene similarity judgment model;

[0081] D3, the scene similarity judgment model expands the feature map into a 1×N vector, multiplies the vector by the weight of the input data, and adds all the results to obtain a weighted sum value;

[0082] D4, output this value as the similarity between the scenes in the two pictures.

[0083] Based on the above technical solution, the following technical effects can be produced:

[0084] The present invention provides a scene similarity judgment method, model and training method, which adopt classification ideas to judge the scene similarity of pictures. Compared with the judgment by pixels in the prior art, the judgment of the present invention is less affected by saturation and brightness, is more suitable for outdoor scenes with various lighting conditions, and has a higher judgment accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0085] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.

[0086] Figure 1 Schematic diagram of the model training steps of the present invention. DETAILED DESCRIPTION

[0087] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0088] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0089] Example 1

[0090] The present invention provides a method for training a scene similarity judgment model. Figure 1 As shown, the following steps are included:

[0091] S1. Obtain a sample image through a ball camera; the sample image includes multiple scenes and each scene corresponds to multiple environments; the sample image and RGB images; specifically, the environment includes different times, weather and seasons;

[0092] S2, extracting the overall contour of the sample image and performing data enhancement on the sample image;

[0093] Specifically, when extracting the overall contour, we use canny The algorithm extracts the overall contour of the sample image, including the following steps:

[0094] A1. Perform Gaussian filtering to remove noise from the sample image and obtain the smoothed image pixel value. :

[0095] ;

[0096] in: The horizontal axis is , the vertical axis is Pixels of

[0097] , Represents the horizontal coordinate index value and the vertical coordinate index value relative to a specific position in the Gaussian kernel;

[0098] Relative to the pixel , lateral offset , longitudinal offset Pixels of

[0099] It's a pixel The original image pixel value;

[0100] It's a pixel The original image pixel value;

[0101] Indicates that the horizontal axis index value is , the vertical axis index value is , the weight value of the Gaussian kernel;

[0102] is the radius of the Gaussian kernel;

[0103] represents the sum of all items on its right side, where The lower bound of , The upper bound of , The lower bound of , The upper bound of .

[0104] A2. Calculate image gradient:

[0105] use Sobel The operator calculates the horizontal first-order derivative of an image and the vertical first-order derivative , and then according to the obtained , Two gradient images, find the gradient of the boundary and direction :

[0106] ;

[0107] .

[0108] A3. According to the obtained gradient value, non-maximum suppression processing is performed on each pixel in the image. The gradient value of each pixel is compared with the gradient value of the two adjacent pixels in the gradient direction, and only the pixels with the largest gradient value are retained, so that the detected edge becomes thinner and smoother. The process is as follows:

[0109] ,

[0110] in, It is non-maximum suppression processing; is the degree of pixel overlap; The gradient value set of each pixel and its two neighboring pixels in the gradient direction; for B A value in is the smoothness threshold;

[0111] ,

[0112] in, It's pixels p The gradient amplitude, is its gradient direction, Δ represents the pixel offset along the gradient direction; and Represents pixels p In the gradient direction The adjacent pixels on .

[0113] A4. Confirm the contour edge by hysteresis threshold: compare the grayscale gradient value of the edge pixel extracted in step A3 with maxVal, consider the pixel with grayscale gradient value higher than maxVal as the contour, and discard the pixel with grayscale gradient value lower than minVal; maxVal and of minVal The pixels between them are considered as weak edges;

[0114] A5. Edge tracking: If a weak edge pixel is connected to a contour pixel and has the same gradient direction, the weak edge pixel is considered to be part of the contour.

[0115] When performing data enhancement, the sample image is converted into an HVS image, and data enhancement is performed on the sample image; the color parameters in the HVS image include hue H, saturation S and brightness V, where:

[0116] Hue H is measured by angle, ranging from 0 to 360°, calculated counterclockwise, red is 0°, green is 120°, blue is 240°, yellow is 60°, cyan is 180°, and purple is 300°;

[0117] Saturation S indicates the degree to which a color is close to a spectral color, that is, a color is regarded as the result of a mixture of a certain spectral color and white. The greater the proportion of the spectral color, the closer the color is to the spectral color, and the higher the saturation of the color. The higher the saturation, the deeper and brighter the color. When the white light component of the spectral color is 0, the saturation reaches the highest. The saturation S usually ranges from 0 to 100%. The larger the value, the more saturated the color.

[0118] Lightness V indicates the brightness of a color. For light source color, the lightness value is related to the brightness of the light source; for object color, this value is related to the transmittance or reflectance of the object; lightness V usually ranges from 0% (black) to 100% (white);

[0119] In this embodiment, since there are many outdoor scenes and the lighting is different at different times, the use of HSV enhancement can more directly produce saturation and brightness data, thereby improving the robustness of the model.

[0120] S3. Use OpenCV to stitch the images obtained after fusion in step S2 to obtain positive samples and negative samples respectively; specifically, each sample image in the positive sample is formed by fusing and stitching two different pictures of the same scene by OpenCV; each sample image in the negative sample is formed by fusing and stitching two pictures of different scenes by OpenCV; when fusion and stitching, various stitching methods such as interval insertion stitching, channel stitching, left-right stitching, etc. can be used. It has been verified that left-right stitching has the best effect and fast processing speed, so this embodiment adopts the left-right stitching method.

[0121] Furthermore, in this embodiment, the following steps are used to obtain positive samples and negative samples:

[0122] B1. Create multiple folders;

[0123] B2. Classify the sample images and add them to the above-mentioned multiple folders, where the multiple images in any of the folders meet all of the following conditions: 1. They are in the same scene; 2. They are in different times, seasons or weather, etc.;

[0124] B3. Image extraction: When making positive samples, randomly select any two images from the same folder; when making negative samples, randomly select any two images from different folders;

[0125] B4, fusion stitching: The image extracted in step B3 is stitched left and right, and the stitched image is the image in the positive sample / negative sample.

[0126] S4, scaling the positive samples and negative samples to the same size, adjusting them to a uniform size of 128×128, and making them into training samples;

[0127] S5, passing the training samples obtained in step S4 into the convolutional neural network, performing multiple downsampling, extracting the fused image information, and finally obtaining the scaled feature map;

[0128] Specifically, the convolutional neural network structure in this embodiment is as follows:

[0129] First layer: CONV , the number of channels is 64, the convolution kernel is 3×3, and the ordinary convolution simply extracts the image features first, making the length and width of the image become 1 / 2 of the original image;

[0130] Second layer: CONV , the channel is 128, 3×3 convolution kernel, further extracts information features, and the length and width of the image become 1 / 4 of the original image;

[0131] Third layer: C2F , the channel is 128, 3×3 convolution kernel, processing and fusing spatial feature information;

[0132] Fourth floor: CONV , the channel is 256, 3×3 convolution kernel, further extracts information features, and the length and width of the image become 1 / 8 of the original image;

[0133] Fifth floor: C2F , the channel is 256, 3×3 convolution kernel, processing and fusing spatial feature information;

[0134] Sixth floor: CONV , the channel is 512, 3×3 convolution kernel, further extracts information features, and the length and width of the image become 1 / 16 of the original image;

[0135] Seventh floor: C2F , the channel is 512, 3×3 convolution kernel, processing and fusing spatial feature information;

[0136] Eighth floor: CONV , the channel is 1024, 3×3 convolution kernel, further extracts information features, and the length and width of the image become 1 / 32 of the original image;

[0137] Ninth floor: C2F , the channel is 1024, 3×3 convolution kernel, processing and fusing spatial feature information;

[0138] The last layer: fully connected, connects all neurons in the previous layer, maps the input data to an output, and learns the complex relationship between features.

[0139] Furthermore, the C2F The processing steps include:

[0140] C1. Use bilinear interpolation to upsample the image:

[0141] ,

[0142] in, is the image before shallow sampling, is the image after shallow sampling, It is bilinear interpolation processing.

[0143] C2. Fusion of features. The specific calculation process is as follows:

[0144] ;

[0145] in, Represents the shallow layer; Represents the deep layer after convolution;

[0146] and are the weight parameters for shallow and deep learning respectively;

[0147] It is the deep graph after convolution;

[0148] is the bias term, represents the activation function, It is the fusion feature.

[0149] The convolutional neural network structure adopts ArcFace The function is used as the loss function, and its formula is as follows:

[0150] ;

[0151] in, Indicates the number of samples in the batch;

[0152] n Indicates the total number of target categories;

[0153] represents the environmental feature vector;

[0154] Represents the weight vector and the input feature vector The angle between

[0155] represents the weight matrix of the deep learning model Column, representing feature vector of target categories;

[0156] Represents the input feature vector, which is a high-dimensional feature extracted by the deep learning model;

[0157] Indicates target categories; for example, , It is the first category. It is the second category;

[0158] Indicates the target category The weight vector With the eigenvector The angle between

[0159] Said and are obtained by calculating the cosine value between vectors. and The value range is ;

[0160] is an additive angle margin parameter used to enhance intra-class compactness and inter-class diversity. In this embodiment, You can take 0.5;

[0161] is the temperature parameter, controlling The smoothness of the distribution, in this embodiment, The value range is During the training process, first take 0.5 to make it sharp and converge quickly, and then gradually increase it to 0.8 to make it smooth and reduce noise sensitivity;

[0162] Compared with the conventional MSE regression loss, this application adopts ArcFace The loss function can pay more attention to global features and enable the model to learn more decentralized and discernible feature representations.

[0163] S6. Expand the feature map obtained in step S5 into a 1×N vector, multiply the vector by the weight of the input data, and add all the results to obtain a weighted sum value, the value range of which is (0,1); the value represents the similarity of the scenes in the two pictures, and the closer the value is to 1, the higher the similarity; further, the weight of the input data can be the weight of the fully connected layer of the neural network, which is obtained through network training.

[0164] The above is only a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the form disclosed herein, and should not be regarded as excluding other embodiments, but can be used in various other combinations, modifications and environments, and can be modified within the scope of the concept described herein through the above teachings or the technology or knowledge of the relevant field. The changes and modifications made by those skilled in the art shall not deviate from the spirit and scope of the present invention, and shall be within the scope of protection of the claims attached to the present invention.

Claims

1. A method for training a scene similarity judgment model, characterized in that: The following steps are involved: S1, obtain sample image; S2, for the sample image obtained in step S1, extracting the overall contour of the sample image and performing data enhancement on the sample image, and fusing the extracted overall contour with the image after data enhancement; S3, stitching the images obtained after fusion in step S2 to obtain positive samples and negative samples respectively; each sample image in the positive sample is formed by fusion and stitching of two different images with the same scene; each sample image in the negative sample is formed by fusion and stitching of two images with different scenes; S4, scaling the positive samples and negative samples to the same size to make them into training samples; S5, passing the training samples obtained in step S4 into the convolutional neural network, performing multiple downsampling, extracting the fused image information, and finally obtaining the scaled feature map; the convolutional neural network includes five layers for extracting image features CONV Convolutional layer, four layers for feature fusion C2F Connection layer and fully connected layer that connects all neurons; S6. Expand the feature map obtained in step S5 into a 1×N vector, multiply the vector by the weight of the input data, and add all the results to obtain a weighted sum value; the value represents the similarity of the scenes in the two pictures.

2. The method for training a scene similarity judgment model according to claim 1, characterized in that: use canny The algorithm extracts the overall contour of the sample image, including the following steps: A1. Perform Gaussian filtering to remove noise from the sample image and obtain the smoothed image pixel value. : , in: The horizontal axis is , the vertical axis is Pixels of , Represents the horizontal coordinate index value and the vertical coordinate index value relative to a specific position in the Gaussian kernel; Relative to the pixel , lateral offset , longitudinal offset Pixels of It's a pixel The original image pixel value; It's a pixel The original image pixel value; Indicates that the horizontal axis index value is , the vertical axis index value is , the weight value of the Gaussian kernel; is the radius of the Gaussian kernel; represents the sum of all items on its right side, where The lower bound of , The upper bound of , The lower bound of , The upper bound of ; A2. Calculate image gradient: use Sobel The operator calculates the horizontal first-order derivative of an image and the vertical first-order derivative , and then according to the obtained , Two gradient images, find the gradient of the boundary and direction ,in: ; ; A3. According to the obtained gradient value, non-maximum suppression processing is performed on each pixel in the image. The gradient value of each pixel is compared with the gradient value of the two adjacent pixels in the gradient direction, and only the pixels with the largest gradient value are retained, so that the detected edge becomes thinner and smoother. The process is as follows: , in, It's pixels p The gradient amplitude, is its gradient direction, represents the pixel offset along the gradient direction; and Represents pixels p In the gradient direction The adjacent pixels on ; A4. Confirm the contour edge through the hysteresis threshold: Compare the grayscale gradient value of the edge pixel point extracted in step A3 with maxVal Compare and compare the grayscale gradient value higher than maxVal Pixels with grayscale gradient values ​​lower than minVal The pixels with gray values ​​in maxVal and minVal The pixels between them are considered as weak edges; A5. Edge tracking: If a weak edge pixel is connected to a contour pixel and has the same gradient direction, the weak edge pixel is considered to be part of the contour.

3. The method for training a scene similarity judgment model according to claim 1, characterized in that: When performing data augmentation, the sample image is transformed into HVS Image, perform data augmentation on sample images.

4. The method for training a scene similarity judgment model according to claim 1, characterized in that: use opencv The images obtained after fusion in step S2 are stitched together to obtain positive samples and negative samples respectively; any one of interval insertion stitching, channel stitching, and left-right stitching is used for stitching.

5. The method for training a scene similarity judgment model according to claim 1, characterized in that: When obtaining positive samples and negative samples, the following steps are included: B1. Create multiple folders; B2. Classify the sample images and add them to the above-mentioned multiple folders, where the multiple images in any of the folders meet all of the following conditions:

1. They are in the same scene; 2. They are in different times, seasons, and weather conditions; B3. Image extraction: When making positive samples, randomly select any two images from the same folder; when making negative samples, randomly select any two images from different folders; B4, fusion stitching: stitch the images extracted in step B3, and the stitched image is the image in the positive sample / negative sample.

6. The method for training a scene similarity judgment model according to claim 1, characterized in that: The convolutional neural network structure is as follows: First layer: CONV , the channel is 64, the convolution kernel is 3×3, and the image features are simply extracted, making the length and width of the image become 1 / 2 of the original image; Second layer: CONV , the channel is 128, 3×3 convolution kernel, further extracts information features, and the length and width of the image become 1 / 4 of the original image; Third layer: C2F , the channel is 128, 3×3 convolution kernel, processing and fusing spatial feature information; Fourth floor: CONV , the channel is 256, 3×3 convolution kernel, further extracts information features, and the length and width of the image become 1 / 8 of the original image; Fifth floor: C2F , the channel is 256, 3×3 convolution kernel, processing and fusing spatial feature information; Sixth floor: CONV , the channel is 512, 3×3 convolution kernel, further extracts information features, and the length and width of the image become 1 / 16 of the original image; Seventh floor: C2F , the channel is 512, 3×3 convolution kernel, processing and fusing spatial feature information; Eighth floor: CONV , the channel is 1024, 3×3 convolution kernel, further extracts information features, and the length and width of the image become 1 / 32 of the original image; Tenth floor: C2F , the channel is 1024, 3×3 convolution kernel, processing and fusing spatial feature information; The last layer: fully connected, connects all neurons in the previous layer, maps the input data to an output, and learns the complex relationship between features.

7. The method for training a scene similarity judgment model according to claim 6, characterized in that: Said C2F The processing steps include: C1. Use bilinear interpolation to upsample the image: ; in, is the image before shallow sampling, is the image after shallow sampling, It is bilinear interpolation processing; C2. Fusion of features. The specific calculation process is as follows: ; in, Represents the shallow layer; Represents the deep layer after convolution; and are the weight parameters for shallow and deep learning respectively; It is the deep graph after convolution; is the bias term, represents the activation function, It is the fusion feature.

8. The method for training a scene similarity judgment model according to claim 6, characterized in that: The convolutional neural network structure adopts ArcFace The function is used as the loss function, and its formula is as follows: ; in, Indicates the number of samples in the batch; n Indicates the total number of target categories; represents the environmental feature vector; Represents the weight vector and the input feature vector The angle between represents the weight matrix of the deep learning model Column, representing feature vector of target categories; Represents the input feature vector, which is a high-dimensional feature extracted by the deep learning model; Indicates target categories; Indicates the target category The weight vector With the eigenvector The angle between Said and are obtained by calculating the cosine value between vectors. and The value range is ; is the additive angular margin parameter, which is used to enhance intra-class compactness and inter-class diversity; is the temperature parameter, controlling How smooth the distribution is.

9. A scene similarity judgment model, characterized by: The method is obtained by training using any one of the training methods described in claims 1-8.

10. A scene similarity determination method, characterized in that: Based on the scene similarity judgment model described in claim 9, the method comprises the following steps: D1. Splice the two pictures whose scene similarity needs to be judged to produce a test image; D2, input the image to be tested into the scene similarity judgment model; D3, the scene similarity judgment model expands the feature map into a 1×N vector, multiplies the vector by the weight of the input data, and adds all the results to obtain a weighted sum value; D4, output this value as the similarity between the scenes in the two pictures.

Citation Information

Patent Citations

  • Fish activity method based on neural network

    CN107423745A

  • Image fusion method based on characteristic decomposition enhancement and gradient supplement

    CN118134785A