An image scene recognition method and device, computer equipment and a storage medium
By introducing an anchor sampling model and a fast global attention mechanism model, the problem of limited receptive field in convolutional neural networks is solved, thereby improving the accuracy and speed of image scene recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECH WUHAN
- Filing Date
- 2020-04-27
- Publication Date
- 2026-05-29
AI Technical Summary
Existing image scene recognition technologies suffer from low accuracy and long processing times due to the limited receptive field size of convolutional neural networks, making it impossible to effectively process global information in images.
An anchor sampling model and a fast global attention mechanism model are adopted. The global features of the image are obtained by anchor sampling and the similarity between anchor points and pixels is calculated, which reduces the number of similarity calculations between pixels and improves the accuracy and speed of image scene recognition.
It improves the accuracy of image scene recognition, while speeding up the recognition process, reducing computational load, and increasing model efficiency.
Smart Images

Figure CN111539353B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of image scene recognition, in particular to an image scene recognition method and device, a computer device and a storage medium. BACKGROUND
[0002] With the development of artificial intelligence technology, the image scene recognition function based on computer vision technology accounts for an increasingly large proportion in the field of image recognition.
[0003] The goal of image scene recognition is to judge different types of scenes in a picture. Unlike picture classification, which classifies objects within a picture, the goal of picture classification is to classify local objects that occupy the main area in a picture. Image scene recognition needs to consider multiple object categories in the picture as a whole, rather than simply judging based on the category of local objects. For example, to determine whether a picture belongs to the scene of "beach", it is necessary to analyze and determine whether multiple categories of objects such as "sand", "sea", "blue sky", etc. exist in the picture at the same time. Conversely, if a local object with the category of "sand" exists in the picture, it will not be possible to correctly distinguish between the two different scene categories of "beach" and "desert". Therefore, compared to picture classification, image scene recognition requires global processing and fusion of picture content in order to accurately understand the scene content of the picture.
[0004] Current image scene recognition models use the same convolutional neural network as standard image classification tasks, treating image scene recognition as a normal image classification task. Since the size of each convolution kernel in the convolutional neural network is limited, the corresponding receptive field size is also limited. For a pixel point, only the information in a limited neighborhood can be modeled after one convolution operation. If you want to model the global information of the picture, you often need to stack multiple layers of convolution to gradually increase the receptive field. However, this method greatly increases the distance of information propagation, and a large amount of information is weakened in the process of information propagation, thereby causing the image scene recognition technology to have the technical problems of low accuracy and long time consumption. SUMMARY
[0005] The embodiments of the present application provide an image scene recognition method and device, a computer device and a storage medium to improve the accuracy of image scene recognition technology.
[0006] To solve the above technical problems, the embodiments of the present application provide the following technical solutions:
[0007] The embodiments of the present application provide an image scene recognition method, which comprises:
[0008] obtaining image features of a target image in a to-be-recognized image;
[0009] The image features of the target image are processed to obtain the global features of the target image. The image features of the target image and the global features are then processed to obtain the image features of anchor points corresponding to each pixel in the target image. The number of anchor points corresponding to each pixel is less than the number of pixels in the target image.
[0010] Based on the image features of each pixel in the target image and the image features of the anchor points corresponding to each pixel, the global information parameters of each pixel in the target image are obtained;
[0011] Based on the image features of each pixel in the target image and global information parameters, scene category prediction is performed on the image to be identified to obtain the scene recognition result of the image to be identified.
[0012] This application provides an image scene recognition device, which includes:
[0013] The acquisition module is used to acquire image features of the target image in the image to be identified;
[0014] An anchor point module is used to process the image features of the target image to obtain the global features of the target image, and to process the image features of the target image and the global features to obtain the image features of anchor points corresponding to each pixel in the target image, wherein the number of anchor points corresponding to each pixel is less than the number of pixels in the target image;
[0015] The global attention module is used to obtain global information parameters of each pixel in the target image based on the image features of each pixel and the image features of the anchor points corresponding to each pixel.
[0016] The recognition module is used to predict the scene category of the image to be recognized based on the image features of each pixel in the target image and global information parameters to obtain the scene recognition result of the image to be recognized.
[0017] This application provides a computer device including a processor and a memory. The memory stores multiple instructions, which are adapted for loading by the processor to execute the steps in the above-described method.
[0018] This application provides a computer-readable storage medium storing multiple instructions adapted for loading by a processor to execute the steps in the above-described method.
[0019] This application provides a novel image scene recognition method, apparatus, computer device, and storage medium. The method first acquires image features of a target image in an image to be recognized. It then processes these image features to obtain global features of the target image. Further processing of the target image features and the global features yields image features corresponding to anchor points for each pixel in the target image. The number of anchor points for each pixel is less than the number of pixels in the target image. Based on the image features of each pixel and the image features of the anchor points, global information parameters for each pixel in the target image are determined. Finally, based on the image features of the target image... The image features of each pixel and global information parameters are used to predict the scene category of the image to be identified, thus obtaining the scene recognition result of the image to be identified. Since this method introduces an anchor sampling model and a fast global attention mechanism model, the image features of the corresponding anchor points for each pixel are first determined. The number of anchor points is much smaller than the total number of pixels. In this way, based on the anchor points, it is not necessary to calculate the similarity between each pixel and all pixels in the image. Only the similarity between the pixel and the corresponding anchor point needs to be calculated to obtain the global information parameters of each pixel. The global information is comprehensively considered to perform image scene recognition. This improves the accuracy of image scene recognition and speeds up the recognition speed. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a network diagram of the identification system provided in the embodiments of this application.
[0022] Figure 2 This is a schematic diagram of the first process of the image scene recognition method provided in the embodiments of this application.
[0023] Figure 3 This is a schematic diagram of the second process of the image scene recognition method provided in the embodiments of this application.
[0024] Figure 4 This is a schematic diagram of the third process of the image scene recognition method provided in the embodiments of this application.
[0025] Figure 5 This is a schematic diagram of the image scene recognition device provided in the embodiments of this application.
[0026] Figure 6 This is a schematic diagram of the structure of the computer device provided in the embodiments of this application.
[0027] Figures 7a to 7d This is a schematic diagram of the model involved in the embodiments of this application.
[0028] Figures 8a to 8b This is a schematic diagram of pixels and anchor points involved in the embodiments of this application. Detailed Implementation
[0029] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0030] In this embodiment of the application, the image to be identified refers to the image whose scene type needs to be identified, including but not limited to pictures, video frames in videos, etc.; the video includes but is not limited to short videos, long videos, etc., short videos can be videos with a length of less than 10 minutes, and long videos can be videos with a length of more than 10 minutes.
[0031] In this embodiment of the application, the target image refers to the set of all pixels in a partial area of the image to be recognized that enters the recognition model. When performing image scene recognition, not all areas of the image are input into the model, but only a partial area of the image is input into the model for recognition, which will be explained in detail below.
[0032] In the embodiments of this application, a certain model or a certain module represents the same object, and the module is implemented by the algorithm corresponding to the model.
[0033] Artificial intelligence (AI) is the theory, methods, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine capable of reacting in a manner similar to human intelligence. In this application, AI technology is primarily used to achieve image scene recognition.
[0034] Computer vision (CV) is a science that studies how to enable machines to "see." More specifically, it refers to machine vision, which uses cameras and computers to replace human eyes in recognizing and measuring targets, and further processes images to create images more suitable for human observation or transmission to instruments. As a scientific discipline, computer vision studies related theories and technologies, attempting to build artificial intelligence systems capable of extracting information from images or multidimensional data. Computer vision technologies typically include image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, 3D object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping (SLAM), and common biometric recognition technologies such as facial recognition and fingerprint recognition. In this application, for the image to be recognized, CV mainly implements scene classification under Image Semantic Understanding (ISU), predicting the scene classification of the image and outputting the prediction results.
[0035] Please see Figure 1 , Figure 1 This is a schematic diagram of a scenario for the identification system provided in this application embodiment. The system may include user-side devices and server-side devices. The user-side devices and server-side devices are connected via various gateways or the Internet, which will not be described in detail here. The user-side devices include multiple terminals 11, and the server-side devices include multiple servers 12.
[0036] Terminal 11 includes, but is not limited to, portable terminals such as mobile phones and tablets, as well as fixed terminals such as computers, kiosks, and advertising machines. It is a service port that users can use and operate. In this application, the terminal provides users with various functions such as labeling image scene categories, setting the number of anchor points, setting spatial sparsity constraints, uploading images to be recognized, and displaying image scene recognition results. For ease of explanation below, terminal 11 is defined as platform terminal 11a and user terminal 11b. Platform terminal 11a is used to set model parameters, image labeling, etc., while user terminal 11b is used to upload images to be recognized and display recognition results, etc.
[0037] Server 12 provides users with various business services, including recognition server 12a, training server 12b, etc. Among them, training server 12b is used for services such as model training, and recognition server 12a is used to receive recognition requests from terminals and return recognition results, etc.
[0038] It should be noted that, Figure 1The system scenario diagram shown is merely an example. The server and scenario described in this application embodiment are for the purpose of more clearly illustrating the technical solution of this application embodiment and do not constitute a limitation on the technical solution provided by this application embodiment. As those skilled in the art will know, with the evolution of the system and the emergence of new business scenarios, the technical solution provided by this application embodiment is also applicable to similar technical problems.
[0039] Figure 2 This is a schematic diagram of the first flowchart of the image scene recognition method provided in this application embodiment. Please refer to [link / reference]. Figure 2 The image scene recognition method includes the following steps:
[0040] 201: Perform model training.
[0041] In one embodiment, the training server first trains the model so that the recognition server can call the model. This step includes: constructing an initial image scene recognition model, the image scene recognition model including basic units composed of residual networks, the basic units including a fast global attention mechanism model, the fast global attention mechanism model including an anchor sampling model; acquiring a scene image set and dividing the scene image set into a training set and a test set; the scene image set including multiple scene images with labeled image scene types; using the training set to perform preliminary training on the initial image scene recognition model to obtain a pre-trained image scene recognition model; using the test set to test and adjust the pre-trained image scene recognition model to obtain a trained image scene recognition model.
[0042] In one embodiment, to improve recognition accuracy, anchor points can be distributed across the entire image as much as possible. Therefore, during model training, spatial sparsity constraints need to be applied to the anchor points. In this case, after constructing the initial image scene recognition model, this step further includes: constructing spatial sparsity constraints; applying the spatial sparsity constraints to the anchor point localization layer of the anchor point sampling model; and, based on the spatial sparsity constraints, using the scene image set to perform preliminary training and testing adjustments on the initial image scene recognition model.
[0043] 202: Obtain the image features of the target image in the image to be identified.
[0044] In one embodiment, when a user needs to obtain other images of the same scene based on a given image, they send a recognition request to the recognition server. The recognition request carries the image to be recognized. After receiving the recognition request, the recognition server performs augmentation processing on the image to be recognized to obtain the image features of the target image. The image features of the target image include the brightness value of each pixel corresponding to multiple dimensions, such as the RGB brightness value of each pixel.
[0045] 203: Process the image features of the target image to obtain the global features of the target image, and process the image features of the target image and the global features to obtain the image features of the anchor points corresponding to each pixel in the target image.
[0046] In one embodiment, the number of anchor points corresponding to each pixel is less than the number of pixels in the target image. For example, the number of pixels in the target image is 224×224=50176, while the number of anchor points k can be 3, etc.
[0047] In one embodiment, this step includes: obtaining a trained anchor sampling model, the anchor sampling model including an anchor positioning layer and a data extraction layer;
[0048] Using the anchor point localization layer in the trained anchor point sampling model, the image features of the target image are processed to obtain the global features of the target image. The image features and the global features of the target image are then processed to determine the position parameters of the anchor points corresponding to each pixel in the target image.
[0049] Using the data extraction layer in the trained anchor sampling model, the image features of the anchor points corresponding to each pixel are determined based on the position parameters of the anchor points and the image features of the target image. The model and the functions of each layer involved in this step will be described in detail below. Through this step, the anchor points corresponding to each pixel can be obtained, for example in... Figure 8a In the scenario shown, pixel (0,0) corresponds to three anchor points m1, m2, and m3. The coordinates of these three anchor points are very likely not integers, so a data extraction layer is needed for processing. If the coordinates of an anchor point are integers, the image features of the corresponding pixel can be directly used as the image features of that anchor point.
[0050] In one embodiment, the step of using the anchor point localization layer in the trained anchor point sampling model to process the image features of the target image to obtain the global features of the target image, and processing the image features of the target image and the global features to determine the position parameters of the anchor points corresponding to each pixel in the target image includes: using a pooling layer in the anchor point localization layer to process the image features of each pixel to obtain the global features of the target image in a first space; using a fully connected layer in the anchor point localization layer to transform the global features of the target image in the first space to obtain the global features of the target image in a second space, and determining them as the global features of the target image; using an expansion layer in the anchor point localization layer to process the global features of the target image to obtain the global features of each pixel in the target image; using a concatenation layer in the anchor point localization layer to concatenate the global features and image features of each pixel in the target image to obtain the comprehensive features of each pixel in the target image; and using a convolutional layer in the anchor point localization layer to process the comprehensive features of each pixel based on a set number of anchor points to obtain the position parameters of the anchor points corresponding to each pixel. The model involved in this embodiment will be described below.
[0051] In one embodiment, the step of using the data extraction layer in the trained anchor sampling model to determine the image features of each pixel's corresponding anchor point based on the position parameters of each pixel's corresponding anchor point and the image features of the target image includes: using the data extraction layer to determine the image features of multiple reference pixels that satisfy a preset relationship with each pixel's corresponding anchor point in spatial location based on the position parameters of each pixel's corresponding anchor point, and processing the image features of the multiple reference pixels corresponding to each anchor point to obtain the image features of each pixel's corresponding anchor point. The step of processing the image features of the multiple reference pixels corresponding to each anchor point to obtain the image features of each pixel's corresponding anchor point includes: processing the image features of the multiple reference pixels corresponding to each anchor point using bilinear interpolation to obtain the image features of each pixel's corresponding anchor point. This step will also be described below.
[0052] 204: Based on the image features of each pixel in the target image and the image features of the anchor points corresponding to each pixel, the global information parameters of each pixel in the target image are obtained.
[0053] In one embodiment, this step includes: using a trained fast global attention mechanism model, determining the similarity between each pixel and its corresponding anchor point based on the image features of each pixel and the image features of each pixel's corresponding anchor point; and determining the number of global information parameters for each pixel based on the similarity between each pixel and its corresponding anchor point, and the image features of each pixel. This step achieves the acquisition of global information parameters for each pixel, resulting in higher accuracy in image scene recognition.
[0054] 205: Based on the image features of each pixel in the target image and global information parameters, perform scene category prediction on the image to be identified to obtain the scene recognition result of the image to be identified.
[0055] In one embodiment, the recognition server uses a trained model to predict the scene category of the image to be recognized and obtains the scene recognition result of the image to be recognized. It can directly return the scene recognition result to the terminal, or it can return other images in the same scene to the terminal according to the scene.
[0056] This embodiment provides an image scene recognition method. The method is based on computer vision technology and introduces an anchor sampling model and a fast global attention mechanism model. Based on the anchor point, it is not necessary to calculate the similarity between each pixel and all pixels in the image. Only the similarity between the pixel and the corresponding anchor point is needed to obtain the global information of the pixel. The global information is comprehensively considered for image scene recognition. This improves the accuracy of image scene recognition and speeds up the recognition process.
[0057] For any pixel in an image, the number of pixels with high similarity to that pixel among the other (H×W-1) pixels in the image is very small. That is, when calculating the similarity of the whole image, the similarity between many pixels and the target pixel is close to 0. These similarity calculation operations have no impact on the final result and can be omitted. Based on this, this application proposes a fast global attention mechanism model algorithm. For any pixel, K anchor points are first selected from the remaining (H×W-1) pixels, where K is much smaller than H×W. For example, for the 224×224 image mentioned below, this image contains a total of 50176 pixels. The value of K can be 3 / 5 / 7, etc. (the larger the value of K, the greater the accuracy of the model, but the slower the calculation speed). For example, if K is 3, then without the fast global attention mechanism model, each pixel needs to calculate similarity 50176 times, and a total of 50176×50176 (more than 2.5 billion) similarity calculations are required. If the fast global attention mechanism model is used, each pixel needs to calculate similarity 3 times, and a total of 50176×3 (approximately 150,000) similarity calculations are required, which greatly reduces the number of calculations. That is, this application only calculates the similarity between the pixel and the corresponding K anchor points. This fast strategy greatly reduces the model's computation time and increases the model's efficiency.
[0058] Figure 3 This is a schematic diagram of the second flowchart of the image scene recognition method provided in the embodiments of this application. Please refer to [link / reference]. Figure 3 The image scene recognition method includes the following steps:
[0059] This embodiment mainly describes the model training.
[0060] 301: Platform users uploaded images labeled with scene types.
[0061] In one embodiment, platform users upload tens of thousands or hundreds of thousands of training images through platform terminal 11a and annotate these images with scene descriptions.
[0062] 302: Platform users set the number of anchor points and spatial sparsity constraints.
[0063] In one embodiment, the platform user sets the number of anchor points K to 3 through the platform terminal 11a, and the spatial sparsity constraint condition is that the distance between anchor points is greater than 2 pixels.
[0064] 303: Training server 12b builds the initial recognition model.
[0065] In one embodiment, training server 12b constructs an initial recognition model. The image scene recognition model includes basic units composed of residual networks, wherein the basic units include a fast global attention mechanism model, and the fast global attention mechanism model includes an anchor sampling model; the recognition model is as follows: Figure 7a As shown, the input to this model is an image of arbitrary size, and the output is the scene classification result of that image. The basic unit of the model is as follows: Figure 7b As shown, the fast global attention mechanism module proposed in this application is added to each basic unit (block) of the standard residual network (ResNet). The fast global attention mechanism module is as follows: Figure 7c As shown, the anchor point sampling module is as follows Figure 7d As shown, this will be described below.
[0066] 304: Training server 12b builds training and test sets.
[0067] In one embodiment, the training server 12b divides the training images uploaded by platform users within the scene image set into a training set and a test set according to a preset ratio, such as a 9:1 ratio.
[0068] 305: The training server 12b uses images from the training set to perform preliminary training on the initial image scene recognition model, thereby obtaining a pre-trained image scene recognition model.
[0069] In one embodiment, the training server 12b applies a spatial sparsity constraint to... Figure 7d The anchor point sampling module shown uses a 3×3 convolution kernel to ensure that the anchor points output by this convolutional layer are as far apart as possible. For example... Figure 8aAs shown, under the first convolution operation parameters, the anchor points m1 to m3 corresponding to pixel (0,0) are relatively evenly distributed, satisfying the spatial sparsity constraint condition, as follows. Figure 8b As shown, under the second type of convolution operation parameters, the anchor points m1 to m3 corresponding to pixel (0,0) are relatively concentrated and do not meet the spatial sparsity constraint. Therefore, the operation parameters of the convolution layer are preferably the first type of convolution operation parameters.
[0070] 306: The training server 12b uses the test set to test and adjust the initially trained image scene recognition model to obtain the trained image scene recognition model.
[0071] The processing of training images is the same during the initial training and testing adjustments, and this step is described together.
[0072] like Figure 7a As shown, the input to the recognition model provided in this application is an image of arbitrary size. Model training requires data of a fixed size. Therefore, the image of arbitrary size is first resized to 256×256, and then a 224×224 pixel region is randomly cropped from it to obtain the image features (H×W×C) of the target image. Here, H is the height value of the image feature, W is the width value of the image feature, and C is the dimension value of the image feature. Before entering the recognition model, dimension C is the same as the type of sub-pixels within a pixel, and dimension C is generally 3. The brightness value of the pixel is used as the basis for the representation. Taking the brightness values of red, green, and blue subpixels as an example, before entering the recognition model, dimension C is 3. In the first dimension, the feature value of the pixel is the brightness value of the red subpixel; in the second dimension, the feature value of the pixel is the brightness value of the green subpixel; and in the third dimension, the feature value of the pixel is the brightness value of the blue subpixel. That is, outside the recognition model, the image feature size of the input image is generally 224×224×3, where 224 and 224 represent the height and width of the input image, respectively, and 3 represents the R, G, and B channels of the image.
[0073] Figure 7b This demonstrates how to incorporate a fast global attention module into the basic modules of a residual network. This module is added before the convolutional layers of the residual network branches. The structure of the fast global attention module is as follows: Figure 7c As shown, Figure 7c The dot in the symbol represents element-wise dot product.
[0074] Within the recognition model, it is assumed that the dimension of the image feature X of the target image is (H×W×C), where H and W represent the spatial size of the feature (note that H×W is generally smaller than the size of the input image 224×224 within the recognition model), and C represents the dimension of the feature (C is generally larger within the recognition model, much greater than 3).
[0075] In Figure 7c a convolution kernel θ, φ, g represent three different convolutional layers. The purpose of these three convolutional layers is to reduce the dimension of the image feature X to reduce the computational complexity. The reduction ratio is r, and r is generally set to 16. After dimensionality reduction, the size of the feature changes from H×W×C to: H×W×C / r, that is:
[0076] θ(X) ∈ R H×W×C / r
[0077] φ(X) ∈ R H×W×C / r
[0078] g(X) ∈ R H×W×C / r
[0079] After that, for each pixel point (i, j) in the spatial position, (0 ≤ i < H, 0 ≤ j < W), the feature dimension after dimensionality reduction is C / r.
[0080] Then, for each dimension c (0 ≤ c < C / r) of the feature of the pixel point (i, j), the anchor sampling module E generates K anchors, representing the K points (with the largest similarity) that are most closely related to the original pixel point (i, j). Since there are a total of C / r dimensions in the feature, for a pixel point (i, j), a total of K×C / r anchors are generated.
[0081] The anchor sampling module E acts on φ(X) and g(X) respectively, generating two outputs Anchor φ and Anchor g . Since there are a total of H×W pixel points in the space for φ(X) and g(X), and each pixel point generates K×C / r anchors, the dimension sizes of Anchor_φ and Anchor_g are H×W×K×C / r, where:
[0082] Anchor φ = E(φ(X)) ∈ R H×W×K×C / r
[0083] Anchor g = E(g(X)) ∈ R H×W×K×C / r
[0084] Here, E represents the anchor sampling module, and Anchor_φ and Anchor_g respectively represent the output features of the anchor sampling module acting on φ(X) and g(X). H and W represent the size of the feature space, C / r represents the size of the feature after dimensionality reduction, and K represents the number of anchors.
[0085] After that, calculate the similarity between each pixel point (i, j) and its corresponding K anchors. When calculating the similarity, the pixel point feature used is θ(X) ∈ R H×W×C / rThe anchor point feature used is Anchor. φ The formula for calculating similarity is:
[0086]
[0087] Where (i,j) represents the (i,j)th pixel in the space, k represents the kth anchor point, and c represents the cth dimension of the feature.
[0088] Then, the softmax (normalization exponent) function is used to normalize the k anchor points for the same pixel (i,j), requiring that the sum of the similarities between the k anchor points and pixel (i,j) is 1. This process can be formally expressed as:
[0089]
[0090] Here, exp represents the exponential function.
[0091] After obtaining the similarity f(i,j,k) between pixel (i,j) and its K anchor points, the pixel's features are transformed into a weighted sum of the features of the K anchor points. In the weighted summation process, the weights are the similarity f(i,j,k), and the anchor features used are Anchor points. g The formalized expression for this process is as follows:
[0092]
[0093] Where (i,j) represents the spatial location, k represents the k-th anchor point, and c represents the c-th dimension of the feature.
[0094] After obtaining the weighted features, we apply an additional 1×1 convolution to the features. The feature dimension is restored to C, making the weighted feature size consistent with the original input feature X. Finally, the output of the entire module is obtained by adding the original feature X and the weighted summation feature.
[0095] For the anchor point sampling module, such as Figure 7d As shown, for any pixel (i,j) of the features φ and g, the network automatically learns k anchor points closely related to the point (i,j) and uses bilinear interpolation and other methods to obtain the feature values of φ and g located at these anchor points.
[0096] Since the anchor sampling module requires both global information and local information near pixel (i,j), it first uses an Avg Pooling strategy to obtain image features of the image to be identified based on the output features of φ and g. Then, a fully connected layer transforms these image features to obtain global information. Next, an expansion layer obtains the global information corresponding to each pixel. Finally, a concatenation layer concatenates this information (the global information corresponding to each pixel) with the original φ and g features to obtain a mixed feature. This mixed feature is then passed through a 3×3 convolution kernel to obtain a vector of dimension H×W×2k, where 2k represents the K anchor positions generated for a pixel (i,j), with each anchor position having a horizontal and vertical offset relative to the original pixel (i,j). Based on the offsets of these k anchor points, bilinear interpolation is used to obtain the value of each anchor point on the original φ and g features. Figure 7d In this model, for each original pixel (i,j), the anchor sampling module can obtain new feature values located at k anchor positions. These k anchor feature values are then used to calculate the similarity.
[0097] For example, in one embodiment, the dimensions of features φ(X) and g(X) are H×W×C / r. The pooling layer operates at the spatial level, averaging the feature values of H×W pixels of φ(X) and g(X) to obtain features of dimension 1×C / r. A fully connected layer is essentially a matrix transformation, projecting 1×M-dimensional features onto 1×N-dimensional features, from one space to another. In this application, since the original φ(X) and g(X) features focus more on local information, although they are summarized by averaging, this average value is not very good for modeling global information. Therefore, a fully connected layer is used to transform the feature space, projecting it onto another feature space of dimension C / r, where the global feature 1×C / r is modeled. The subsequent expand operation directly copies the global feature 1×C / r H×W times at the spatial level, obtaining a global feature of dimension H×W×C / r, meaning that every pixel in the space shares the same global feature. Next, this global feature is concatenated with the original φ(X) and g(X) features to obtain an H×W×2C / r dimensional feature. Finally, a 3×3 convolution is applied to this concatenated feature to obtain the positions of K anchor points. Specifically, each anchor point has horizontal and vertical coordinates in space, so a total of 2K values are output, representing the offset values of the K anchor points of each pixel (i,j) relative to the spatial pixel point (i,j) in the horizontal and vertical coordinates. Based on this offset value and the spatial position of each pixel (i,j), the position of the anchor point corresponding to each pixel can be obtained.
[0098] In one embodiment, such as Figure 8a As shown, for anchor point m1, its related pixels are (2,0), (3,0), (2,1), and (3,1). Based on the feature parameters of these four pixels, the feature parameters of anchor point m1 can be calculated using the bilinear interpolation method.
[0099] 307: Training server 12b sends the trained image scene recognition model to the recognition server.
[0100] In one embodiment, after the training server completes the training, it sends the trained image scene recognition model to the recognition server, which can then perform subsequent image scene recognition.
[0101] In this embodiment, the training server 12b trained the model based on computer vision technology.
[0102] Figure 4 This is a schematic diagram of the third process of the image scene recognition method provided in the embodiments of this application. Please refer to [link / reference]. Figure 4 The image scene recognition method includes the following steps:
[0103] This embodiment mainly describes image recognition.
[0104] 401: The user uploaded an image that needs to be recognized.
[0105] In one embodiment, when a user needs to obtain other images of the same scene based on a certain image, the user sends a recognition request to the recognition server. The recognition request carries the image to be recognized.
[0106] 402: The recognition server performs image scene recognition.
[0107] For details on how to implement this step, please refer to [link / reference]. Figure 3 The embodiment shown has the following provisions. Figures 7a to 7d The description.
[0108] 403: The identification server 12a returns the identification result to the terminal.
[0109] In one embodiment, the recognition server returns the recognition results of the image scene to the terminal for the terminal to display to the user.
[0110] In this embodiment, the recognition server 12a first acquires the image features of the target image in the image to be recognized. Using a trained anchor sampling model, it determines the image features of the anchor points corresponding to each pixel in the target image based on the image features of each pixel. Then, using a trained fast global attention mechanism model, it determines the global information parameters of each pixel in the target image based on the image features of each pixel and the image features of the anchor points corresponding to each pixel. Finally, based on the image features of each pixel in the target image and the global information parameters, it performs scene category prediction on the image to be recognized to obtain the scene recognition result. This improves the accuracy of image scene recognition while also accelerating the recognition speed.
[0111] Correspondingly, Figure 5 This is a schematic diagram of the image scene recognition device provided in the embodiments of this application. Please refer to it. Figure 5 The image scene recognition device includes the following modules:
[0112] Training module 501 is used to train the model to obtain the trained model;
[0113] The acquisition module 502 is used to acquire the image features of the target image in the image to be identified;
[0114] Anchor point module 503 is used to process the image features of the target image to obtain the global features of the target image, and process the image features of the target image and the global features to obtain the image features of anchor points corresponding to each pixel in the target image, wherein the number of anchor points corresponding to each pixel is less than the number of pixels in the target image;
[0115] The global attention module 504 is used to obtain global information parameters of each pixel in the target image based on the image features of each pixel in the target image and the image features of the anchor points corresponding to each pixel.
[0116] The recognition module 505 is used to predict the scene category of the image to be recognized based on the image features of each pixel in the target image and global information parameters to obtain the scene recognition result of the image to be recognized.
[0117] In one embodiment, the training module 501 is configured to: construct an initial image scene recognition model, the image scene recognition model including basic units composed of residual networks, the basic units including a fast global attention mechanism model, the fast global attention mechanism model including an anchor sampling model; acquire a scene image set and divide the scene image set into a training set and a test set; the scene image set includes multiple scene images with labeled image scene types; use the training set to perform preliminary training on the initial image scene recognition model to obtain a pre-trained image scene recognition model; use the test set to test and adjust the pre-trained image scene recognition model to obtain a trained image scene recognition model.
[0118] In one embodiment, the training module 501 is used to: construct spatial sparse constraints; apply the spatial sparse constraints to the anchor point positioning layer of the anchor point sampling model; and, based on the spatial sparse constraints, use the scene image set to perform preliminary training and testing adjustments on the initial image scene recognition model.
[0119] In one embodiment, the anchor point module 503 is configured to: acquire a trained anchor point sampling model, the anchor point sampling model including an anchor point localization layer and a data extraction layer; use the anchor point localization layer in the trained anchor point sampling model to process the image features of the target image to obtain the global features of the target image, and process the image features of the target image and the global features to determine the position parameters of the anchor points corresponding to each pixel in the target image; use the data extraction layer in the trained anchor point sampling model to determine the image features of the anchor points corresponding to each pixel based on the position parameters of the anchor points corresponding to each pixel and the image features of the target image.
[0120] In one embodiment, the anchor point module 503 is configured to: use a pooling layer in the anchor point positioning layer to process the image features of each pixel to obtain global features of the target image in a first space; use a fully connected layer in the anchor point positioning layer to transform the global features of the target image in the first space to obtain global features of the target image in a second space, and determine them as global features of the target image; use an extension layer in the anchor point positioning layer to process the global features of the target image to obtain global features of each pixel in the target image; use a stitching layer in the anchor point positioning layer to stitch together the global features and image features of each pixel in the target image to obtain comprehensive features of each pixel in the target image; and use a convolutional layer in the anchor point positioning layer to process the comprehensive features of each pixel based on a set number of anchor points to obtain position parameters of the anchor points corresponding to each pixel.
[0121] In one embodiment, the anchor point module 503 is used to: use the data extraction layer to determine the image features of a plurality of reference pixels that satisfy a preset relationship with the anchor points corresponding to each pixel in spatial position based on the position parameters of the anchor points corresponding to each pixel, and process the image features of the plurality of reference pixels corresponding to each anchor point to obtain the image features of the anchor points corresponding to each pixel.
[0122] In one embodiment, the anchor point module 503 is used to: process the image features of multiple reference pixels corresponding to each anchor point using a bilinear interpolation method to obtain the image features of the anchor point corresponding to each pixel.
[0123] In one embodiment, the global attention module 504 is used to: use a trained fast global attention mechanism model to determine the similarity between each pixel and its corresponding anchor point based on the image features of each pixel and the image features of the corresponding anchor point; and determine the global information parameters of each pixel based on the similarity between each pixel and its corresponding anchor point, and the image features of each pixel.
[0124] Accordingly, embodiments of this application also provide a computer device, which includes a server or a terminal, etc.
[0125] like Figure 6 As shown, the computer device may include a radio frequency (RF) circuit 601, a memory 602 including one or more computer-readable storage media, an input unit 603, a display unit 604, a sensor 605, an audio circuit 606, a wireless Fidelity (WiFi) module 607, a processor 608 including one or more processing cores, and a power supply 609, among other components. Those skilled in the art will understand that... Figure 6 The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:
[0126] RF circuit 601 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and hands it over to one or more processors 608 for processing; additionally, it transmits uplink data to the base station. Memory 602 can be used to store software programs and modules. Processor 608 executes various functional applications and data processing by running the software programs and modules stored in memory 602. Input unit 603 can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
[0127] The display unit 604 can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of computer devices, which can be composed of graphics, text, icons, videos, and any combination thereof.
[0128] The computer device may also include at least one sensor 605, such as a light sensor, a motion sensor, and other sensors. Audio circuitry 606 includes a speaker and a microphone that provide an audio interface between the user and the computer device.
[0129] WiFi is a short-range wireless transmission technology. Computer devices using the WiFi module 607 can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 6 WiFi module 607 is shown, but it is understood that it is not a necessary component of computer equipment and can be omitted as needed without changing the nature of the application.
[0130] The processor 608 is the control center of the computer device. It connects various parts of the mobile phone through various interfaces and lines. By running or executing software programs and / or modules stored in the memory 602, and calling data stored in the memory 602, it performs various functions of the computer device and processes data, thereby performing overall testing of the mobile phone.
[0131] The computer device also includes a power supply 609 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 608 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.
[0132] Although not shown, the computer device may also include a camera, Bluetooth module, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 608 in the computer device loads the executable files corresponding to the processes of one or more applications into the memory 602 according to the following instructions, and the processor 608 runs the applications stored in the memory 602 to achieve the following functions:
[0133] Obtain the image features of the target image in the image to be identified;
[0134] The image features of the target image are processed to obtain the global features of the target image. The image features of the target image and the global features are then processed to obtain the image features of anchor points corresponding to each pixel in the target image. The number of anchor points corresponding to each pixel is less than the number of pixels in the target image.
[0135] Based on the image features of each pixel in the target image and the image features of the anchor points corresponding to each pixel, the global information parameters of each pixel in the target image are obtained;
[0136] Based on the image features of each pixel in the target image and global information parameters, scene category prediction is performed on the image to be identified to obtain the scene recognition result of the image to be identified.
[0137] In one embodiment, the function is implemented as follows:
[0138] Obtain the trained anchor sampling model, which includes an anchor positioning layer and a data extraction layer;
[0139] Using the anchor point localization layer in the trained anchor point sampling model, the image features of the target image are processed to obtain the global features of the target image. The image features and the global features of the target image are then processed to determine the position parameters of the anchor points corresponding to each pixel in the target image.
[0140] Using the data extraction layer in the trained anchor sampling model, the image features of the anchor points corresponding to each pixel are determined based on the position parameters of the anchor points corresponding to each pixel and the image features of the target image.
[0141] In one embodiment, the function is implemented as follows:
[0142] The pooling layer in the anchor point positioning layer is used to process the image features of each pixel to obtain the global features of the target image in the first space.
[0143] Using the fully connected layer in the anchor point positioning layer, the global features of the target image in the first space are transformed to obtain the global features of the target image in the second space, and determined as the global features of the target image;
[0144] Using the extended layer in the anchor point positioning layer, the global features of the target image are processed to obtain the global features of each pixel in the target image;
[0145] Using the stitching layer in the anchor point positioning layer, the global features and image features of each pixel in the target image are stitched together to obtain the comprehensive features of each pixel in the target image.
[0146] Using the convolutional layer in the anchor point positioning layer, the comprehensive features of each pixel are processed based on the set number of anchor points to obtain the position parameters of the anchor points corresponding to each pixel.
[0147] In one embodiment, the function is implemented as follows:
[0148] Using the data extraction layer, image features of multiple reference pixels that satisfy a preset relationship in spatial position with the anchor points corresponding to each pixel are determined based on the position parameters of the anchor points corresponding to each pixel, and the image features of the multiple reference pixels corresponding to each anchor point are processed to obtain the image features of the anchor points corresponding to each pixel.
[0149] In one embodiment, the function is implemented as follows:
[0150] The image features of each anchor point are obtained by processing the image features of multiple reference pixels corresponding to each anchor point using a bilinear interpolation method.
[0151] In one embodiment, the function is implemented as follows:
[0152] Using the trained fast global attention mechanism model, the similarity between each pixel and its corresponding anchor point is determined based on the image features of each pixel and the image features of each pixel's corresponding anchor point; the global information parameters of each pixel are determined based on the similarity between each pixel and its corresponding anchor point, as well as the image features of each pixel.
[0153] In one embodiment, the function is implemented as follows:
[0154] An initial image scene recognition model is constructed, which includes basic units composed of residual networks, and the basic units include a fast global attention mechanism model, which includes an anchor sampling model.
[0155] A scene image set is acquired and divided into a training set and a test set; the scene image set includes scene images with multiple labeled image scene types.
[0156] The initial image scene recognition model is pre-trained using the training set to obtain a pre-trained image scene recognition model.
[0157] The image scene recognition model after initial training was tested and adjusted using the test set to obtain the trained image scene recognition model.
[0158] In one embodiment, the function is implemented as follows:
[0159] Construct spatial sparse constraints;
[0160] The spatial sparse constraint condition is used to apply spatial sparse constraint to the anchor point positioning layer of the anchor point sampling model.
[0161] Based on the spatial sparsity constraint, the initial image scene recognition model is initially trained and tested using the scene image set.
[0162] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the detailed description above, and they will not be repeated here.
[0163] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0164] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to perform the following functions:
[0165] Obtain the image features of the target image in the image to be identified;
[0166] The image features of the target image are processed to obtain the global features of the target image. The image features of the target image and the global features are then processed to obtain the image features of anchor points corresponding to each pixel in the target image. The number of anchor points corresponding to each pixel is less than the number of pixels in the target image.
[0167] Based on the image features of each pixel in the target image and the image features of the anchor points corresponding to each pixel, the global information parameters of each pixel in the target image are obtained;
[0168] Based on the image features of each pixel in the target image and global information parameters, scene category prediction is performed on the image to be identified to obtain the scene recognition result of the image to be identified.
[0169] In one embodiment, the function is implemented as follows:
[0170] Obtain the trained anchor sampling model, which includes an anchor positioning layer and a data extraction layer;
[0171] Using the anchor point localization layer in the trained anchor point sampling model, the image features of the target image are processed to obtain the global features of the target image. The image features and the global features of the target image are then processed to determine the position parameters of the anchor points corresponding to each pixel in the target image.
[0172] Using the data extraction layer in the trained anchor sampling model, the image features of the anchor points corresponding to each pixel are determined based on the position parameters of the anchor points corresponding to each pixel and the image features of the target image.
[0173] In one embodiment, the function is implemented as follows:
[0174] The pooling layer in the anchor point positioning layer is used to process the image features of each pixel to obtain the global features of the target image in the first space.
[0175] Using the fully connected layer in the anchor point positioning layer, the global features of the target image in the first space are transformed to obtain the global features of the target image in the second space, and determined as the global features of the target image;
[0176] Using the extended layer in the anchor point positioning layer, the global features of the target image are processed to obtain the global features of each pixel in the target image;
[0177] Using the stitching layer in the anchor point positioning layer, the global features and image features of each pixel in the target image are stitched together to obtain the comprehensive features of each pixel in the target image.
[0178] Using the convolutional layer in the anchor point positioning layer, the comprehensive features of each pixel are processed based on the set number of anchor points to obtain the position parameters of the anchor points corresponding to each pixel.
[0179] In one embodiment, the function is implemented as follows:
[0180] Using the data extraction layer, image features of multiple reference pixels that satisfy a preset relationship in spatial position with the anchor points corresponding to each pixel are determined based on the position parameters of the anchor points corresponding to each pixel, and the image features of the multiple reference pixels corresponding to each anchor point are processed to obtain the image features of the anchor points corresponding to each pixel.
[0181] In one embodiment, the function is implemented as follows:
[0182] The image features of each anchor point are obtained by processing the image features of multiple reference pixels corresponding to each anchor point using a bilinear interpolation method.
[0183] In one embodiment, the function is implemented as follows:
[0184] Using the trained fast global attention mechanism model, the similarity between each pixel and its corresponding anchor point is determined based on the image features of each pixel and the image features of each pixel's corresponding anchor point; the global information parameters of each pixel are determined based on the similarity between each pixel and its corresponding anchor point, as well as the image features of each pixel.
[0185] In one embodiment, the function is implemented as follows:
[0186] An initial image scene recognition model is constructed, which includes basic units composed of residual networks, and the basic units include a fast global attention mechanism model, which includes an anchor sampling model.
[0187] A scene image set is acquired and divided into a training set and a test set; the scene image set includes scene images with multiple labeled image scene types.
[0188] The initial image scene recognition model is pre-trained using the training set to obtain a pre-trained image scene recognition model.
[0189] The image scene recognition model after initial training was tested and adjusted using the test set to obtain the trained image scene recognition model.
[0190] In one embodiment, the function is implemented as follows:
[0191] Construct spatial sparse constraints;
[0192] The spatial sparse constraint condition is used to apply spatial sparse constraint to the anchor point positioning layer of the anchor point sampling model.
[0193] Based on the spatial sparsity constraint, the initial image scene recognition model is initially trained and tested using the scene image set.
[0194] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0195] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0196] Since the instructions stored in the storage medium can execute the steps of any of the methods provided in the embodiments of this application, the beneficial effects that any of the methods provided in the embodiments of this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0197] The foregoing has provided a detailed description of an image scene recognition method and apparatus, computer device and computer-readable storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. An image scene recognition method, characterized in that, include: Obtain the image features of the target image in the image to be identified; The image features of the target image are processed to obtain the global features of the target image. The image features and the global features of the target image are then processed to obtain the image features of anchor points corresponding to each pixel in the target image. This process includes: acquiring a trained anchor point sampling model, which includes an anchor point localization layer and a data extraction layer; using a pooling layer in the anchor point localization layer to process the image features of each pixel to obtain the global features of the target image in a first space; using a fully connected layer in the anchor point localization layer to transform the global features of the target image in the first space to obtain the global features of the target image in a second space, and determining these as the global features of the target image; and using an extension layer in the anchor point localization layer to process the target image... The global features of each pixel in the target image are obtained by using the global features of the image. The global features and image features of each pixel in the target image are then combined using the stitching layer in the anchor point localization layer to obtain the comprehensive features of each pixel. The comprehensive features of each pixel are then processed using the convolutional layer in the anchor point localization layer based on the set number of anchor points to obtain the position parameters of the anchor points corresponding to each pixel. The position of each anchor point is represented by its horizontal and vertical offsets relative to the pixel. The image features of the anchor points corresponding to each pixel are determined using the data extraction layer in the trained anchor point sampling model, based on the position parameters of the anchor points corresponding to each pixel and the image features of the target image. The number of anchor points corresponding to each pixel is less than the number of pixels in the target image. Using the trained fast global attention mechanism model, global information parameters of each pixel in the target image are obtained based on the image features of each pixel and the image features of the corresponding anchor points of each pixel. Based on the image features of each pixel in the target image and global information parameters, scene category prediction is performed on the image to be identified to obtain the scene recognition result of the image to be identified.
2. The image scene recognition method according to claim 1, characterized in that, The step of using the data extraction layer in the trained anchor sampling model to determine the image features of each pixel's corresponding anchor point based on the position parameters of the anchor point and the image features of the target image includes: Using the data extraction layer, image features of multiple reference pixels that satisfy a preset relationship in spatial position with the anchor points corresponding to each pixel are determined based on the position parameters of the anchor points corresponding to each pixel, and the image features of the multiple reference pixels corresponding to each anchor point are processed to obtain the image features of the anchor points corresponding to each pixel.
3. The image scene recognition method according to claim 2, characterized in that, The step of processing the image features of multiple reference pixels corresponding to each anchor point to obtain the image features of the anchor point corresponding to each pixel includes: The image features of each anchor point are obtained by processing the image features of multiple reference pixels corresponding to each anchor point using a bilinear interpolation method.
4. The image scene recognition method according to any one of claims 1 to 3, characterized in that, Also includes: An initial image scene recognition model is constructed, which includes basic units composed of residual networks, and the basic units include a fast global attention mechanism model, which includes an anchor sampling model. A scene image set is acquired and divided into a training set and a test set; the scene image set includes scene images with multiple labeled image scene types. The initial image scene recognition model is pre-trained using the training set to obtain a pre-trained image scene recognition model. The image scene recognition model after initial training was tested and adjusted using the test set to obtain the trained image scene recognition model.
5. The image scene recognition method according to claim 4, characterized in that, After the step of building the initial image scene recognition model, the following steps are also included: Construct spatial sparse constraints; The spatial sparse constraint condition is used to apply spatial sparse constraint to the anchor point positioning layer of the anchor point sampling model. Based on the spatial sparsity constraint, the initial image scene recognition model is initially trained and tested using the scene image set.
6. The image scene recognition method according to claim 1, characterized in that, The step of obtaining the global information parameters of each pixel in the target image based on the image features of each pixel and the image features of the corresponding anchor points of each pixel includes: using a trained fast global attention mechanism model, determining the similarity between each pixel and the corresponding anchor points of each pixel based on the image features of each pixel and the image features of the corresponding anchor points of each pixel; and determining the global information parameters of each pixel based on the similarity between each pixel and the corresponding anchor points of each pixel, and the image features of each pixel.
7. An image scene recognition device, characterized in that, include: The acquisition module is used to acquire image features of the target image in the image to be identified; An anchor point module is used to process the image features of the target image to obtain the global features of the target image, and to process the image features of the target image and the global features to obtain the image features of anchor points corresponding to each pixel in the target image. This includes: acquiring a trained anchor point sampling model, which includes an anchor point localization layer and a data extraction layer; using a pooling layer in the anchor point localization layer to process the image features of each pixel to obtain the global features of the target image in a first space; using a fully connected layer in the anchor point localization layer to transform the global features of the target image in the first space to obtain the global features of the target image in a second space, and determining these as the global features of the target image; and using an extension layer in the anchor point localization layer to process the data. The global features of each pixel in the target image are obtained by analyzing the global features of the target image. The global features and image features of each pixel in the anchor point localization layer are then combined using a stitching layer to obtain the comprehensive features of each pixel. The comprehensive features of each pixel are then processed using a convolutional layer in the anchor point localization layer based on a set number of anchor points to obtain the position parameters of the anchor points corresponding to each pixel. The position of each anchor point is represented by a horizontal and vertical offset relative to the pixel. Finally, the image features of the anchor points corresponding to each pixel are determined using a data extraction layer in the trained anchor point sampling model, based on the position parameters of the anchor points corresponding to each pixel and the image features of the target image. The number of anchor points corresponding to each pixel is less than the number of pixels in the target image. The global attention module is used to obtain the global information parameters of each pixel in the target image based on the image features of each pixel and the image features of the corresponding anchor points in the target image using the trained fast global attention mechanism model. The recognition module is used to predict the scene category of the image to be recognized based on the image features of each pixel in the target image and global information parameters to obtain the scene recognition result of the image to be recognized.
8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein, When the processor executes the program, it implements the steps in the image scene recognition method as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, wherein, When the computer program is executed by the processor, it implements the steps of the image scene recognition method as described in any one of claims 1 to 6.