Image processing method and device, equipment, medium and product
By using multiple models to extract features and fusion in the intelligent security inspection system, the problem of low accuracy in identification of contraband in the existing technology is solved, and more efficient security inspection recognition and efficiency improvement is achieved.
Patent Information
- Application Number
- CN202411508701.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-02-14
AI Technical Summary
The existing intelligent security inspection technology has low accuracy in identifying contraband, resulting in low security inspection accuracy.
By acquiring multiple sub-images, each sub-image contains an object to be identified, M first feature data are extracted using the first model, and the feature node and its feature data are determined using the second model, and the two are fused to determine the image feature data, and finally based on The preset relationship is matched to determine the object type.
It improves the recognition accuracy of contraband, thereby improving the accuracy of security checks, reducing the process of uploading images to the server for analysis, and improving the recognition and security check efficiency.
Smart Images

Figure CN119445223A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image processing technology, and in particular, relates to an image processing method, device, equipment, medium and product. Background Art
[0002] With the continuous development of image processing technology, the application of intelligent security inspection technology in public places such as stations and hospitals has become more and more common and efficient. This intelligent security inspection technology is used to detect and analyze objects in images, so as to quickly identify contraband. However, the existing intelligent security inspection technology has low accuracy in identifying contraband, which in turn leads to low security inspection accuracy. Summary of the invention
[0003] The embodiments of the present application provide an image processing method, apparatus, device, medium and product, which improve the recognition accuracy of prohibited items, thereby improving the accuracy of security inspection.
[0004] In a first aspect, an embodiment of the present application provides an image processing method, which is applied to a security inspection terminal, and the method includes:
[0005] Acquire a first image, the first image comprising a plurality of sub-images, each sub-image containing an object to be identified;
[0006] For each sub-image of the plurality of sub-images, using the first model to obtain M first feature data from the sub-image, where M is a positive integer;
[0007] Determine a plurality of feature nodes in the sub-image and third feature data of each feature node using the second model;
[0008] Determine image feature data of the sub-image according to the M first feature data and the third feature data of each feature node;
[0009] Based on the preset correspondence between the first image data and the object type, the image feature data of the sub-image is matched to determine the object type of the object to be identified in the sub-image.
[0010] In an optional implementation of the first aspect, the first image includes a plurality of first pixel points and a pixel value of each first pixel point;
[0011] For each sub-image of the plurality of sub-images, before obtaining M first feature data from the sub-image using the first model, the method further includes:
[0012] Based on the plurality of first pixel points and the pixel value of each first pixel point, filtering each first pixel point is performed to obtain a pixel value to be updated of the first pixel point;
[0013] The updated first image is obtained by updating the pixel value of the first pixel based on the pixel value to be updated of each first pixel.
[0014] In an optional implementation of the first aspect, based on the plurality of first pixels and the pixel value of each first pixel, obtaining the pixel value to be updated of the first pixel by filtering each first pixel includes:
[0015] For each first pixel point among the plurality of first pixel points, obtaining a pixel weight of the first pixel point, where the pixel weight of the first pixel point is used to characterize the importance of the first pixel point;
[0016] Determine, from the plurality of first pixel points, a plurality of second pixel points in a neighborhood of the first pixel point, and determine a pixel weight of each second pixel point and a pixel value of each second pixel point;
[0017] The pixel value to be updated of the first pixel point is obtained based on the pixel weight of each second pixel point in the plurality of second pixel points and the weighted summation of the pixel value of each second pixel point.
[0018] In an optional implementation of the first aspect, obtaining M first feature data from the sub-image using the first model includes:
[0019] Extracting N second feature data from the sub-image using the first model, where N is a positive integer greater than M;
[0020] Based on the N second feature data, M first feature data are constructed.
[0021] In an optional implementation of the first aspect, the sub-image includes a plurality of third pixel points, and each second feature data includes first sub-features corresponding to the plurality of third pixel points respectively;
[0022] Based on the N second feature data, M first feature data are constructed, including:
[0023] For each second feature data in the N second feature data, determine the difference between each first sub-feature in the second feature data and an average value of the plurality of first sub-features as a feature difference value, and obtain a plurality of feature difference values;
[0024] Based on the multiple characteristic difference values, a covariance matrix corresponding to the second characteristic data is constructed, and the eigenvalues and eigenvectors of the covariance matrix are determined to obtain the eigenvalues and eigenvectors corresponding to N covariance matrices respectively;
[0025] Based on the eigenvalues and eigenvectors corresponding to the N covariance matrices, respectively, a target matrix is constructed, where the target matrix includes M eigenvectors, and the M eigenvectors include eigenvectors whose eigenvalues corresponding to eigenvectors selected from the N eigenvectors meet a first preset condition;
[0026] Based on the N second feature data and the target matrix, M first feature data are constructed.
[0027] In an optional implementation of the first aspect, determining a plurality of feature nodes in the sub-image and third feature data of each feature node by using the second model includes:
[0028] Determine a plurality of feature nodes in the sub-image and fourth feature data of each feature node using the second model;
[0029] For each of the plurality of characteristic nodes, the third characteristic data of the characteristic node is determined based on the respective fourth characteristic data of the plurality of characteristic nodes.
[0030] In an optional implementation of the first aspect, the sub-image includes a plurality of third pixel points, each feature node includes at least one third pixel point, and the fourth feature data includes at least one second sub-feature;
[0031] For each of the plurality of characteristic nodes, determining the third characteristic data of the characteristic node based on the respective fourth characteristic data of the plurality of characteristic nodes includes:
[0032] For each second sub-feature of each feature node, determining an adjacent node of the feature node from a plurality of feature nodes;
[0033] Determine the second sub-feature of the adjacent node from the fourth feature data of each of the plurality of feature nodes;
[0034] Based on the second sub-feature of the feature node and the second sub-feature of the adjacent node, the second sub-feature of the feature node is updated to obtain third feature data of the feature node.
[0035] In an optional implementation of the first aspect, determining the image feature data of the sub-image according to the M first feature data and the third feature data of each feature node includes:
[0036] The attention mechanism is used to fuse the M first feature data and the third feature data of each feature node to obtain the image feature data of the sub-image.
[0037] In an optional implementation of the first aspect, the preset correspondence relationship between the first image data and the object type includes a plurality of first image data to be compared and an object type corresponding to each of the first image data to be compared, each of the first image data to be compared includes image feature data of a first comparison image, the first comparison image includes an object to be compared, and the object type corresponding to each of the first image data to be compared is an object type of the object to be compared;
[0038] Based on the preset correspondence between the image data to be compared and the object type, the image feature data of the sub-image is matched to determine the object type of the image to be identified in the sub-image, including:
[0039] For each first comparison image in the plurality of first comparison images, based on image feature data of the first comparison image and image feature data of the sub-image, calculating a similarity between the first comparison image and the sub-image to obtain a plurality of similarities;
[0040] When there is a target similarity among the multiple similarities that satisfies the second preset condition, the object type corresponding to the target similarity is determined to be the object type of the object to be identified.
[0041] In an optional implementation of the first aspect, the method further includes:
[0042] When there is no target similarity among multiple similarities, the image feature data of the sub-image is sent to the cloud server for the cloud server to match the image feature data of the sub-image based on a preset correspondence between the second image data and the object type, where the preset correspondence between the second image data and the object type includes multiple second image data and an object type corresponding to each second image data, and the number of the multiple second image data is greater than the number of the multiple first image data, so as to determine the object type of the object to be identified.
[0043] In a second aspect, an embodiment of the present application provides an image processing device, which is applied to a security inspection terminal, and the device includes:
[0044] An acquisition module, used for acquiring a first image, wherein the first image includes a plurality of sub-images, each of which includes an object to be identified;
[0045] An extraction module, for extracting N second feature data of each sub-image of the plurality of sub-images by using the first model, and constructing M first feature data based on the N second feature data of the sub-image, where N is greater than M, and both N and M are positive integers;
[0046] a determination module, configured to determine, for each of the plurality of sub-images, a plurality of feature nodes in the sub-image and fourth feature data of each feature node using the second model, and update the fourth feature data of each feature node using the respective fourth feature data of the plurality of feature nodes to obtain third feature data, wherein the third feature data includes the updated fourth feature data of each feature node;
[0047] A fusion module, used for fusing the M first feature data and the third feature data to obtain image feature data of a sub-image;
[0048] The matching module is used to match the image feature data of the sub-image based on the preset correspondence between the first image data and the object type, and determine the object type of the object to be identified in the sub-image.
[0049] In a third aspect, an electronic device is provided, comprising: a memory for storing computer program instructions; and a processor for reading and running the computer program instructions stored in the memory to execute the image processing method provided by any optional implementation in the first aspect.
[0050] In a fourth aspect, a computer storage medium is provided, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the image processing method provided by any optional implementation in the first aspect is implemented.
[0051] In a fifth aspect, a computer program product is provided, the computer program product comprising a computer program, and when the computer program is executed by a processor, the image processing method provided by any optional implementation in the first aspect is implemented.
[0052] In an embodiment of the present application, a first image can be obtained, the first image includes multiple sub-images, and each sub-image includes an object to be identified. Then, for each of the multiple sub-images, M first feature data can be obtained from the sub-image using the first model, and then multiple feature nodes in the sub-image and the third feature data of each feature node can be determined using the second model, and the image feature data of the sub-image can be determined based on the M first feature data and the third feature data of each feature data. Then, based on the preset correspondence between the first image data and the object type, the image feature data of the sub-image can be matched to determine the object type of the object to be identified in the sub-image. In this way, more accurate and comprehensive feature data can be obtained by fusing the feature data extracted by different models, thereby improving the accuracy of contraband identification, thereby improving the accuracy of security inspection, and omitting the process of analyzing the above-mentioned image to the server in the prior art, thereby improving the efficiency of contraband identification, thereby improving the efficiency of security inspection. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0054] Figure 1 This is one of the flowcharts of an image processing method provided in an embodiment of the present application;
[0055] Figure 2 This is a second flow chart of an image processing method provided in an embodiment of the present application;
[0056] Figure 3 This is a third flowchart of an image processing method provided in an embodiment of the present application;
[0057] Figure 4 This is a fourth flowchart of an image processing method provided in an embodiment of the present application;
[0058] Figure 5 This is a fifth flowchart of an image processing method provided in an embodiment of the present application;
[0059] Figure 6 This is a sixth flowchart of an image processing method provided in an embodiment of the present application;
[0060] Figure 7 is a structural schematic diagram of an image processing device provided in an embodiment of the present application;
[0061] Figure 8 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0062] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0063] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0064] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0065] In order to solve the problem of low accuracy in identifying contraband in the prior art, the present application provides an image processing method, device, equipment, medium and product, which can obtain a first image, the first image includes multiple sub-images, and each sub-image contains an object to be identified, and then for each of the multiple sub-images, M first feature data can be obtained from the sub-image using a first model, and then multiple feature nodes in the sub-image and third feature data of each feature node can be determined using a second model, and the image feature data of the sub-image can be determined based on the M first feature data and the third feature data of each feature data, and then the image feature data of the sub-image can be matched based on the preset correspondence between the first image data and the object type, and the object type of the object to be identified in the sub-image can be determined. In this way, more accurate and comprehensive feature data can be obtained by fusing the feature data extracted by different models, the accuracy of contraband identification can be improved, thereby improving the accuracy of security inspection, and the process of analyzing the above-mentioned image to the server in the prior art is omitted, thereby improving the efficiency of contraband identification, thereby improving the efficiency of security inspection.
[0066] The image processing method provided in the embodiments of the present application is described in detail below in conjunction with specific embodiments.
[0067] like Figure 1 As shown, the execution subject of the image processing method is a security inspection terminal, and the method may specifically include the following steps:
[0068] S110, acquiring a first image.
[0069] Among them, the above-mentioned first image can be a related image collected by the security inspection terminal. Since the image collected by the security inspection terminal generally contains multiple items, that is, contains multiple objects to be identified, in order to facilitate the subsequent accurate identification, the first image can be divided according to multiple objects to be identified. In this way, in some embodiments, the above-mentioned first image may include multiple sub-images, each sub-image contains an object to be identified.
[0070] S120: For each sub-image of the multiple sub-images, obtain M first feature data from the sub-image using a first model.
[0071] The first model may be constructed based on principal component analysis (PCA), which is not specifically limited here.
[0072] In addition, the M first feature data may be feature data associated with the color, texture, shape, and spatial relationship of the sub-image, etc., which is not specifically limited here.
[0073] Specifically, after acquiring a first image, which includes multiple sub-images, the security inspection terminal can use a first model to acquire M first feature data from each sub-image of the multiple sub-images, so that M first feature data corresponding to each sub-image can be obtained.
[0074] S130, using the second model to determine a plurality of feature nodes in the sub-image and third feature data of each feature node.
[0075] Among them, the above-mentioned second model can be constructed based on a graph neural network, which is not specifically limited here.
[0076] In addition, the above-mentioned feature node may be composed of at least one pixel in the sub-image, which is not specifically limited here. The third feature data of each feature node may be the relevant feature at each feature node, which is not specifically limited here.
[0077] Specifically, after acquiring a first image, which may include multiple sub-images, the security terminal can use the second model to determine multiple feature nodes in the sub-image and third feature data at each feature node for each sub-image.
[0078] S140, obtaining image feature data of the sub-image according to the M first feature data and the third feature data of each feature node.
[0079] For the same sub-image, after using the first model to obtain M first feature data corresponding to the sub-image, and using the second model to obtain the third feature data of each feature node in the sub-image, the security inspection terminal can obtain the image feature data of the sub-image based on the M first feature data and the third feature data of each feature node.
[0080] S150, matching the image feature data of the sub-image based on a preset correspondence between the first image data and the object type, and determining the object type of the object to be identified in the sub-image.
[0081] The preset correspondence between the first image data and the object type may be preset based on actual experience or circumstances, and is not specifically limited here. It should be noted that the preset correspondence between the first image data and the object type may be stored locally in the security inspection terminal, and is not specifically limited here.
[0082] In addition, the above-mentioned object types may include a contraband type and a security type, while the object type of the object to be identified may only be a contraband type or a security type.
[0083] Specifically, after obtaining the image feature data of each sub-image, the image feature data of the sub-image can be matched based on the correspondence between the preset first image data and the object type stored locally in the security inspection terminal to determine the object type of the object to be identified in the sub-image.
[0084] In the embodiment of the present application, a first image can be obtained, the first image includes multiple sub-images, and each sub-image includes an object to be identified. Then, for each of the multiple sub-images, M first feature data can be obtained from the sub-image using the first model, and then multiple feature nodes in the sub-image and the third feature data of each feature node can be determined using the second model, and the image feature data of the sub-image can be determined based on the M first feature data and the third feature data of each feature data, and then the image feature data of the sub-image can be matched based on the preset correspondence between the first image data and the object type, and the object type of the object to be identified in the sub-image can be determined. In this way, accurate and comprehensive feature data can be obtained by fusing the feature data extracted by different models, thereby improving the accuracy of contraband identification, thereby improving the accuracy of security inspection, and omitting the process of analyzing the above-mentioned image to the server in the prior art, thereby improving the efficiency of contraband identification, thereby improving the efficiency of security inspection.
[0085] Considering that images acquired in different environments may have different degrees of noise, in order to prevent the noise in the image from affecting the accuracy of subsequent image recognition, in some embodiments, the first image may include multiple first pixels and a pixel value of each first pixel. Based on this, before the above S120, the image processing method provided in the embodiment of the present application may further include the following steps:
[0086] S210, based on a plurality of first pixel points and a pixel value of each first pixel point, obtaining a pixel value to be updated of the first pixel point by performing filtering processing on each first pixel point;
[0087] S220, updating the pixel value of the first pixel point based on the pixel value to be updated of each first pixel point, to obtain an updated first image.
[0088] Specifically, after acquiring the first image, the security inspection terminal can, since the first image may include multiple first pixel points and the pixel value of each first pixel point, obtain the pixel value to be updated of the first pixel point by filtering each first pixel point based on the multiple first pixel points and the pixel value of each first pixel point, and then update the pixel value of the first pixel point based on the pixel value to be updated of each first pixel point to obtain an updated first image.
[0089] In this embodiment, each pixel point can be filtered to obtain the pixel value to be updated for each pixel point, and the pixel value of the pixel point can be updated. In this way, the noise in the image can be effectively removed, thereby improving the clarity of the image, so that more detailed feature data can be extracted from the image later, and the contraband can be accurately identified, thereby improving the accuracy of security inspection.
[0090] Based on this, in order to more accurately filter each first pixel in the first image so as to effectively remove noise in the image, in one embodiment, the above S220 may specifically include the following steps:
[0091] For each first pixel point among the plurality of first pixel points, obtaining a pixel weight of the first pixel point, where the pixel weight of the first pixel point is used to characterize the importance of the first pixel point;
[0092] Determine, from the plurality of first pixel points, a plurality of second pixel points in a neighborhood of the first pixel point, and determine a pixel weight of each second pixel point and a pixel value of each second pixel point, wherein the plurality of second pixel points include the first pixel point;
[0093] The pixel value to be updated of the first pixel point is obtained based on the pixel weight of each second pixel point in the plurality of second pixel points and the weighted summation of the pixel value of each second pixel point.
[0094] The pixel weight of the first pixel is used to characterize the importance of the first pixel. It should be noted that the pixel weights of the plurality of first pixels included in the first image may be the same or different, which is not specifically limited here.
[0095] In addition, the first pixel point may be included in the plurality of second pixel points in the neighborhood of the first pixel point. The size of the neighborhood may depend on the specific situation and is not specifically limited here.
[0096] Specifically, the security inspection terminal can obtain the pixel weight of each first pixel among multiple first pixel points, and then determine multiple second pixel points within the field of the first pixel point from the multiple first pixel points included in the first image, and then determine the pixel weight of each second pixel point and the pixel value of each second pixel point. In this way, the pixel value to be updated of the first pixel point can be obtained based on the weighted summation of the pixel weight of each second pixel point among the multiple second pixel points and the pixel value of each second pixel point.
[0097] In one example, the image processing method provided by the embodiment of the present application can be to filter the first pixel point using a Gaussian filtering algorithm, which is a commonly used image smoothing algorithm, which uses a Gaussian function (also called a normal distribution function) as a weight to perform weighted averaging on each first pixel point in the first image to reduce image noise. It should be noted that the weight distribution of the pixel weight obtained using the Gaussian filter is a Gaussian distribution, and the pixel weight at the center point is the largest, and the weight gradually decreases as the distance from the center point increases. It should also be noted that the Gaussian filter is a linear filter that smoothes the image while keeping the edge information relatively clear, and is therefore widely used in the field of image processing.
[0098] Thus, the process of obtaining the pixel weight of the first pixel can be expressed as follows:
[0099]
[0100] Where G(x,y) represents the pixel weight at the first pixel point (x,y), and σ is the standard deviation of the Gaussian function, which can control the width of the pixel weight distribution. A larger σ can lead to a wider distribution of pixel weights, resulting in a smoother output image.
[0101] In practical applications, Gaussian filtering is usually implemented through a convolution operation, that is, convolving a Gaussian function with the first image, that is, performing weighted summation based on the pixel weight of each second pixel point in the plurality of second pixel points and the pixel value of each second pixel point, and obtaining the specific process of the pixel value to be updated of the first pixel point can be shown in the following formula (2):
[0102]
[0103] Among them, I ′ (x,y) is the pixel value of the first pixel (x,y) after filtering. I(x,y) is the pixel value of the first pixel (x,y) without filtering, then I(xi,yj) is the pixel value of the second pixel (xi,yj) without filtering, and G(i,j) is the pixel weight of the second pixel (i,j). The size of the convolution kernel is usually (2a+1)×(2b+1), where a and b are the half widths of the convolution kernel.
[0104] It should also be noted that the image processing method provided in the embodiment of the present application may be to filter the first pixel point using other filtering algorithms such as a mean filtering algorithm to remove noise in the first image, which is not specifically limited here.
[0105] In this embodiment, for each first pixel point, a weighted sum can be performed based on the pixel value and pixel weight of each second pixel point in a neighborhood of the first pixel point to accurately obtain the pixel value to be updated of the first pixel point, thereby more accurately filtering each first pixel point in the first image to effectively remove noise in the image.
[0106] In addition, the image processing method provided in the embodiment of the present application can also process the first image through image enhancement technology, such as histogram equalization and contrast adjustment, to further improve the visibility and resolution of the image. Subsequently, image segmentation technology is used to separate different areas in the image in order to more accurately extract key features.
[0107] In order to accurately and in detail describe the image processing method provided by the embodiment of the present application, in one embodiment, Figure 3 As shown, the above S120 may specifically include the following steps:
[0108] S310: Extract N second feature data from the sub-image using the first model.
[0109] S320: construct M first feature data based on the N second feature data.
[0110] The N second feature data may be relevant image features extracted from the sub-image, for example, the features of the color, texture shape and spatial relationship of the N second feature data, which are not specifically limited here. The M first feature data may be new feature data constructed by the N second feature data. Wherein N is a positive integer greater than M.
[0111] Specifically, after obtaining the first image, the security inspection terminal can use the first model to extract N second feature data from each sub-image of the multiple sub-images included in the first image, and then use the first model to construct M first feature data based on the N second feature data.
[0112] In this embodiment, N second feature data can be extracted from the sub-image using the first model, and M first feature data can be constructed based on the N second feature data, where N is greater than M. In this way, by streamlining the feature dimension, the amount of data to be processed later is reduced, the main feature data of the sub-image is retained, and more refined feature data extraction is achieved.
[0113] Based on the foregoing, it can be known that the image processing method provided in the embodiment of the present application can achieve simplification of the feature dimension by constructing M first feature data for each sub-image based on the N second feature data corresponding to the sub-image. Based on this, in order to accurately describe the simplification process of the feature dimension, in some embodiments, the above-mentioned sub-image may include multiple pixels, and accordingly, each second feature data may include first sub-features corresponding to multiple third pixels. Exemplarily, if the second feature data is color feature data, each third pixel in the sub-image will correspond to a color feature value, that is, the second feature data may include multiple first sub-features, and each first sub-feature corresponds to a third pixel.
[0114] Based on this, Figure 4 As shown, the above S320 may specifically include the following steps:
[0115] S410: For each second feature data in the N second feature data, determine the difference between each first sub-feature in the second feature data and an average value of the plurality of first sub-features as a feature difference value, and obtain a plurality of feature difference values.
[0116] S420, constructing a covariance matrix corresponding to the second feature data based on the multiple feature difference values, and determining the eigenvalues and eigenvectors of the covariance matrix, to obtain the eigenvalues and eigenvectors corresponding to N covariance matrices, respectively.
[0117] S430, constructing a target matrix based on the eigenvalues and eigenvectors corresponding to the N covariance matrices.
[0118] In some embodiments, the target matrix may include M eigenvectors, and the M eigenvectors include eigenvectors whose eigenvalues corresponding to eigenvectors selected from N eigenvectors meet a first preset condition. The first preset condition may be preset based on actual experience or circumstances, for example, the preset condition may be that the eigenvalue is greater than a preset threshold, or the first preset condition may be a related condition for selecting eigenvectors corresponding to the first M eigenvalues from the N eigenvalues arranged in a preset order.
[0119] The preset threshold may be preset based on actual experience or situation, which is not specifically limited here. The preset order may be preset based on actual experience or situation, for example, the preset order may be in descending order of feature values, which is not specifically limited here.
[0120] S440, constructing M first feature data based on the N second feature data and the target matrix.
[0121] Specifically, for each of the N second feature data, the average value of the multiple first sub-features in the second feature data can be determined first, and then the difference between each first sub-feature in the second feature data and the average value of the multiple first sub-features can be determined as a feature difference value, and then multiple feature difference values can be obtained. In this way, the multiple first sub-features can be processed so that the centers of the multiple feature difference values obtained after processing are close to the origin, thereby achieving data centering.
[0122] Then, after obtaining multiple characteristic difference values, the security inspection terminal can construct a covariance matrix corresponding to the second characteristic data based on the multiple characteristic data, and determine the eigenvalues and eigenvectors of the covariance matrix. In this way, the eigenvalues and eigenvectors of the covariance matrix corresponding to the N second characteristic data can be obtained.
[0123] Based on this, the security inspection terminal can first select M eigenvectors whose eigenvalues corresponding to the eigenvectors satisfy the first preset condition from the N eigenvectors based on the eigenvalues and eigenvectors corresponding to the N covariance matrices obtained above, and then construct a target matrix based on the M eigenvectors.
[0124] Finally, after the target matrix is constructed, M first feature data can be constructed based on the N second feature data and the target matrix. That is, since the target matrix includes M feature vectors, the N second feature data can be mapped to the vector space composed of the M feature vectors in the target matrix to obtain M first feature data.
[0125] In an example, the process of constructing M first feature data from the N second feature data and the target matrix mentioned above can be shown in the following formula (3):
[0126] X pcn =X·W (3)
[0127] Where: X is the original data matrix, that is, the N second feature data mentioned above. W is a matrix composed of the eigenvectors of the covariance matrix, that is, the target matrix mentioned above, X pcn It is the data after PCA transformation, that is, the M first feature data mentioned above.
[0128] It should be noted that the first model provided in the embodiment of the present application can be constructed based on PCA. It should be noted that PCA can be a set of possibly related variables converted into a set of linearly unrelated variables, i.e., principal cost, through orthogonal transformation. The goal of PCA is to find the direction of maximum variance in the data, i.e., the direction in which the data changes the most. In this way, M first feature data can be extracted from N second feature data of the first image based on the first model. This process not only reduces the amount of data, but also retains the main information of the image, and can extract more refined feature data.
[0129] In this embodiment, multiple second feature data in the first image can be extracted based on the first model, and first feature data with fewer dimensions can be constructed based on the multiple second feature data. In this way, the amount of data that needs to be processed subsequently is reduced, the feature dimension is simplified, the main information of the image is retained, and more refined feature data extraction is achieved.
[0130] In order to accurately describe the image processing method provided by the embodiment of the present application, in one embodiment, Figure 5 As shown, the above S130 may specifically include the following steps:
[0131] S510: Determine a plurality of feature nodes in the sub-image and fourth feature data of each feature node using the second model.
[0132] S520 , for each of the multiple characteristic nodes, determine the third characteristic data of the characteristic node based on the respective fourth characteristic data of the multiple characteristic nodes.
[0133] The fourth feature data may be relevant features at the feature node, such as color, texture shape, spatial relationship and other features, which are not specifically limited here.
[0134] Specifically, after the security inspection terminal obtains the first image, the first image may include multiple sub-images. Based on this, the second model can be used to determine multiple feature nodes in the sub-image and the fourth feature data of each feature node. Then, based on each feature node in the multiple feature nodes, the second model can be used to determine the third feature data of each feature node based on the fourth feature data of each of the multiple feature nodes.
[0135] In this embodiment, the second model can be used to determine multiple feature nodes and the fourth feature data of each feature node, and for each feature node, the feature data of the current feature node is determined based on the fourth feature data of other feature nodes. In this way, the information fusion of context information is achieved, the features of the image are enhanced, and the accuracy and robustness of feature extraction are improved.
[0136] Based on this, in order to be able to describe in more detail and accurately the process of determining the third feature data of each feature node based on the fourth feature data of multiple feature nodes, in one embodiment, the above-mentioned sub-image may include multiple third pixel points, each feature node includes at least one third pixel point, and the fourth feature data includes at least one second sub-feature.
[0137] Based on this, Figure 6 As shown, the above-mentioned S520 may specifically include the following steps:
[0138] S610: For each second sub-feature of each feature node, determine an adjacent node of the feature node from multiple feature nodes.
[0139] S620, determining the second sub-feature of the adjacent node from the fourth feature data of each of the plurality of feature nodes.
[0140] S630: Based on the second sub-feature of the feature node and the second sub-feature of the adjacent node, update the second sub-feature of the feature node to obtain third feature data of the feature node.
[0141] The number of adjacent nodes may be one or more, which is not specifically limited here.
[0142] Specifically, since the sub-image may include multiple third pixel points, and each feature node may include at least one third pixel point among the multiple third pixel points, correspondingly, the fourth feature data may include at least one second sub-feature corresponding to at least one pixel point. In this way, for each second sub-feature of each feature node, the adjacent nodes of the feature node can be first determined from the multiple feature nodes, and then the second sub-features of the connecting nodes can be determined from the fourth feature data of each of the multiple feature nodes. In this way, the second sub-feature of the feature node can be updated based on the second sub-feature of the feature node and the second sub-feature of the adjacent node, and then the third feature data of the feature node can be obtained.
[0143] In one example, the second model provided in the embodiment of the present application uses a graph neural network, the core idea of which is to update the information of each feature node by aggregating the relevant information of the adjacent nodes of each feature node. In this way, the information fusion of contextual information is achieved and the features of the image are enhanced.
[0144] Specifically, the process of updating the second sub-feature of the feature node based on the second sub-feature of the feature node and the second sub-feature of the adjacent node to obtain the third feature data can be shown in the following formula (4):
[0145]
[0146] in, is the feature of node i at layer l, N(i) is the set of adjacent nodes of node i, and cij is a normalization constant.
[0147] In this embodiment, the second model can be used to aggregate the relevant information of the adjacent nodes of each feature node to update the information of the feature node. In this way, the information fusion of the context information is achieved, the features of the image are enhanced, and the accuracy and robustness of feature extraction are improved.
[0148] Based on this, it should also be noted that, in order to enhance the effectiveness and accuracy of feature extraction, a graphics processing unit (GPU) is used to greatly improve the response time of feature extraction, whether in the process of extracting relevant feature data from the sub-image using the first model or in the process of extracting relevant feature data from the sub-image using the second model. During peak periods, a cluster consisting of multiple GPUs can also be used to handle large-scale feature extraction tasks.
[0149] For the same sub-image, after obtaining the M first feature data of the sub-image based on the first model and obtaining the third feature data of each feature node based on the second model, it is necessary to process the M first feature data corresponding to the sub-image and the third feature data of each feature node to obtain the image feature data corresponding to the sub-image. Based on this, in one embodiment, the above S140 may specifically include the following steps:
[0150] The attention mechanism is used to fuse the M first feature data and the third feature data of each feature node to obtain the image feature data of the sub-image.
[0151] Specifically, the security inspection terminal can use the attention mechanism to fuse the M first feature data of the same sub-image and the third feature data of each feature node in the sub-image to obtain the image feature data of the sub-image.
[0152] In this embodiment, for the same sub-image, the attention mechanism can be used to fuse the corresponding M first feature data and the third feature data of each feature node in the sub-image to accurately obtain the image feature data of the sub-image.
[0153] In addition, in order to accurately determine the object type of the object to be identified, in some embodiments, the preset correspondence between the first image data and the object type may include multiple first image data to be compared and the object type corresponding to each first image data to be compared, each first image data to be compared includes image feature data of the first comparison image, and the first comparison image contains the object to be compared, so the object type corresponding to each first image data to be compared is the object type of the object to be compared.
[0154] Based on this, the above-mentioned S150 may specifically include the following steps:
[0155] For each first comparison image in the plurality of first comparison images, based on image feature data of the first comparison image and image feature data of the sub-image, calculating a similarity between the first comparison image and the sub-image to obtain a plurality of similarities;
[0156] When there is a target similarity among the multiple similarities that satisfies the second preset condition, the object type corresponding to the target similarity is determined to be the object type of the object to be identified.
[0157] Among them, the second preset condition can be pre-set based on actual experience or circumstances. For example, the preset condition can be to determine the maximum similarity from multiple similarities, and the maximum similarity is greater than a similarity threshold. The similarity threshold can be pre-set based on actual experience or circumstances, and is not specifically limited here.
[0158] Specifically, the security inspection terminal can calculate the similarity between the first comparison image and the sub-image for each first comparison image in the multiple first comparison images based on the image feature data of the first comparison image and the image feature data of the sub-image, and obtain multiple similarities. Then, when there is a target similarity among the multiple similarities that satisfies the second preset condition, the object type corresponding to the target similarity can be determined as the object type of the object to be identified.
[0159] In this embodiment, for each first comparison image, the similarity between the first comparison image and the sub-image can be calculated, so as to determine whether the object to be identified in the sub-image and the object to be compared in the first comparison image are the same object based on the similarity. If so, the object type of the object to be identified can be directly determined as the object type of the object to be compared. In this way, the object type of the object to be identified can be accurately determined directly at the intelligent terminal, thereby improving the accuracy of security inspection and avoiding the need to upload all image data to the server for identification and analysis, thereby improving the efficiency of security inspection.
[0160] In order to describe the image processing method provided by the embodiment of the present application in more detail, in one embodiment, the above-mentioned image processing method may further include the following steps:
[0161] When there is no target similarity among multiple similarities, the image feature data of the sub-image is sent to the cloud server, so that the cloud server can match the image feature data of the sub-image based on the preset correspondence between the second image data and the object type to determine the object type of the object to be identified.
[0162] In some embodiments, the cloud service end may store a preset correspondence between second image data and object types, and the preset correspondence between second image data and object types may include multiple second image data and the object type corresponding to each second image data, and the number of multiple second image data is greater than the number of multiple first image data.
[0163] It should be noted that the plurality of second image data may include the plurality of first image data, and the plurality of second image data may also not include the plurality of first image data, which is not specifically limited herein.
[0164] Specifically, when there is no target similarity among multiple similarities, that is, the smart terminal cannot accurately identify the object type of the object to be identified based on the relevant data stored locally, the security inspection terminal can send the image feature data of the sub-image to the cloud server for the cloud server to use based on the preset correspondence between the second image data and the object type. Since the preset correspondence between the second image data and the object type includes multiple second image data and the object type corresponding to each second image data, and the number of multiple second image data is greater than the number of multiple first image data, this facilitates the cloud service to more accurately match the image feature data of the sub-image and determine the object type of the object to be identified.
[0165] It should also be noted that each of the above-mentioned second image data may include image feature data of a second comparison image, and the second comparison image also includes the object to be compared. It can be seen that the process by which the cloud service end determines the object type of the object to be identified is similar to the process by which the security inspection terminal determines the object type of the object to be identified, and no further details will be given here.
[0166] In addition, if the security inspection terminal can send relevant data of multiple sub-images to the cloud server, the cloud server may include multiple processing nodes. After the cloud server receives the relevant data of multiple sub-images, the cloud server can assign a corresponding processing node to each sub-image to achieve parallel processing, improve processing efficiency, and thus improve security inspection efficiency.
[0167] In this embodiment, when the object type of the object to be identified cannot be accurately determined locally at the security inspection terminal, the image feature data of the sub-image can be sent to the cloud server, and the image feature data of the sub-image can be more accurately matched by relying on the corresponding relationship of the larger amount of data stored in the cloud server, thereby more accurately identifying contraband.
[0168] In the image processing method provided in the embodiment of the present application, the intelligent terminal uses a rule-based system, fuzzy logic or machine learning model to make feature recognition decisions. First, by combining deep learning, computer vision and image enhancement algorithms, it is possible to extract multiple features of the image, including color, texture, shape and spatial relationship, etc. The fusion of these features significantly improves the accuracy and robustness of recognition. Secondly, this case dynamically adjusts the parameters of the noise reduction and enhancement algorithm according to the noise level and quality of the image. This adaptive process is achieved through a machine learning model, ensuring that each image can obtain the best processing effect.
[0169] In terms of feature processing, this case uses feature selection algorithms, such as principal component analysis, to reduce the dimension of the feature space and remove irrelevant features, thereby reducing computational complexity and accelerating recognition. In addition, this case uses efficient deep learning architectures, such as variants of neural networks, including residual networks (ResNet) and attention mechanisms (AttentionMechanism), which further improve the recognition ability and efficiency of the model.
[0170] In order to better adapt to image recognition tasks in specific scenarios, the image processing method provided by this application can utilize a model pre-trained on a large data set and reduce the reliance on a large amount of labeled data through transfer learning. Through fine-tuning, the model in this case can adapt to new data distribution, thereby improving the accuracy of recognition.
[0171] The model involved in the image processing method provided in the embodiment of the present application can learn and self-optimize from actual operations, monitor the recognition results and system performance in real time, and continuously adjust and improve its parameters and strategies to achieve continuous self-optimization.
[0172] Through these comprehensive methods, the image processing method provided in the embodiments of the present application not only significantly improves the response speed of image processing, but also enhances the generalization ability and robustness of the model, thereby greatly improving the efficiency and accuracy of the overall intelligent inspection process.
[0173] Based on the same inventive concept, the embodiment of the present application also provides an image processing device, which is applied to a security inspection terminal. Figure 7 The image processing device provided in the embodiment of the present application is described in detail.
[0174] Figure 7 It is a structural schematic diagram of an image processing device provided in an embodiment of the present application.
[0175] like Figure 7 As shown, the image processing device 700 may include:
[0176] An acquisition module 710 is used to acquire a first image, where the first image includes a plurality of sub-images, each of which contains an object to be identified;
[0177] The acquisition module 710 is further configured to acquire, for each sub-image of the plurality of sub-images, M first feature data from the sub-image using the first model, where M is a positive integer;
[0178] A determination module 720, configured to determine a plurality of feature nodes in the sub-image and third feature data of each feature node using the second model;
[0179] A determination module 720, configured to determine image feature data of a sub-image according to the M first feature data and the third feature data of each feature data;
[0180] The matching module 730 is used to match the image feature data of the sub-image based on the preset correspondence between the first image data and the object type, and determine the object type of the object to be identified in the sub-image.
[0181] In some embodiments, the first image includes a plurality of first pixels and a pixel value of each first pixel; based on this, the image processing apparatus involved in the embodiment of the present application may further include:
[0182] A filtering module, configured to obtain a pixel value to be updated of the first pixel point by performing filtering processing on each first pixel point based on the plurality of first pixel points and the pixel value of each first pixel point;
[0183] The updating module is used to update the pixel value of the first pixel point based on the pixel value to be updated of each first pixel point to obtain an updated first image.
[0184] In one embodiment, the above-mentioned image processing apparatus further includes an acquisition module and a weighted summation module.
[0185] An acquisition module, used for acquiring a pixel weight of each first pixel among the plurality of first pixel points, where the pixel weight of the first pixel point is used to characterize the importance of the first pixel point;
[0186] The determination module is further used to determine a plurality of second pixel points within the neighborhood of the first pixel point from the plurality of first pixel points, and to determine a pixel weight of each second pixel point and a pixel value of each second pixel point;
[0187] The weighted summation module is used to obtain the pixel value to be updated of the first pixel point based on the pixel weight of each second pixel point in the plurality of second pixel points and the weighted summation of the pixel value of each second pixel point.
[0188] In one embodiment, the image processing device provided in the embodiment of the present application may also include an extraction module and a construction module.
[0189] An extraction module, used for extracting N second feature data from the sub-image using the first model, where N is a positive integer greater than M;
[0190] A construction module is used to construct M first feature data based on N second feature data.
[0191] In some embodiments, the sub-image includes a plurality of third pixel points, and each second feature data includes first sub-features corresponding to the plurality of third pixel points respectively; based on this, the above construction module is specifically used to:
[0192] For each second feature data in the N second feature data, determine the difference between each first sub-feature in the second feature data and an average value of the plurality of first sub-features as a feature difference value, and obtain a plurality of feature difference values;
[0193] Based on the multiple characteristic difference values, a covariance matrix corresponding to the second characteristic data is constructed, and the eigenvalues and eigenvectors of the covariance matrix are determined to obtain the eigenvalues and eigenvectors corresponding to N covariance matrices respectively;
[0194] Based on the eigenvalues and eigenvectors corresponding to the N covariance matrices, respectively, a target matrix is constructed, where the target matrix includes M eigenvectors, and the M eigenvectors include eigenvectors whose eigenvalues corresponding to eigenvectors selected from the N eigenvectors meet a first preset condition;
[0195] Based on the N second feature data and the target matrix, M first feature data are constructed.
[0196] In one embodiment, the determination module is specifically used to determine a plurality of feature nodes in the sub-image and fourth feature data of each feature node using the second model;
[0197] The above-mentioned determination module is specifically used to determine the third characteristic data of each characteristic node among the multiple characteristic nodes based on the respective fourth characteristic data of the multiple characteristic nodes.
[0198] Based on this, in one embodiment, the sub-image includes a plurality of third pixel points, each feature node includes at least one third pixel point, and the fourth feature data includes at least one second sub-feature. Thus, the above-mentioned determination module is specifically used for:
[0199] For each second sub-feature of each feature node, determining an adjacent node of the feature node from a plurality of feature nodes;
[0200] Determine the second sub-feature of the adjacent node from the fourth feature data of each of the plurality of feature nodes;
[0201] Based on the second sub-feature of the feature node and the second sub-feature of the adjacent node, the second sub-feature of the feature node is updated to obtain third feature data of the feature node.
[0202] In one embodiment, the determination module mentioned above is specifically used for:
[0203] The attention mechanism is used to fuse the M first feature data and the third feature data of each feature node to obtain the image feature data of the sub-image.
[0204] In one embodiment, the preset correspondence between the first image data and the object type includes a plurality of first image data to be compared and an object type corresponding to each of the first image data to be compared, each of the first image data to be compared includes a first comparison image and image feature data of the first comparison image, the first comparison image includes an object to be compared, and the object type corresponding to each of the first image data to be compared is the object type of the object to be compared;
[0205] Based on this, the above-mentioned image processing device may further include:
[0206] a calculation module, configured to calculate, for each of the plurality of first comparison images, a similarity between the first comparison image and the sub-image based on image feature data of the first comparison image and image feature data of the sub-image, so as to obtain a plurality of similarities;
[0207] The determination module is further configured to determine, when there is a target similarity among the multiple similarities that satisfies a second preset condition, that the object type corresponding to the target similarity is the object type of the object to be identified.
[0208] In one embodiment, the above-mentioned image processing apparatus may further include a sending module, and the sending module is specifically used for:
[0209] When there is no target similarity among multiple similarities, the image feature data of the sub-image is sent to the cloud server for the cloud server to match the image feature data of the sub-image based on a preset correspondence between the second image data and the object type, where the preset correspondence between the second image data and the object type includes multiple second image data and an object type corresponding to each second image data, and the number of the multiple second image data is greater than the number of the multiple first image data, so as to determine the object type of the object to be identified.
[0210] In an embodiment of the present application, a first image can be obtained, the first image includes multiple sub-images, and each sub-image includes an object to be identified. Then, for each of the multiple sub-images, M first feature data can be obtained from the sub-image using the first model, and then multiple feature nodes in the sub-image and the third feature data of each feature node can be determined using the second model, and the image feature data of the sub-image can be determined based on the M first feature data and the third feature data of each feature data. Then, based on the preset correspondence between the first image data and the object type, the image feature data of the sub-image can be matched to determine the object type of the object to be identified in the sub-image. In this way, more accurate and comprehensive feature data can be obtained by fusing the feature data extracted by different models, thereby improving the accuracy of contraband identification, thereby improving the accuracy of security inspection, and omitting the process of analyzing the above-mentioned image to the server in the prior art, thereby improving the efficiency of contraband identification, thereby improving the efficiency of security inspection.
[0211] Each module in the image processing device provided in the embodiment of the present application can be implemented Figures 1 to 6 The method steps of any of the illustrated embodiments can achieve the corresponding technical effects, and for the sake of brevity, they will not be repeated here.
[0212] Figure 8 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown.
[0213] The electronic device may include a processor 801 and a memory 802 storing computer program instructions.
[0214] Specifically, the processor 801 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0215] The memory 802 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 802 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 802 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 802 may be inside or outside the electronic device. In a particular embodiment, the memory 802 is a non-volatile solid-state memory.
[0216] The memory may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical or other physical / tangible memory storage devices. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.
[0217] The processor 801 implements any one of the image processing methods in the above embodiments by reading and executing computer program instructions stored in the memory 802 .
[0218] In one example, the electronic device may further include a communication interface 803 and a bus 810. Figure 8 As shown, the processor 801, the memory 802, and the communication interface 803 are connected via a bus 810 and communicate with each other.
[0219] The communication interface 803 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0220] Bus 810 includes hardware, software or both, and the parts of electronic equipment are coupled to each other.For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 810 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.
[0221] In addition, in combination with the image processing method in the above embodiment, the embodiment of the present application may provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, the image processing method provided in the embodiment of the present application is implemented.
[0222] An embodiment of the present application also provides a computer program product, which includes a computer program, and the computer program is executed by a processor to implement the image processing method provided in the embodiment of the present application.
[0223] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0224] The functional blocks shown in the above block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0225] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0226] Aspects of the present disclosure are described above with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable image processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable image processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0227] The above are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A method for image processing, characterized in that: Applied to a security inspection terminal, the method comprises: Acquire a first image, wherein the first image includes a plurality of sub-images, each of the sub-images includes an object to be identified; For each sub-image of the plurality of sub-images, using a first model to obtain M first feature data from the sub-image, where M is a positive integer; Determine a plurality of feature nodes in the sub-image and third feature data of each of the feature nodes using the second model; Determine the image feature data of the sub-image according to the M first feature data and the third feature data of each feature node; Based on the preset correspondence between the first image data and the object type, the image feature data of the sub-image is matched to determine the object type of the object to be identified in the sub-image.
2. The method according to claim 1, characterized in that The first image includes a plurality of first pixel points and a pixel value of each of the first pixel points; Before acquiring M first feature data from each sub-image of the plurality of sub-images using the first model, the method further includes: Based on the multiple first pixel points and the pixel value of each of the first pixel points, obtain the pixel value to be updated of the first pixel point by performing filtering processing on each of the first pixel points; An updated first image is obtained by updating the pixel values of the first pixels based on the pixel values to be updated of each of the first pixels.
3. The method according to claim 2, characterized in that The obtaining the pixel value to be updated of the first pixel point by filtering each of the first pixel points based on the multiple first pixel points and the pixel value of each of the first pixel points includes: For each first pixel point among the plurality of first pixel points, obtaining a pixel weight of the first pixel point, where the pixel weight of the first pixel point is used to characterize the importance of the first pixel point; Determine, from the plurality of first pixel points, a plurality of second pixel points in a neighborhood of the first pixel point, and determine a pixel weight of each of the second pixel points and a pixel value of each of the second pixel points; The pixel value to be updated of the first pixel point is obtained based on the pixel weight of each second pixel point in the multiple second pixel points and the weighted summation of the pixel value of each second pixel point.
4. The method according to claim 1, characterized in that: The obtaining M first feature data from the sub-image by using the first model includes: Extracting N second feature data from the sub-image using the first model, where N is a positive integer greater than M; Based on the N second feature data, M first feature data are constructed.
5. The method according to claim 4, characterized in that The sub-image includes a plurality of third pixel points, and each of the second feature data includes first sub-features corresponding to the plurality of third pixel points respectively; The constructing M first feature data based on the N second feature data includes: For each second feature data in the N second feature data, determine the difference between each first sub-feature in the second feature data and an average value of the plurality of first sub-features as a feature difference value, and obtain a plurality of feature difference values; Based on the multiple characteristic difference values, construct a covariance matrix corresponding to the second characteristic data, and determine the eigenvalues and eigenvectors of the covariance matrix to obtain the eigenvalues and eigenvectors corresponding to N covariance matrices respectively; Based on the eigenvalues and eigenvectors respectively corresponding to the N covariance matrices, a target matrix is constructed, wherein the target matrix includes M eigenvectors, and the M eigenvectors include eigenvectors whose eigenvalues corresponding to the eigenvectors selected from the N eigenvectors meet a first preset condition; Based on the N second feature data and the target matrix, M first feature data are constructed.
6. The method according to claim 1, characterized in that The method of using the second model to determine a plurality of feature nodes in the sub-image and third feature data of each of the feature nodes includes: Determine a plurality of feature nodes in the sub-image and fourth feature data of each of the feature nodes using the second model; For each of the plurality of characteristic nodes, the third characteristic data of the characteristic node is determined based on the respective fourth characteristic data of the plurality of characteristic nodes.
7. The method according to claim 6, characterized in that The sub-image includes a plurality of third pixel points, each of the feature nodes includes at least one of the third pixel points, and the fourth feature data includes at least one second sub-feature; The step of determining, for each of the plurality of characteristic nodes, the third characteristic data of the characteristic node based on the respective fourth characteristic data of the plurality of characteristic nodes, comprises: For each second sub-feature of each of the feature nodes, determining an adjacent node of the feature node from the plurality of feature nodes; Determining the second sub-feature of the adjacent node from the fourth feature data of each of the plurality of feature nodes; Based on the second sub-feature of the feature node and the second sub-feature of the adjacent node, the second sub-feature of the feature node is updated to obtain third feature data of the feature node.
8. The method according to claim 1, characterized in that The determining the image feature data of the sub-image according to the M first feature data and the third feature data of each feature node includes: The M first feature data and the third feature data of each feature node are fused using an attention mechanism to obtain image feature data of the sub-image.
9. The method according to claim 1, characterized in that: The preset correspondence relationship between the first image data and the object type includes a plurality of first image data to be compared and an object type corresponding to each of the first image data to be compared, each of the first image data to be compared includes image feature data of a first comparison image, the first comparison image includes an object to be compared, and the object type corresponding to each of the first image data to be compared is the object type of the object to be compared; The matching of the image feature data of the sub-image based on the preset correspondence between the image data to be compared and the object type to determine the object type of the image to be identified in the sub-image includes: For each first comparison image among the plurality of first comparison images, based on image feature data of the first comparison image and image feature data of the sub-image, calculating a similarity between the first comparison image and the sub-image to obtain a plurality of similarities; In the case that there is a target similarity among the multiple similarities that satisfies the second preset condition, the object type corresponding to the target similarity is determined to be the object type of the object to be identified.
10. The method according to claim 9, characterized in that The method further comprises: In the case that there is no target similarity among the multiple similarities, the image feature data of the sub-image is sent to the cloud server, so that the cloud server can match the image feature data of the sub-image based on a preset correspondence between the second image data and the object type, wherein the preset correspondence between the second image data and the object type includes multiple second image data and an object type corresponding to each of the second image data, and the number of the multiple second image data is greater than the number of the multiple first image data, so as to determine the object type of the object to be identified.
11. An image processing device, characterized in that: Applied to a security inspection terminal, the device comprises: An acquisition module, configured to acquire a first image, wherein the first image includes a plurality of sub-images, each of the sub-images including an object to be identified; The acquisition module is further used to acquire, for each sub-image of the multiple sub-images, M first feature data from the sub-image using the first model, where M is a positive integer; A determination module, used for determining a plurality of feature nodes in the sub-image and third feature data of each of the feature nodes by using a second model; The determination module is further used to determine the image feature data of the sub-image according to the M first feature data and the third feature data of each of the feature data; The matching module is used to match the image feature data of the sub-image based on the preset correspondence between the first image data and the object type, so as to determine the object type of the object to be identified in the sub-image.
12. An electronic device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; The processor reads and executes the computer program instructions to implement the image processing method according to any one of claims 1 to 10.
13. A computer storage medium, characterized in that: The computer storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the image processing method according to any one of claims 1 to 8 is implemented.
14. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the image processing method according to any one of claims 1 to 8 is implemented.