A method and device for updating change detection samples

By using comparison images and comprehensive similarity algorithms to update the sample library in aerial image change detection, the problems of high manual annotation costs and low accuracy are solved, and the efficient adaptability and accuracy of the detection model are achieved.

CN118334383BActive Publication Date: 2024-08-23山东智航智能装备有限公司
View PDF 33 Cites 0 Cited by

Patent Information

Application Number
CN202410756423.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-13
Publication Date
2024-08-23
Estimated Expiration
2044-06-13

AI Technical Summary

Technical Problem

In aerial image change detection, the cost of manual annotation is high and there are errors and omissions, which leads to a reduction in the accuracy of the model. How to achieve the adaptability and accuracy of the detection model to changes while ensuring a limited sample library.

Method used

By obtaining the comparison image of the same area as the image to be detected, use the current change detection model to perform change detection, determine the similarity comparison object, use the comprehensive similarity algorithm to evaluate the similarity value, determine whether it is less than the threshold, update the sample library, and update the sample library based on the update The subsequent sample library is used to iteratively train the model.

Benefits of technology

It improves the efficiency and accuracy of change detection, keeps the sample library size within a certain range, enhances the adaptability and robustness of the model, reduces manual intervention, and realizes automated processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118334383B
    Figure CN118334383B
Patent Text Reader

Abstract

The present application discloses a change detection sample update method and device, which relates to the field of machine learning technology, including: obtaining an image of the same area as the image to be detected in the sample library as a comparison image; performing change detection on the image to be detected and the comparison image based on the current change detection model to obtain the image change detection result; determining the similarity comparison object based on the image change detection result; performing similarity evaluation on the similarity comparison object based on the comprehensive similarity algorithm to obtain the total similarity value; judging whether the total similarity value is less than the similarity threshold, if so, updating the image to be detected to the sample library; training and iterating the change detection model based on the updated sample library. The method solves the problem of how to ensure the adaptability and detection accuracy of the detection model to changes under the premise of ensuring a limited number of samples in the sample library.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of machine learning technology, and in particular to a change detection sample updating method and device. Background Art

[0002] In the change detection process of aerial images, the labeling of change detection samples requires comparing between aerial images to find the locations where changes have occurred, and accurately annotating and labeling these changed areas at the pixel level. This process is not only time-consuming and labor-intensive, but also requires highly professional knowledge and experience, so it is costly. In addition, due to the subjectivity and limitations of manual labeling, target labels may be mislabeled or missed. These label noises will inevitably interfere with the training process, causing the classifier or detector to blur the distinction between the foreground and background of the image, thereby reducing the accuracy of the model. Therefore, an automatic and low-cost data labeling method based on neural network learning is very necessary.

[0003] In neural network learning, the sample labels in the sample library are the target values ​​that the training model relies on, and their accuracy has a crucial impact on the labeling of change detection samples. However, with the changes in natural solar terms and changes in aerial photography angles, the shape of the target in the image will also change. In order to improve the recognition accuracy of the automatic labeling method for such changes, it depends on the supplementation and update of samples in the sample library for environmental changes and aerial photography angle changes. The continuous expansion of samples will make the sample library gradually large and complex, thus affecting the training efficiency and recognition efficiency of the model.

[0004] Therefore, how to ensure the adaptability and detection accuracy of the detection model to changes while ensuring a limited number of samples in the sample library through intelligent iteration of change detection samples is one of the urgent problems to be solved in the current change detection field. Summary of the invention

[0005] In an embodiment of the present application, a change detection sample updating method is provided to solve the problem of how to ensure the adaptability and detection accuracy of the detection model to changes while ensuring a limited number of samples in the sample library through intelligent iteration of change detection samples.

[0006] In a first aspect, an embodiment of the present application provides a change detection sample updating method, the method comprising: obtaining an image of the same area as the image to be detected in a sample library as a comparison image; performing change detection on the image to be detected and the comparison image based on a current change detection model to obtain an image change detection result; determining a similarity comparison object based on the image change detection result; performing a similarity evaluation on the similarity comparison object based on a comprehensive similarity algorithm to obtain a total similarity value; determining whether the total similarity value is less than a similarity threshold, and if so, updating the image to be detected to the sample library; and training and iterating the change detection model based on the updated sample library.

[0007] In a possible implementation, the determining of a similarity comparison object based on the image change detection result includes: when the image change detection result is a change, the similarity comparison object is the image to be tested and all images of the same area in the sample library at different times; when the image change detection result is no change, judging by a frame difference method whether there is a changed target compared with the image to be tested and the comparison image, and if so, performing circumscribed rectangle fitting on the contour of the changed target, taking the rectangular area as the target, and the similarity comparison object is the target in the image to be tested and the comparison image.

[0008] In a possible implementation, the similarity evaluation of the similarity comparison object based on the comprehensive similarity algorithm to obtain a total similarity value includes: identifying the type of the similarity comparison object; determining the preset weights of each similarity algorithm included in the comprehensive similarity algorithm based on the similarity comparison object type; and obtaining the total similarity value based on each similarity algorithm and its preset weight; wherein the similarity comparison object types include simple scenes, complex scenes, and targets; and the comprehensive similarity algorithm includes a global similarity algorithm, a local similarity algorithm, and a feature point similarity algorithm with preset weights.

[0009] In a possible implementation, the preset weights of the similarity algorithms included in the comprehensive similarity algorithm are determined based on the similarity comparison object type, including: when the similarity comparison object is a complex scene, the weight of the feature point similarity algorithm is 0, and the weight of the local similarity algorithm is greater than the weights of the global similarity algorithms; when the similarity comparison object is a simple scene, the weight of the feature point similarity algorithm is 0, and the weight of the local similarity algorithm is less than the weights of the global similarity algorithms; when the similarity comparison object is a target, the feature point similarity algorithm accounts for all the weights.

[0010] In a possible implementation, the global similarity algorithm includes a structural similarity algorithm and a cosine similarity algorithm; the local similarity algorithm includes an image-aware hash algorithm; and the feature point similarity algorithm includes a SIFT feature point similarity algorithm.

[0011] In a possible implementation, the structural similarity algorithm includes a brightness similarity function, a contrast similarity function and a structural similarity function; when the similarity comparison object is a complex scene, the structural similarity function accounts for the largest proportion; when the similarity comparison object is a simple scene, the contrast similarity function accounts for the largest proportion.

[0012] In one possible implementation, the method performs change detection on the image to be inspected and the comparison image based on the current change detection model to obtain image change detection results, including: performing preliminary change detection on the image to be inspected and the comparison image based on the current change detection model, marking change area result boxes, and obtaining preliminary image change detection results; when the preliminary image change detection result shows that there is a change, further checking the marked change area result boxes, retaining accurate markings, deleting erroneous markings, and correcting incomplete markings, and finally obtaining change detection results.

[0013] In a possible implementation, before obtaining an image of the same area as the image to be inspected in the sample library as a comparison image, it also includes: obtaining two images of the same area at different times, marking the changed areas of the two images as samples; obtaining a preset number of samples to build a sample library; setting training parameters and inputting the samples into a training model to obtain a change detection model.

[0014] In a possible implementation, updating the image to be inspected into the sample library includes: marking the changed areas in the image to be inspected and the comparison image to form a label image; and using the image to be inspected, the comparison image and the corresponding label image as samples to replace the earliest sample of the same area in the sample library.

[0015] In a second aspect, an embodiment of the present application provides a change detection sample updating device, which includes: an acquisition module, used to acquire an image of the same area as the image to be detected in the sample library as a comparison image; a detection module, used to perform change detection on the image to be detected and the comparison image based on the current change detection model, and obtain an image change detection result; a determination module, used to determine a similarity comparison object based on the image change detection result; an evaluation module, used to perform a similarity evaluation on the similarity comparison object based on a comprehensive similarity algorithm to obtain a total similarity value; a judgment module, used to judge whether the total similarity value is less than a similarity threshold, and if so, update the image to be detected to the sample library; an iteration module, used to train and iterate the change detection model based on the updated sample library.

[0016] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects:

[0017] The embodiment of the present application provides a change detection sample update method, which ensures the accuracy and pertinence of the comparison by selecting an image of the same area as the image to be detected from the sample library as a comparison image, and provides high-quality input data for subsequent change detection. By using the current change detection model to perform change detection on the image to be detected and the comparison image, the change area in the image can be quickly and accurately identified, thereby improving the efficiency and accuracy of the detection. Based on the image change detection result, the similarity comparison object is determined, and the comprehensive similarity algorithm is used for evaluation, which can comprehensively consider multiple features of the image, making the similarity evaluation more accurate and scientific. By judging whether the total similarity value is less than the similarity threshold, it is determined whether to update the image to be detected to the sample library, which ensures the real-time and dynamic nature of the sample library, so that it can continuously adapt to new environments and changes, while limiting the size of the sample library to a certain range. Based on the updated sample library, the change detection model is trained and iterated, which can continuously improve the detection ability and adaptability of the model, so that it can better cope with the change detection tasks in various complex scenarios. With the continuous updating of the sample library and the continuous optimization of the model, it can have higher robustness and adaptability for image change detection tasks in various types and scenarios. The entire process, from image acquisition and change detection to updating the sample library based on similarity evaluation, and then updating the detection model based on the updated sample library, is automated, reducing manual intervention and improving the system's automation and operating efficiency. This technical solution ensures that the number of samples in the sample library is always maintained at a certain level while ensuring the adaptability of the detection model to changes and the detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0019] Figure 1 A flow chart of a change detection sample updating method provided in an embodiment of the present application;

[0020] Figure 2 A specific flow chart before obtaining an image of the same area as the image to be inspected in the sample library as a comparison image provided in an embodiment of the present application;

[0021] Figure 3 A specific flow chart of performing change detection on the image to be inspected and the comparison image based on the current change detection model provided in the embodiment of the present application to obtain the image change detection result;

[0022] Figure 4 A specific flow chart for determining a similarity comparison object based on an image change detection result provided in an embodiment of the present application;

[0023] Figure 5 A specific flow chart of performing similarity evaluation on similarity comparison objects to obtain a total similarity value based on a comprehensive similarity algorithm provided in an embodiment of the present application;

[0024] Figure 6 A specific flow chart for determining preset weights of each similarity algorithm included in a comprehensive similarity algorithm based on similarity comparison object types provided in an embodiment of the present application;

[0025] Figure 7 A schematic diagram of an embodiment of the present application showing that when the preliminary detection result of image changes indicates that there is a change, it is necessary to delete the result box of the changed area with an error mark;

[0026] Figure 8 A schematic diagram of an embodiment of the present application showing that when the preliminary detection result of image changes indicates that there is a change, the result box of the accurately marked change area needs to be retained;

[0027] Fig. 9 A schematic diagram of a change area result box provided in an embodiment of the present application, in which the position and shape of a marked change result box are inaccurate and need to be optimized when the preliminary image change detection result is an image in which a change is identified;

[0028] Fig.10 A schematic diagram of the embodiment of the present application showing the corresponding steps when the preliminary detection result of the image change is that the changed image is identified;

[0029] Fig.11 A schematic diagram of the embodiment of the present application showing the corresponding steps when the preliminary detection result of the image change is no change;

[0030] Fig.12 A schematic diagram of two images with high similarity provided in an embodiment of the present application;

[0031] Fig.13 A schematic diagram of two images with low similarity provided in an embodiment of the present application;

[0032] Fig.14 A schematic diagram of a change detection sample updating device provided in an embodiment of the present application;

[0033] Fig.15 A schematic diagram of a change detection sample update server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0034] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0035] The following describes some of the techniques involved in the embodiments of the present application to facilitate understanding, and they should be considered as merely exemplary. Therefore, it should be appreciated by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, some descriptions of well-known functions and structures are omitted in the following description.

[0036] The present application embodiment provides a change detection sample update method, such as Figure 1 As shown, the method includes steps S101 to S106. Among them, Figure 1 This is only an execution order shown in the embodiment of the present application, and does not represent the only execution order of a change detection sample update method. If the final result can be achieved, Figure 1 The steps shown may be performed in parallel or reversed.

[0037] S101: Obtain an image in the same area as the image to be inspected in the sample library as a comparison image.

[0038] Specifically, the comparison image obtained in the sample library is preferably an image of the same region that is closest in time to the image to be inspected.

[0039] Figure 2 A specific flow chart of the method of obtaining an image of the same area as the image to be inspected in the sample library as a comparison image provided in the embodiment of the present application, such as Figure 2 As shown, it includes steps S201 to S203.

[0040] S201: Acquire two images of the same area at different times, and mark the changed areas of the two images as samples.

[0041] S202: Obtain a preset number of samples to construct a sample library.

[0042] S203: Setting training parameters and inputting samples into the training model to obtain a change detection model.

[0043] Specifically, two images of the same area at different times can be obtained, and the changed areas of the two images are annotated as samples. The changed areas in the two images are manually annotated to form a label image, and then the annotated label image and the two original images are added to the sample library as samples. When the image pairs in the sample library meet the preset number, the change detection model is trained. During the training process, the set training parameters include the number of training samples per time, the number of training times, and the training data path. The number of training samples per time determines how much data the model sees in each iteration. This parameter affects the training speed and effect of the model. The number of training times (also called epochs) indicates how many times the entire data set has been trained by the model. The training data path tells the model where to load the training data path. Using the set training parameters, the process of training the model usually involves forward propagation, loss calculation, back propagation, and parameter update. After training, the change detection model can identify the differences between the given two images, that is, the changed areas.

[0044] S102: Perform change detection on the image to be inspected and the comparison image based on the current change detection model to obtain image change detection results.

[0045] Figure 3 The specific flow chart of performing change detection on the image to be detected and the comparison image based on the current change detection model provided in the embodiment of the present application to obtain the image change detection result is as follows Figure 3 As shown, it includes step S301 to step S302.

[0046] S301: Perform preliminary change detection on the image to be inspected and the comparison image based on the current change detection model, mark the result box of the changed area, and obtain the preliminary detection result of the image change.

[0047] S302: When the preliminary detection result of the image change is that there is a change, further check the marked change area result box, retain the accurate markings, delete the wrong markings, and correct the incomplete markings, so as to finally obtain the change detection result.

[0048] Specifically, when the image change detection result is a change, compare and check the change area result box marked on the image to determine whether the marked change area result box is accurate. If the marked change area result box is inaccurate, remove the change area result box. If the marked change area result box is accurate, determine whether the position and shape of the marked change area result box are accurate. If the position and shape of the marked change area result box are accurate, retain the change area result box. If one of the position and shape of the marked change area result box is inaccurate, perform optimization processing. The optimization processing is: recalculate the contour points of the change area result box and perform polygon fitting, and by connecting the feature points, convert the rounded or irregular corners of the contour into square corners, so that it is close to the real shape of the change area result box, thereby finally obtaining the change detection result.

[0049] S103: Determine a similarity comparison object based on the image change detection result.

[0050] Figure 4 A specific flow chart for determining a similarity comparison object based on an image change detection result provided in an embodiment of the present application is as follows: Figure 4 As shown, it includes step S401 to step S402.

[0051] S401: When the image change detection result is that there is a change, the similarity comparison object is the image to be detected and all images of the same area in the sample library at different times.

[0052] S402: When the image change detection result is no change, the frame difference method is used to determine whether there is a changed target between the image to be tested and the comparison image. If so, a circumscribed rectangle is fitted to the contour of the changed target, and the rectangular area is used as the target. The similarity comparison object is the target in the image to be tested and the comparison image.

[0053] Specifically, the specific steps of judging whether there is a changed target between the image to be tested and the comparison image by the frame difference method are as follows: read and calculate the grayscale difference of the corresponding pixels of the image to be tested and the comparison image to obtain a difference image. In order to extract the changed area from the difference image, a grayscale threshold needs to be set. When the grayscale value of a pixel of the difference image is greater than this threshold, the point is considered to have changed, otherwise the point is considered to have not changed, thereby obtaining a binary image containing only two grayscale values ​​of 0 (unchanged) and 1 (changed). Perform morphological operations on the binary image. Among them, the morphological operations include erosion operations and dilation operations. The erosion operation can delete small target anomalies caused by noise or other reasons, which may be false detections. The dilation operation can restore the abnormal area lost due to the erosion operation to ensure the integrity of the abnormal area. In the binary image after the morphological operation, all contour areas are found by edge detection or contour search algorithm. Among them, the contour area represents the boundary of the object in the image. Set the maximum area threshold and the minimum area threshold of the contour area, and delete the contour area greater than the maximum area threshold and the contour area less than the minimum area threshold. The retained contour area is fitted with an edge circumscribed rectangle to form a label image, where these rectangular areas are the detected change targets.

[0054] Figure 7 A schematic diagram of an embodiment of the present application showing that when the preliminary detection result of image changes indicates that there is a change, the result box of the changed area with an error mark needs to be deleted, such as Figure 7 As shown, the change area result boxes marked by Time1 and Time2 are inaccurate, so the marked change area result boxes need to be removed.

[0055] Figure 8 A schematic diagram of an embodiment of the present application showing that when the preliminary detection result of image changes indicates that there is a change, the result box of the accurately marked change area needs to be retained, such as Figure 8 As shown, the change result boxes marked by Time1 and Time2 are accurate, so the marked change area result boxes need to be retained.

[0056] Fig. 9 A schematic diagram of a change area result box provided in an embodiment of the present application when the preliminary image change detection result is to identify a changed image, wherein the position and shape of the marked change result box have an inaccurate change area result box that needs to be optimized, such as Fig. 9 As shown, the outlines of the change result boxes marked by Time1 and Time2 are incomplete, so an optimized change area result box is required.

[0057] Fig.10 A schematic diagram of the embodiment of the present application showing the corresponding steps when the preliminary detection result of the image change is to identify the changed image. Fig.10It indicates that when the image change detection result is an image with changes identified, the label image is obtained after the above-mentioned retention, removal or optimization processing.

[0058] Fig.11 The schematic diagram of the embodiment of the present application is as follows: when the preliminary detection result of the image change is no change, the corresponding steps are performed. Fig.11 As shown in the figure, when the image change detection result is no change, by generating a binary image to obtain a rectangular area, some remaining targets can be detected, thereby improving the detection rate of anomaly detection.

[0059] S104: Performing similarity evaluation on the similarity comparison objects based on the comprehensive similarity algorithm to obtain a total similarity value.

[0060] Figure 5 A specific flow chart of performing similarity evaluation on similarity comparison objects based on a comprehensive similarity algorithm to obtain a total similarity value provided in an embodiment of the present application, such as Figure 5 As shown, it includes steps S501 to S503.

[0061] S501: Identify the similarity comparison object type. Specifically, when the image change detection result is a change, the similarity comparison object type is a scene, and further identify whether it is a simple scene or a complex scene; when the image change detection result is no change, the similarity comparison object type is a target.

[0062] S502: Determine a preset weight of each similarity algorithm included in the comprehensive similarity algorithm based on the similarity comparison object type.

[0063] S503: Obtaining a total similarity value based on each similarity algorithm and its preset weight.

[0064] Among them, similarity comparison object types include simple scenes, complex scenes and targets. The comprehensive similarity algorithm includes a global similarity algorithm with preset weights, a local similarity algorithm and a feature point similarity algorithm.

[0065] Figure 6 A specific flow chart of determining the preset weights of each similarity algorithm included in the comprehensive similarity algorithm based on the similarity comparison object type provided in the embodiment of the present application, such as Figure 6 As shown, it includes steps S601 to S603.

[0066] S601: When the similarity comparison object is a complex scene, the weight of the feature point similarity algorithm is 0, and the weight of the local similarity algorithm is greater than the weights of the global similarity algorithms.

[0067] S602: When the similarity comparison object is a simple scene, the weight of the feature point similarity algorithm is 0, and the weight of the local similarity algorithm is less than the weight of each global similarity algorithm.

[0068] S603: When the similarity comparison object is the target, the feature point similarity algorithm accounts for all the weights.

[0069] Specifically, the global similarity algorithm includes a structural similarity algorithm and a cosine similarity algorithm. The structural similarity algorithm includes a brightness similarity function, a contrast similarity function, and a structural similarity function. When the similarity comparison object is a complex scene, the structural similarity function accounts for the largest proportion. When the similarity comparison object is a simple scene, the contrast similarity function accounts for the largest proportion.

[0070] Specifically, the expression of the brightness similarity function is: .in, is the brightness similarity function, is the average pixel value of the change area x, is the average pixel value of the change area y, , is a constant, and L is the dynamic range of pixel values. The expression of the contrast similarity function is: .in, is the contrast similarity function, is the variance of the variation region x, is the variance of the variation area y, , is a constant, and L is the dynamic range of pixel values. The expression of the structural similarity function is: .in, is the structural similarity function, is the covariance between the change region x and the change region y, For example, for an 8-bit image, since each pixel value ranges from 0 to 255, L=255 is usually set to represent the dynamic range of this pixel value. , .

[0071] Specifically, the expression of the structural similarity algorithm is: .in, is the structural similarity algorithm, is the brightness weight, is the contrast weight, is the structural weight, ,and When the similarity comparison object is a simple scene, such as a hazy foggy day, since such scenes often have low contrast and inconspicuous brightness changes, and relatively little structural information, the importance of contrast is relatively high when calculating the structural similarity algorithm, that is, the contrast similarity function needs to account for the largest proportion. Therefore, in this case, it will be set , to increase the weight of the contrast similarity function in the calculation. For example, when In order to ensure that the sum of the weights is 1, we can set On the contrary, when the similarity comparison object is a complex scene, such as a city landscape with a lot of details, the structural information in the image becomes particularly important because the structural information can reflect the local features and details of the image. Therefore, in this case, , , in order to increase the weight of the structural similarity function in the calculation, it is necessary to maximize the proportion of the structural similarity function. For example, when In order to ensure that the sum of the weights is 1, we can set .

[0072] This method of adaptively adjusting weights enables the structural similarity algorithm to more accurately evaluate the similarity of images in different scenarios, and to better adapt to image similarity evaluation tasks in various complex scenarios. The value range of the structural similarity algorithm is from -1 to 1. When two change regions are exactly the same in brightness, contrast, and structure, the value of the structural similarity algorithm is equal to 1, indicating that the two change regions are completely similar.

[0073] Specifically, the expression of the cosine similarity algorithm is: .in, is the cosine similarity algorithm, A and B represent the feature vectors extracted from the two change regions respectively. and Represent the modes of the two changing regions, and They represent the i-th pixel value at the corresponding position of the two change areas respectively, and n is the number of pixels in the two change areas.

[0074] Specifically, the feature point similarity algorithm includes the SIFT feature point similarity algorithm. For each change region, key points are detected, and a 128-dimensional descriptor is generated for each key point. The key point descriptors of the two change regions are represented as , .in, represents the i-th key point descriptor of the first change region, represents the jth key point descriptor of the second change region, Indicates the specific value of the i-th key point descriptor in the first change area, Indicates the specific value of the jth key point descriptor in the second change region. According to the formula Calculate the similarity of any two descriptors of two change regions. The smaller the distance, the more similar the two descriptors are. is the Euclidean distance between the key point descriptors of two change regions, and Respectively Descriptor and The kth element in the descriptor. According to the formula Determine whether two descriptors are a good matching pair. is the descriptor of the first change region The descriptor of the distance between the second change region and the first change region The closest descriptor The Euclidean distance between is the descriptor of the first change region The descriptor of the distance between the second change region and the first change region The next closest descriptor The Euclidean distance between It is the preset distance threshold, which is usually set to 0.8.

[0075] Specifically, the expression of the feature point similarity algorithm is: .in, is the feature point similarity algorithm, h is the number of matching pairs in the two change regions, and p is the minimum number of key points in the two change regions.

[0076] When calculating the global similarity, if the local detail features are averaged by the global features, it will lead to a very high similarity result. In order to avoid the problem of local detail features affecting the calculation of global features, the perceptual hash algorithm can be used to calculate the local similarity. Scale both change areas to a first preset size, and convert the non-single-channel image into a single-channel grayscale image. Perform a discrete cosine transform on the two scaled grayscale images, take a sub-region of a second preset size in the discrete cosine transform result, and calculate the average value of all elements in the sub-region. Traverse each pixel in the sub-region, and if the brightness value of the traversed pixel value is greater than the average value, add a perceptual hash value of 1 to the index position in the hash string corresponding to the pixel. If the traversed pixel value is less than or equal to the average value, add a perceptual hash value of 0 to the index position in the hash string corresponding to the pixel. According to the formula Calculate the Hamming distance between two change regions. is the Hamming distance between two change regions, n is and The length of the string, I is the indicator function, indicating the judgment and Whether the elements at index f are unequal, when Returns 1 if true, otherwise returns 0. and Represents the perceptual hash values ​​of two change regions. Two change regions with a Hamming distance less than 10 are similar change regions.

[0077] Furthermore, an implementation is listed below to illustrate the process of calculating local similarity using the hash algorithm. Of course, other implementations are also possible, which are not intended to limit the scope of protection of the present application.

[0078] First, the size of the changing area is uniformly scaled to Pixels, so each change area will contain 1024 pixels. Next, for the non-single-channel change area, it is necessary to convert it into a single-channel grayscale image. This step is to simplify the image processing process because the grayscale image only contains brightness information but not color information. Perform a discrete cosine transform on the scaled grayscale image. Discrete cosine transform is a commonly used image compression algorithm that converts an image from the spatial domain to the frequency domain. In this application, discrete cosine transform is used to extract the main frequency components of the change area. Select the top left corner of the data matrix This sub-region usually contains the main low-frequency information of the change area. From left to right and from top to bottom For each pixel in the sub-region, if the brightness value (i.e. grayscale value) of the pixel is greater than the average a, then add "1" to the index position of the corresponding hash string, otherwise add "0". After traversing all the pixels, a 64-bit binary string is obtained (because ), which is the perceptual hash value of the changed region. For the perceptual hash values ​​of two changed regions, the Hamming distance is used to measure the difference between them. The Hamming distance is the number of different characters in the corresponding positions of two strings of equal length. The calculation formula is: . Among them, i traverses from 0 to 63 (because the hash value is 64 bits long). If the Hamming distance between two change regions is less than 10, then the two change regions are usually considered to be similar. This is because the smaller the Hamming distance, the closer the two hash values ​​are in binary representation, which indicates that the original images are more visually similar.

[0079] When it is determined that two change regions are similar, the local similarity algorithm is used to calculate the similarity of the two change regions. The expression of the local similarity algorithm is: .in, is a local similarity algorithm, n is the number of similar windows in the two change regions, and m is the total number of windows extracted from the two change regions. is a value between 0 and 1, which is used to quantify the similarity between two change regions. When n is close to m, Close to 1, indicating that the two change regions are very similar. When n is much smaller than m, Close to 0, it means that the two change regions are very dissimilar.

[0080] Before using the local similarity algorithm to calculate the similarity of two changing regions, the following steps are required: 1. Set the sliding window and step size. The step size is used to determine the distance of each movement when sliding the window on the changing region. The size of the step size determines the density and number of sub-images extracted from the changing region. Perform a sliding operation on the changing region to extract multiple sub-images of the same size as the sliding window. 2. Compare each window in one changing region with the window at the corresponding position in the other changing region, and determine whether the two windows are similar by a similarity measurement method. The similarity measurement method can be the sum of pixel differences, normalized cross-correlation, histogram comparison, etc. 3. Count the number of similar windows in the two changing regions, and calculate the total number of windows extracted from the two changing regions.

[0081] Specifically, the expression of the comprehensive similarity algorithm is: . Among them, H is the comprehensive similarity algorithm, is the structural similarity algorithm, is the cosine similarity algorithm, is the local similarity algorithm, is the feature point similarity algorithm, Structural similarity algorithm The weight of Cosine similarity algorithm The weight of Local similarity algorithm The weight of It is the feature point similarity algorithm The weight of , , .

[0082] When the similarity comparison object is a complex scene, the weight of the feature point similarity algorithm is 0. The reason why the weight of the local similarity algorithm is greater than the weight of each global similarity algorithm is as follows. When the similarity comparison object is a complex scene, the two images usually contain rich texture details and multiple targets. In this case, the local similarity algorithm is more important because it can focus on the local details and textures in the image. Although the global similarity algorithm is still meaningful, the contribution of local similarity may be greater in complex scenes. Therefore, in complex scenes, it is usually set Higher, while and For example, when When To ensure that the local similarity algorithm dominates the total similarity value, and In complex scenes, due to the presence of a large number of details, occlusions, lighting changes, etc., relying solely on feature points for similarity comparison may introduce a lot of errors. Therefore, it may be possible to choose not to use the weights of the feature point similarity algorithm, i.e. .

[0083] Specifically, when the similarity comparison object is a simple scene, the weight of the feature point similarity algorithm is 0. The reason why the weight of the local similarity algorithm is less than the weight of each global similarity algorithm is as follows. When the scene recognition result is a simple scene (such as desert, ocean, sky and other scenes), it indicates that the two images have fewer texture features. In this case, global similarity algorithms are more critical because they can capture the overall structure and color distribution of the image. Local similarity algorithms may contribute less in simple scenes because there are fewer local details and textures in these scenes. Therefore, in simple scenes, it is usually set and Higher, while For example, when When , to ensure that the global similarity algorithm dominates the total similarity value, and Similarly, in simple scenarios, it is also possible to choose not to use the feature point similarity algorithm due to some reasons (such as the feature point detection algorithm is not applicable to the scenario). .

[0084] It should be noted that when the similarity comparison object is the target, the feature point similarity algorithm accounts for all the weights, that is, For the similarity comparison of targets, feature points are usually very important information. These feature points can well describe the key attributes of the target such as shape, size, direction, etc. Therefore, when determining the total similarity value of the target, the feature point similarity algorithm often occupies a dominant position.

[0085] S105: Determine whether the total similarity value is less than the similarity threshold, and if so, update the image to be inspected into the sample library.

[0086] Specifically, if the total similarity value is greater than or equal to the preset comparison threshold, that is, the judgment result is no, it is considered that the changed area may not be a real change, but is caused by noise or false detection. Therefore, the change area result box will be deleted, that is, this area is no longer considered as a real change area. If the total similarity value is less than the preset comparison threshold, that is, the judgment result is yes, it is considered that this change area is a real change, that is, there is a significant difference between the two images in this area. At this time, the changed areas in the image to be tested and the comparison image are marked and a label image is formed. The image to be tested, the comparison image and the corresponding label image are used as samples to replace the earliest sample of the same area in the sample library.

[0087] S106: Train and iterate the change detection model based on the updated sample library.

[0088] Specifically, the specific steps of training and iterating the change detection model based on the updated sample library are as follows. 1. After updating the image to be inspected to the sample library, the sample training text file containing the initial data and the added data is automatically updated to form an updated sample library. Specifically, these text files usually contain metadata, labels and other information of the image data. The updated sample library will contain more actual change cases, providing more valuable data for subsequent model training. 2. The image data in the updated sample library is combined with the set training parameters to retrain the change detection model to obtain a new change detection model. Specifically, during the training process, the model is optimized according to the pre-set training parameters so that it can better identify the changed area in the image. After retraining, a new change detection model is obtained, which will be more accurate and reliable than the previous model in identifying changes and distinguishing noise. 3. The image at the next moment is detected using the new change detection model, and the samples in the sample library are updated according to the detection results. Specifically, for the retained image to be inspected, it will be saved to the sample library again, and the sample training text file will be updated. As the iterative process continues, the data and models in the sample library will gradually be optimized and improved.

[0089] It should be noted that the iteration process will continue until the preset iteration threshold (such as the number of iterations, the degree of improvement in model performance, etc.) is reached. During the iteration process, as new data and models are added, the earliest data and models in the sample library will be gradually replaced to maintain the timeliness and accuracy of the sample library. After multiple iterations, a training sample library containing a large number of actual change cases and efficient change detection models will be formed, providing strong support for subsequent image processing and change detection tasks.

[0090] Fig.12 A schematic diagram of two images with high similarity provided in an embodiment of the present application. Fig.13 A schematic diagram of two images with low similarity provided in an embodiment of the present application, wherein the two images are a test image and a comparison image.

[0091] like Fig.12 and Fig.13 As shown, we can see that the two images represent the performance of the same scene under different solar terms. Fig.12 The two images in show a high degree of similarity, which usually means that the two images are very similar in terms of visual features, lighting conditions, scene layout, etc. Due to the high similarity, it can be inferred that the sample library may already contain images with similar features. Therefore, when building or updating the model, you can consider reducing or deleting these redundant features to improve the efficiency and accuracy of the model. On the contrary, Fig.13 The two images in the figure show a low similarity, which means that there are obvious differences between them. These differences may be due to factors such as changes in solar terms, the growth status of vegetation, changes in lighting conditions, etc. Due to the low similarity, it can be inferred that the sample library may not contain images with such features. In this case, it is beneficial to add these images to the sample library because they can increase the generalization ability of the model and enable it to better adapt to the changes of targets under different solar terms. By effectively managing the sample library, it is possible to ensure that the model has sufficient sample richness while maintaining its efficiency. This is crucial to improve the performance of the model under different solar terms, because different solar terms may cause significant changes in the appearance, posture, etc. of the target. By introducing image samples under different solar terms, the model can be made more robust and flexible, so that accurate detection and recognition can be achieved under various environmental conditions.

[0092] By comparing the total similarity values ​​between images and deciding whether to add or delete images from the sample library based on the total similarity values, an efficient and rich model training sample library can be constructed. This helps improve the model's ability to detect and identify targets under different solar terms, making it more adaptable to the needs of practical applications.

[0093] The present application embodiment also provides a change detection sample updating device 1400, such as Fig.14 As shown, the device includes: an acquisition module 1401, a detection module 1402, a determination module 1403, an evaluation module 1404, a judgment module 1405 and an iteration module 1406.

[0094] The acquisition module 1401 is used to acquire an image in the sample library having the same area as the image to be inspected as a comparison image.

[0095] The detection module 1402 is used to perform change detection on the image to be detected and the comparison image based on the current change detection model to obtain image change detection results.

[0096] The determination module 1403 is used to determine a similarity comparison object based on the image change detection result.

[0097] The evaluation module 1404 is used to perform similarity evaluation on the similarity comparison objects based on a comprehensive similarity algorithm to obtain a total similarity value.

[0098] The judgment module 1405 is used to judge whether the total similarity value is less than the similarity threshold value. If so, the image to be checked is updated to the sample library.

[0099] The iteration module 1406 is used to train and iterate the change detection model based on the updated sample library.

[0100] Some modules in the apparatus described in the present application can be described in the general context of computer executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, classes, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0101] The devices or modules described in the above application embodiments can be implemented by computer chips or entities, or by products with certain functions. For the convenience of description, the above devices are described in various modules according to their functions. When implementing the embodiments of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware. Of course, the module that implements a certain function can also be implemented by combining multiple sub-modules or sub-units.

[0102] The methods, devices or modules described in this application can be implemented in the form of computer-readable program codes. The controller can be implemented in any appropriate manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program codes (such as software or firmware) that can be executed by the (micro)processor, logic gates, switches, application-specific integrated circuits (English: Application Specific Integrated Circuit, referred to as: ASIC), programmable logic controllers and embedded microcontrollers. Examples of controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in the form of pure computer-readable program codes, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded microcontrollers by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included in it for implementing various functions can also be regarded as structures within the hardware component. Or even, the means for realizing various functions may be regarded as both a software module for realizing the method and a structure within a hardware component.

[0103] like Fig.15 As shown, an embodiment of the present application also provides a change detection sample update server, including a memory 1501 and a processor 1502; the memory 1501 is used to store computer executable instructions; the processor 1502 is used to execute computer executable instructions to implement a change detection sample update method described above in an embodiment of the present application.

[0104] The embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores executable instructions, and when a computer executes the executable instructions, the change detection sample updating method described above in the embodiment of the present application can be implemented.

[0105] It can be seen from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary hardware. Based on this understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a software product, or it can be reflected in the implementation process of data migration. The computer software product can be stored in a storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a mobile terminal, a server, or a network device, etc.) to execute the method described in the embodiment of the present application.

[0106] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. All or part of this application can be used in many general or special computer system environments or configurations.

[0107] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit the present application. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some or all of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the present application.

Claims

1. A change detection sample updating method, characterized in that: include: Obtain an image in the same area as the image to be inspected in the sample library as a comparison image; Performing change detection on the image to be detected and the comparison image based on the current change detection model to obtain an image change detection result; Determine a similarity comparison object based on the image change detection result; The determining of the similarity comparison object based on the image change detection result includes: when the image change detection result is a change, the similarity comparison object is the image to be tested and all images of the same area in the sample library at different times; when the image change detection result is no change, judging whether there is a changed target between the image to be tested and the comparison image by a frame difference method, and if so, fitting a circumscribed rectangle to the contour of the changed target, taking the rectangular area as the target, and the similarity comparison object is the target in the image to be tested and the comparison image; Performing similarity evaluation on the similarity comparison objects based on a comprehensive similarity algorithm to obtain a total similarity value; The similarity comparison object is evaluated based on the comprehensive similarity algorithm to obtain a total similarity value, including: identifying the type of the similarity comparison object; determining the preset weight of each similarity algorithm included in the comprehensive similarity algorithm based on the similarity comparison object type; and obtaining the total similarity value based on each similarity algorithm and its preset weight; wherein the similarity comparison object type includes a simple scene image, a complex scene image, and a target in an image; and the comprehensive similarity algorithm includes a global similarity algorithm, a local similarity algorithm, and a feature point similarity algorithm with preset weights; The preset weights of the similarity algorithms included in the comprehensive similarity algorithm are determined based on the similarity comparison object type, including: when the similarity comparison object is a complex scene image, the weight of the feature point similarity algorithm is 0, and the weight of the local similarity algorithm is greater than the weight of each global similarity algorithm; when the similarity comparison object is a simple scene image, the weight of the feature point similarity algorithm is 0, and the weight of the local similarity algorithm is less than the weight of each global similarity algorithm; when the similarity comparison object is a target in an image, the feature point similarity algorithm accounts for all the weights; Determine whether the total similarity value is less than a similarity threshold, and if so, update the image to be tested to the sample library; The change detection model is trained and iterated based on the updated sample library.

2. The change detection sample updating method according to claim 1, characterized in that: The global similarity algorithm includes a structural similarity algorithm and a cosine similarity algorithm; The local similarity algorithm includes an image-aware hash algorithm; The feature point similarity algorithm includes a SIFT feature point similarity algorithm.

3. The change detection sample updating method according to claim 2, characterized in that: The structural similarity algorithm includes brightness similarity function, contrast similarity function and structural similarity function; When the similarity comparison object is a complex scene image, the structural similarity function accounts for the largest proportion; When the similarity comparison object is a simple scene image, the contrast similarity function accounts for the largest proportion.

4. The change detection sample updating method according to claim 1, characterized in that: The step of performing change detection on the image to be detected and the comparison image based on the current change detection model to obtain an image change detection result includes: Based on the current change detection model, preliminary change detection is performed on the image to be detected and the comparison image, and a result box of the changed area is marked to obtain a preliminary detection result of the image change; When the preliminary detection result of image changes shows that there are changes, the marked change area result box is further checked, the accurate markings are retained, the wrong markings are deleted, and the incomplete markings are corrected to finally obtain the change detection result.

5. The change detection sample updating method according to claim 1, characterized in that: Before obtaining an image in the sample library having the same area as the image to be inspected as a comparison image, the method further includes: Get two images of the same area at different times, mark the changed areas of the two images and use them as samples; Obtain a preset number of samples to build a sample library; Training parameters are set and the samples are input into the training model to obtain a change detection model.

6. The change detection sample updating method according to claim 1, characterized in that: The updating of the image to be inspected into the sample library comprises: Marking the changed areas in the image to be inspected and the comparison image to form a label image; The image to be inspected, the comparison image and the corresponding label image are used as samples to replace the earliest sample of the same area in the sample library.

7. A change detection sample updating device, characterized in that: include: An acquisition module is used to acquire an image of the same area as the image to be inspected in the sample library as a comparison image; A detection module, used to perform change detection on the image to be detected and the comparison image based on the current change detection model to obtain an image change detection result; A determination module, used to determine a similarity comparison object based on the image change detection result; The determining of the similarity comparison object based on the image change detection result includes: when the image change detection result is a change, the similarity comparison object is the image to be tested and all images of the same area in the sample library at different times; when the image change detection result is no change, judging whether there is a changed target between the image to be tested and the comparison image by a frame difference method, and if so, fitting a circumscribed rectangle to the contour of the changed target, taking the rectangular area as the target, and the similarity comparison object is the target in the image to be tested and the comparison image; An evaluation module is used to perform similarity evaluation on the similarity comparison object based on a comprehensive similarity algorithm to obtain a total similarity value; the similarity evaluation on the similarity comparison object based on the comprehensive similarity algorithm to obtain a total similarity value includes: identifying the type of similarity comparison object; determining the preset weights of each similarity algorithm included in the comprehensive similarity algorithm based on the similarity comparison object type; obtaining the total similarity value based on each similarity algorithm and its preset weight; wherein the similarity comparison object type includes simple scene images, complex scene images and targets in images; the comprehensive similarity algorithm includes a global similarity algorithm with preset weights, Local similarity algorithm and feature point similarity algorithm; the preset weights of the similarity algorithms included in the comprehensive similarity algorithm are determined based on the similarity comparison object type, including: when the similarity comparison object is a complex scene image, the weight of the feature point similarity algorithm is 0, and the weight of the local similarity algorithm is greater than the weight of each global similarity algorithm; when the similarity comparison object is a simple scene image, the weight of the feature point similarity algorithm is 0, and the weight of the local similarity algorithm is less than the weight of each global similarity algorithm; when the similarity comparison object is a target in an image, the feature point similarity algorithm accounts for all the weights; A judgment module, used to judge whether the total similarity value is less than a similarity threshold, and if so, update the image to be checked into the sample library; The iteration module is used to train and iterate the change detection model based on the updated sample library.

Citation Information

Patent Citations

  • Method for automatically tagging animation scenes for matching through comprehensively utilizing overall color feature and local invariant features

    CN102012939A

  • Global feature and local feature-based cross-lens target retrieval system and method

    CN106933816A

  • Video keyframe extraction method

    CN107844779A

  • Surveillance site image target searching method based on multi-feature detection

    CN108491498A

  • Video detection method and device, computer readable medium and electronic equipment

    CN110163079A