Method, device, equipment and storage medium for training model
By constructing an image detection model and optimizing the model's structural parameters using the network structure search space of various substructures, the problem of resource waste in image authentication technology is solved, and lightweight and efficient image detection results are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JINGDONG TECH HLDG CO LTD
- Filing Date
- 2021-06-28
- Publication Date
- 2026-05-15
AI Technical Summary
Existing image authentication techniques suffer from a conflict between the high-level semantic features required by standard deep learning image classification models and the low-level semantic features required by image authentication techniques. This leads to a waste of computational resources and a lack of optimization of the model structure.
By constructing an image detection model, using a network structure search space based on various substructures, optimizing the model structure parameters, separating and processing information at different levels, and using machine learning algorithms to train the model and generate feature maps.
It achieves lightweight and efficient image detection, avoids resource waste, improves the accuracy and efficiency of the model, and is suitable for image counterfeiting detection.
Smart Images

Figure CN115618218B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this application relate to the field of computer technology, specifically to the field of image processing technology, and more particularly to methods and apparatus for training models. Background Technology
[0002] The development of computer vision and graphics technologies has made digital image forgery increasingly easier, leading to the proliferation of malicious fake images and videos circulating online and causing serious social impact. To address this threat, image authentication technology has emerged. Image authentication distinguishes forged images from genuine images. Because there are various digital image forgery techniques with vastly different underlying principles, image authentication models need to possess the ability to detect different forgery methods simultaneously.
[0003] Currently, mainstream image authentication solutions mainly use standard deep learning image classification models. However, standard deep learning image classification models rely on high-level semantic features, while image authentication technology relies on low-level semantic features, creating a conflict between their needs. Furthermore, the design of standard deep learning image classification models tends to use deeper model structures, resulting in a waste of computational resources. Moreover, current image authentication solutions lack research and optimization of the model structure itself. Summary of the Invention
[0004] This application provides a method, apparatus, device, and storage medium for training a model, and a method, apparatus, device, and storage medium for generating information.
[0005] According to a first aspect of this application, a method for training a model is provided, the method comprising: acquiring a training sample set, wherein the training samples in the training sample set include target images and feature maps corresponding to the target images; using the target images included in the training samples in the training sample set as input data of a network, and using the feature maps corresponding to the input target images as output data of the network, thereby training an image detection model, wherein the network structure of the model is constructed based on each model substructure in various substructures, the optimization objective of the image detection model is to learn the optimal solution of the model network structure by sampling the structural parameters of each model substructure in various substructures, and the various substructures are obtained by analyzing the feature maps processed by each model substructure in the network structure search space of the model.
[0006] In some embodiments, various substructures are obtained by dividing the feature maps processed by each model substructure in the network structure search space of the model into feature semantic levels.
[0007] In some embodiments, the network structure of the model is constructed by summarizing the various model substructures in the same substructure and stacking them according to the hierarchy after the substructures are divided.
[0008] In some embodiments, model training is used to characterize the transformation of each model substructure in the model by multiple feature layers. The input data of each feature layer includes: the output data of at least two model substructures preceding the corresponding model substructure in the model network structure and / or the output data of each feature layer preceding the corresponding model substructure.
[0009] In some embodiments, the various substructures include: a first type of substructure and a second type of substructure. The image detection model includes a first submodel and a second submodel. The network structure of the first submodel is constructed based on each model substructure in the first type of substructure, and the network structure of the second submodel is constructed based on each model substructure in the second type of substructure. The image detection model is trained by using the target images included in the training samples in the training sample set as input data to the network and the feature maps corresponding to the input target images as output data to the network. This includes: using the target images included in the training samples in the training sample set as input data to the network and the feature maps corresponding to the input target images as output data to the network, adjusting the structural parameters of each model substructure in the first type of substructure to obtain the trained first submodel; using the target images included in the training samples in the training sample set as input data to the network and the feature maps corresponding to the input target images as output data to the network, adjusting the structural parameters of each model substructure in the second type of substructure to obtain the trained second submodel; and determining the image detection model based on the trained first submodel and the trained second submodel.
[0010] In some embodiments, the image detection model includes a first detection sub-model and a second detection sub-model. The model parameters of the first detection sub-model are the training parameters of the model, and the model parameters of the second detection sub-model are the structural parameters of the model. The image detection model is trained by using target images included in the training samples of the training sample set as input data to the network and feature maps corresponding to the input target images as output data to the network. This includes: using target images included in the training samples of the training sample set as input data and feature maps corresponding to the input target images as output data, adjusting the training parameters to obtain a trained first detection sub-model; using target images included in the training samples of the training sample set as input data and feature maps corresponding to the input target images as output data, adjusting the structural parameters to obtain a trained second detection sub-model; and determining an image detection model based on the trained first detection sub-model and the trained second detection sub-model.
[0011] According to a second aspect of this application, a method for generating information is provided, the method comprising: acquiring a target image; inputting the target image into a pre-trained image detection model to generate a feature map corresponding to the target image, wherein the image detection model is trained by any of the methods described above for training a model.
[0012] In some embodiments, the image detection model includes a first detection sub-model and a second detection sub-model. The first detection sub-model is used to represent the training parameters of the model trained using a machine learning algorithm, and the second detection sub-model is used to represent the structural parameters of the model trained using a machine learning algorithm. Inputting a target image into a pre-trained image detection model to generate a feature map corresponding to the target image includes: inputting the target image into the pre-trained first detection sub-model to generate a first feature map corresponding to the target image; inputting the target image into the pre-trained second detection sub-model to generate a second feature map corresponding to the target image; and determining a feature map corresponding to the first feature map and the second feature map as the feature map corresponding to the target image based on the first feature map and the second feature map.
[0013] According to a third aspect of this application, an apparatus for training a model is provided. The apparatus includes: an acquisition unit configured to acquire a training sample set, wherein the training samples in the training sample set include target images and feature maps corresponding to the target images; and a training unit configured to use the target images included in the training samples in the training sample set as input data to a network, and use the feature maps corresponding to the input target images as output data to train an image detection model. The network structure of the model is constructed based on various model substructures within a range of substructures. The optimization objective of the image detection model is to learn the optimal solution of the model network structure by sampling the structural parameters of each model substructure within the various substructures. The various substructures are obtained by analyzing the feature maps processed by each model substructure in the network structure search space of the model.
[0014] In some embodiments, the various substructures in the training unit are obtained by dividing the feature semantic levels of the feature maps processed by each model substructure in the network structure search space of the model.
[0015] In some embodiments, the network structure of the model in the training unit is constructed by stacking the various model substructures of the same type according to the hierarchy after the substructures are divided.
[0016] In some embodiments, model training in the training unit is used to characterize the transformation of each model substructure in the model by multiple feature layers. The input data of each feature layer includes: the output data of at least two model substructures preceding the corresponding model substructure in the model network structure and / or the output data of each feature layer preceding the corresponding model substructure.
[0017] In some embodiments, the various substructures in the training unit include: a first type of substructure and a second type of substructure. The image detection model includes a first sub-model and a second sub-model. The network structure of the first sub-model is constructed based on each model sub-structure in the first type of substructure, and the network structure of the second sub-model is constructed based on each model sub-structure in the second type of substructure. The training unit includes: a first training module configured to use the target images included in the training samples in the training sample set as input data of the network, use the feature maps corresponding to the input target images as output data of the network, and adjust the structural parameters of each model sub-structure in the first type of substructure to obtain the trained first sub-model; a second training module configured to use the target images included in the training samples in the training sample set as input data of the network, use the feature maps corresponding to the input target images as output data of the network, and adjust the structural parameters of each model sub-structure in the second type of substructure to obtain the trained second sub-model; and a first determination module configured to determine the image detection model based on the trained first sub-model and the trained second sub-model.
[0018] In some embodiments, the image detection model in the training unit includes a first detection sub-model and a second detection sub-model, wherein the model parameters of the first detection sub-model are the training parameters of the model, and the model parameters of the second detection sub-model are the structural parameters of the model; the training unit includes: a third training module configured to take the target images included in the training samples in the training sample set as input data, take the feature maps corresponding to the input target images as output data, adjust the training parameters, and obtain the trained first detection sub-model; a fourth training module configured to take the target images included in the training samples in the training sample set as input data, take the feature maps corresponding to the input target images as output data, adjust the structural parameters, and obtain the trained second detection sub-model; and a second determination module configured to determine an image detection model based on the trained first detection sub-model and the trained second detection sub-model.
[0019] According to a fourth aspect of this application, an apparatus for generating information is provided, the apparatus comprising: an image acquisition unit configured to acquire a target image; and a generation unit configured to input the target image into a pre-trained image detection model to generate a feature map corresponding to the target image, wherein the image detection model is trained by any of the methods described above for training a model.
[0020] In some embodiments, the image detection model in the generation unit includes a first detection sub-model and a second detection sub-model. The first detection sub-model is used to represent the training parameters of the model trained using a machine learning algorithm, and the second detection sub-model is used to represent the structural parameters of the model trained using a machine learning algorithm. The generation unit includes: a first generation module configured to input a target image into a pre-trained first detection sub-model to generate a first feature map corresponding to the target image; a second generation module configured to input a target image into a pre-trained second detection sub-model to generate a second feature map corresponding to the target image; and a second determination module configured to determine a feature map corresponding to the first feature map and the second feature map as the feature map corresponding to the target image based on the first feature map and the second feature map.
[0021] According to a fifth aspect of this application, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform a method as described in any implementation of the first or second aspect.
[0022] According to a sixth aspect of this application, this application provides a non-transitory computer-readable storage medium storing computer instructions, characterized in that the computer instructions are used to cause a computer to perform a method as described in any implementation of the first or second aspect.
[0023] According to the technology of this application, a training sample set is obtained, wherein the training samples in the training sample set include target images and feature maps corresponding to the target images. The target images included in the training samples in the training sample set are used as input data of the network, and the feature maps corresponding to the input target images are used as output data of the network to train an image detection model. The network structure of the model is constructed based on each model substructure in various substructures. The optimization objective of the image detection model is to learn the optimal solution of the model network structure by sampling the structural parameters of each model substructure in various substructures. Various substructures are obtained by analyzing the feature maps processed by each model substructure in the network structure search space of the model. This realizes the research and optimization of the image detection model structure. By classifying the model substructures, information at different levels is separated from each other, generating model structures with different content, thus realizing the construction of an image detection model based on a separated search space. More resources are allocated to the processing of the required type of information according to needs, achieving lightweight and efficient image detection, avoiding resource waste, and improving the overall accuracy and efficiency of the model.
[0024] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0025] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this application.
[0026] Figure 1 This is a schematic diagram of a first embodiment of a method for training a model according to this application;
[0027] Figure 2 This is a scene diagram illustrating the method for training a model that can be implemented according to the embodiments of this application;
[0028] Figure 3 This is a schematic diagram of a second embodiment of the method for training a model according to this application;
[0029] Figure 4 This is a schematic diagram illustrating the structure of the model submodules that implement the embodiments of this application;
[0030] Figure 5-1 This is a schematic diagram of a network model architecture according to the method for training a model in this application;
[0031] Figure 5-2 and Figure 5-3 This is a schematic diagram of the sampling process for the model sub-module structure in the network model architecture;
[0032] Figure 5-4 This is a schematic diagram of the sampling results of the network model architecture;
[0033] Figure 6 This is a schematic diagram of a first embodiment of a method for generating information according to this application;
[0034] Figure 7 This is a schematic diagram of one embodiment of the apparatus for training a model according to this application;
[0035] Figure 8 This is a schematic diagram of one embodiment of the apparatus for generating information according to this application;
[0036] Figure 9 This is a block diagram of an electronic device used to implement the embodiments of this application. Detailed Implementation
[0037] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of this application, including various details to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0038] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0039] Figure 1 A schematic diagram 100 of a first embodiment of a method for training a model according to this application is shown. The method for training a model includes the following steps:
[0040] Step 101: Obtain the training sample set.
[0041] In this embodiment, the executing entity (e.g., a server or terminal device) can obtain the training sample set from other electronic devices or locally via wired or wireless connections. The training samples in the training sample set include the target image and the corresponding feature map. It should be noted that the aforementioned wireless connection methods may include, but are not limited to, 3G, 4G, 5G, WiFi, Bluetooth, WiMAX, Zigbee, UWB (ultra-wideband), and other currently known or future-developed wireless connection methods.
[0042] Step 102: Use the target images included in the training samples in the training sample set as the input data of the network, and use the feature maps corresponding to the input target images as the output data of the network to train the image detection model.
[0043] In this embodiment, the executing entity can utilize machine learning algorithms to train an image detection model by using the target image obtained in step 101 as input data to the network and the feature map corresponding to the input target image as output data. The network structure of the model is constructed based on various model substructures within different substructures. For example, different model submodules in different types of substructures can be stacked according to a preset construction method. The optimization objective of the image detection model can be to use machine learning algorithms to sample the structural parameters of each model substructure in each type of substructure, continuously sampling better structures until convergence, thus obtaining the optimal model network structure. Each type of substructure can be classified by analyzing the feature maps processed by each model substructure in the model's network structure search space, and the feature information can be fabricated feature information in the image.
[0044] It should be noted that the aforementioned execution entity can store a pre-trained image detection model. The network architecture of the image detection model is predefined, for example, an eight-layer basic model architecture is defined for searching the model sub-module structure. The aforementioned execution entity can use this image detection model to predict feature maps corresponding to the feature information in the target image. This image detection model can be used to represent the correspondence between the target object and the feature map. The model structure of this image prediction model can be built based on various existing logistic regression models, such as, but not limited to, BERT, FastText, and TextCNN.
[0045] It should be noted that the image detection model can be, for example, a data table or a calculation formula, and this embodiment does not impose any limitations on this aspect. The aforementioned machine learning algorithms are well-known technologies that are currently widely researched and applied, and will not be elaborated upon here.
[0046] See also Figure 2 In this embodiment, the method 200 for training the model runs on server 201. Server 201 first obtains a training sample set 202, wherein the training samples in the training sample set include target images and feature maps corresponding to the target images. Then, server 201 uses the target images included in the training samples in the training sample set as input data for the network and uses the feature maps corresponding to the input target images as output data for the network to train an image detection model 203. The network structure of the model is constructed based on each model substructure in various substructures. The optimization objective of the image detection model is to learn the optimal solution of the model network structure by sampling the structural parameters of each model substructure in various substructures. Various substructures are obtained by analyzing the feature maps processed by each model substructure in the network structure search space of the model.
[0047] The method for training a model provided in the above embodiments of this application involves acquiring a training sample set, wherein the training samples in the training sample set include target images and feature maps corresponding to the target images; using the target images included in the training samples in the training sample set as input data for the network, and using the feature maps corresponding to the input target images as output data for the network, thereby training an image detection model. The network structure of the model is constructed based on various model substructures within different substructures. The optimization objective of the image detection model is to learn the optimal solution of the model network structure by sampling the structural parameters of each model substructure within different substructures. Various substructures are obtained by analyzing the feature maps processed by each model substructure in the model's network structure search space. This achieves the research and optimization of the image detection model structure. By classifying the model substructures, information at different levels is separated, generating model structures with different content, thus realizing the construction of an image detection model based on a separated search space. More resources are allocated to processing the required types of information according to needs, achieving lightweight image authentication, avoiding resource waste, and improving the overall accuracy and efficiency of the model.
[0048] Further reference Figure 3 The diagram 300 illustrates a second embodiment of a method for training a model. The method includes the following steps:
[0049] Step 301: Obtain the training sample set.
[0050] Step 302: The target images included in the training samples in the training sample set are used as the input data of the network, and the feature maps corresponding to the input target images are used as the output data of the network to train the image detection model.
[0051] In this embodiment, the executing entity can utilize machine learning algorithms to train an image detection model by using the target image obtained in step 301 as the input data of the network and the feature map corresponding to the input target image as the output data of the network. The network structure of the model is constructed based on various model substructures within different substructures. The optimization objective of the image detection model is to continuously sample better structures during training by repeatedly sampling the structural parameters of each model substructure within different substructures until convergence, thus obtaining the optimal model network structure. These various substructures are obtained by dividing the feature maps processed by each model substructure in the model's network structure search space into feature semantic levels. For example, based on semantic features, the information corresponding to the feature maps is divided into shallow / low-level information and deep information according to different depths of operation. The model substructures corresponding to the shallow-level information are classified as shallow substructures, and the model substructures corresponding to the deep-level information are classified as deep substructures. Shallow / low-level information may include information such as low-level pixel features, pixel distribution, and frequency domain structure, while deep information may include information such as the structure and shape of the object.
[0052] In this embodiment, model training can be used to characterize the transformation of each model substructure in the model through multiple feature layers. The input data for each feature layer includes: the output data of at least two model substructures preceding the corresponding model substructure in the model network structure and / or the output data of each feature layer preceding the corresponding model substructure. For example, the model submodule structure is defined as follows: Figure 4 As shown, each submodule structure receives the outputs of the previous two submodule structures as inputs (Input1 and Input2 in the figure), performs a three-layer feature transformation on these two inputs (Node1 to Node3 in the figure), the input of each feature map layer includes the two inputs of the submodule structure and the outputs of the previous feature maps, and sums the results as the output of the layer. Finally, the outputs of each feature layer (Node1 to Node3) are superimposed as the output of the model submodule structure.
[0053] This section illustrates the sampling process of an image detection model. First, the basic network architecture of an eight-layer image detection model is defined, as follows: Figure 5-1 As shown, the bottom two modules (cell 1 and cell 2) are divided into shallow units based on shallow substructures, and the top six modules (cell 3 to cell 8) are divided into deep units based on deep substructures. The controller samples a specific structure from both the shallow and deep units each time, thus obtaining a candidate model. The test results of this candidate model are used to train the controller using reinforcement learning or gradient optimization methods, enabling it to continuously sample better structures until convergence, yielding the optimal model structure. The controller can use common structure search algorithms. During the sampling process, each unit searches each edge (e.g., ...) each time. Figure 5-2 (As shown by the dashed line) Select an operation type to obtain a sub-network of that cell (e.g., Figure 5-3 As shown in the figure, the final sampling results are as follows. Figure 5-4 As shown, the left image represents the sampling results of deep units, and the right image represents the sampling results of shallow units. max_pool represents max pooling, dil_conv_5x5 represents dilated convolution with a kernel size of 5, dil_conv_3x3 represents dilated convolution with a kernel size of 3, identity represents identity mapping, and sep_conv_3x3 represents depth-wise separable convolution with a kernel size of 3.
[0054] In some optional implementations of this embodiment, the network structure of the model is constructed by summarizing the various model substructures of the same type and stacking them according to the hierarchy of each type of substructure. This separates the shallow construction and deep construction of the model, allowing the model to focus more on processing low-level information.
[0055] In some optional implementations of this embodiment, the various substructures include: a first-class substructure and a second-class substructure. The image detection model includes a first sub-model and a second sub-model. The network structure of the first sub-model is constructed based on each model substructure in the first-class substructure, and the network structure of the second sub-model is constructed based on each model substructure in the second-class substructure. The image detection model is trained by using the target images included in the training samples in the training sample set as the network input data and the feature maps corresponding to the input target images as the network output data. This includes: using the target images included in the training samples in the training sample set as the network input data and the feature maps corresponding to the input target images as the network output data, adjusting the structural parameters of each model substructure in the first-class substructure to obtain the trained first sub-model; using the target images included in the training samples in the training sample set as the network input data and the feature maps corresponding to the input target images as the network output data, adjusting the structural parameters of each model substructure in the second-class substructure to obtain the trained second sub-model; and determining the image detection model based on the trained first sub-model and the trained second sub-model. By splitting the model into multiple sub-module structures, searching for the optimal sub-structure for each type of sub-module structure, and then stacking the optimal sub-structures to build a complete model, the training efficiency of the model is improved.
[0056] In some optional implementations of this embodiment, the image detection model includes a first detection sub-model and a second detection sub-model. The model parameters of the first detection sub-model are the training parameters of the model, and the model parameters of the second detection sub-model are the structural parameters of the model. The image detection model is trained by using the target images included in the training samples of the training sample set as input data to the network, and the feature maps corresponding to the input target images as output data to the network. This includes: using the target images included in the training samples of the training sample set as input data, and the feature maps corresponding to the input target images as output data, adjusting the training parameters to obtain the trained first detection sub-model; using the target images included in the training samples of the training sample set as input data, and the feature maps corresponding to the input target images as output data, adjusting the structural parameters to obtain the trained second detection sub-model; and determining the image detection model based on the trained first detection sub-model and the trained second detection sub-model. Image detection models can be built based on neural networks. The parameters of a neural network model include training parameters and network structure parameters. Training parameters are those obtained during training, excluding the model structure parameters, such as the learning rate, batch size, and weight decay. Network structure parameters define the network structure of the image detection model, such as the number of layers, the operators in each layer, and the filter size in convolutions. By training both the training parameters and the model structure parameters simultaneously, the accuracy and efficiency of model training can be improved, making the model more widely applicable.
[0057] In this embodiment, the specific operation of step 301 is the same as... Figure 1 The operation of step 101 in the illustrated embodiment is basically the same, and will not be repeated here.
[0058] from Figure 3 It can be seen from this that, with Figure 1Compared to the corresponding embodiments, the schematic diagram 300 of the method for training the model in this embodiment is obtained by dividing the feature maps processed by each model substructure in the network structure search space of the model into various substructures. Model training is used to represent the transformation of each model substructure in the model through multiple feature layers. The input data of each feature layer includes: the output data of at least two model substructures preceding the corresponding model substructure in the model network structure and / or the output data of each feature layer preceding the corresponding model substructure. This solves the problem that existing technologies using standard deep learning image classification models rely on high-level semantic features, while image authentication technology relies on low-level semantic features, creating a conflict between their needs. It also addresses the problem that current deep learning image classification models tend to use deep model structures, leading to wasted computational resources in image authentication applications. By dividing the model substructure, separating operations at different depths, using different constructions, and employing different processing methods for different levels of information, a lightweight image detection model based on a depth separation search space is constructed, achieving this.
[0059] Further reference Figure 6 The diagram 600 shows a first embodiment of a method for generating information according to this application. The method for generating information includes the following steps:
[0060] Step 601: Obtain the target image.
[0061] In this embodiment, the executing entity (e.g., a server or terminal device) can acquire the target image from other electronic devices or locally via wired or wireless connections.
[0062] Step 602: Input the target image into the pre-trained image detection model to generate the feature map corresponding to the target image.
[0063] In this embodiment, the executing entity can input the target image obtained in step 601 into a pre-trained image detection model to generate a feature map corresponding to the feature information in the target image. The image detection model is trained using any of the methods described above for training the model.
[0064] In some optional implementations of this embodiment, the image detection model includes a first detection sub-model and a second detection sub-model. The first detection sub-model represents the training parameters of the model using a machine learning algorithm, and the second detection sub-model represents the training of the model's structural parameters using a machine learning algorithm. Inputting the target image into the pre-trained image detection model to generate a feature map corresponding to the target image includes: inputting the target image into the pre-trained first detection sub-model to generate a first feature map corresponding to the target image; inputting the target image into the pre-trained second detection sub-model to generate a second feature map corresponding to the target image; and determining a feature map corresponding to the first and second feature maps as the feature map corresponding to the target image based on the first and second feature maps. Using two sub-modules for feature extraction separately improves the system's processing efficiency and accuracy. By adding a sub-model based on the model's structural parameters to the original convolutional neural network model, model improvement becomes more flexible and convenient.
[0065] from Figure 6 It can be seen from this that, with Figure 1 Compared to the corresponding embodiments, the process 600 of the method for generating information in this embodiment emphasizes the step of using a trained image detection model to generate feature maps corresponding to the feature information in the target image. Therefore, the scheme described in this embodiment can achieve targeted feature extraction of different types, levels, and depths.
[0066] Further reference Figure 7 As a response to the above Figures 1-3 To implement the method shown, this application provides an embodiment of a device for training a model, which is similar to... Figure 1 Corresponding to the method embodiment shown, in addition to the features described below, the device embodiment may also include [features related to...]. Figure 1 The method embodiments shown have the same or corresponding features, and produce the same as Figure 1 The method embodiments shown have the same or corresponding effects, and the device can be specifically applied to various electronic devices.
[0067] like Figure 7As shown, the apparatus 700 for training a model in this embodiment includes an acquisition unit 701 and a training unit 702. The acquisition unit is configured to acquire a training sample set, wherein the training samples in the training sample set include target images and feature maps corresponding to the target images. The training unit is configured to use the target images included in the training samples in the training sample set as input data of the network and the feature maps corresponding to the input target images as output data of the network to train an image detection model. The network structure of the model is constructed based on each model substructure in various substructures. The optimization objective of the image detection model is to learn the optimal solution of the model network structure by sampling the structural parameters of each model substructure in various substructures. The various substructures are obtained by analyzing the feature maps processed by each model substructure in the network structure search space of the model.
[0068] In this embodiment, the specific processing of the acquisition unit 701 and the training unit 702 of the device 700 for training the model and the resulting technical effects can be referred to respectively. Figure 1 The relevant descriptions of steps 101 to 102 in the corresponding embodiments will not be repeated here.
[0069] In some optional implementations of this embodiment, the various substructures in the training unit are obtained by dividing the feature semantic levels of the feature maps processed by each model substructure in the network structure search space of the model.
[0070] In some optional implementations of this embodiment, the network structure of the model in the training unit is constructed by summarizing the various model substructures in the same substructure and stacking them according to the hierarchy after the substructures are divided.
[0071] In some optional implementations of this embodiment, the model training in the training unit is used to characterize the transformation of each model substructure in the model by multiple feature layers. The input data of each feature layer includes: the output data of at least two model substructures preceding the corresponding model substructure in the model network structure and / or the output data of each feature layer preceding the corresponding model substructure.
[0072] In some optional implementations of this embodiment, the various substructures in the training unit include: a first type of substructure and a second type of substructure. The image detection model includes a first sub-model and a second sub-model. The network structure of the first sub-model is constructed based on each model substructure in the first type of substructure, and the network structure of the second sub-model is constructed based on each model substructure in the second type of substructure. The training unit includes: a first training module configured to use the target images included in the training samples in the training sample set as the input data of the network, use the feature maps corresponding to the input target images as the output data of the network, and adjust the structural parameters of each model substructure in the first type of substructure to obtain the trained first sub-model; a second training module configured to use the target images included in the training samples in the training sample set as the input data of the network, use the feature maps corresponding to the input target images as the output data of the network, and adjust the structural parameters of each model substructure in the second type of substructure to obtain the trained second sub-model; and a first determination module configured to determine the image detection model based on the trained first sub-model and the trained second sub-model.
[0073] In some optional implementations of this embodiment, the image detection model in the training unit includes a first detection sub-model and a second detection sub-model. The model parameters of the first detection sub-model are the training parameters of the model, and the model parameters of the second detection sub-model are the structural parameters of the model. The training unit includes: a third training module configured to take the target images included in the training samples in the training sample set as input data, take the feature maps corresponding to the input target images as output data, adjust the training parameters, and obtain the trained first detection sub-model; a fourth training module configured to take the target images included in the training samples in the training sample set as input data, take the feature maps corresponding to the input target images as output data, adjust the structural parameters, and obtain the trained second detection sub-model; and a second determination module configured to determine the image detection model based on the trained first detection sub-model and the trained second detection sub-model.
[0074] The embodiments of this disclosure provide an apparatus for training a model. A training sample set is acquired by a first acquisition unit. The training samples in the training sample set include head images, feature information of head objects in the head images, and feature maps corresponding to the feature information of the head objects. Then, the training unit uses a machine learning algorithm to train a feature extraction model by taking the head images included in the training samples in the training sample set as input data and the feature information of the head objects corresponding to the input head images and the feature maps corresponding to the feature information of the head objects as expected output data. The feature extraction model is constructed based on a convolutional neural network. The parameters of the convolutional neural network model include scale parameters and other convolutional kernel parameters. The scale parameters are the scale structure of the head objects set using scale space theory. The other convolutional kernel parameters are the other parameters of the convolutional kernels in the convolutional neural network besides the scale parameters. This enriches the training method of the model and helps to achieve feature extraction in multi-scale space based on the trained model.
[0075] Continue to refer to Figure 8 As a response to the above Figure 6 The implementation of the method shown in this application provides an embodiment of an apparatus for generating information, which is similar to... Figure 6 Corresponding to the method embodiment shown, in addition to the features described below, the device embodiment may also include [features related to...]. Figure 6 The method embodiments shown have the same or corresponding features, and produce the same as Figure 6 The method embodiments shown have the same or corresponding effects, and the device can be specifically applied to various electronic devices.
[0076] like Figure 8 As shown, the apparatus 800 for generating information in this embodiment includes an image acquisition unit 801 and a generation unit 802. The image acquisition unit is configured to acquire a target image. The generation unit is configured to input the target image into a pre-trained image detection model to generate a feature map corresponding to the target image. The image detection model is trained by any of the methods described above for training the model.
[0077] In this embodiment, the specific processing of the image acquisition unit 801 and the generation unit 802 of the information generation device 800 and the resulting technical effects can be referred to respectively. Figure 6 The relevant descriptions of steps 601 to 602 in the corresponding embodiments will not be repeated here.
[0078] In some optional implementations of this embodiment, the image detection model in the generation unit includes a first detection sub-model and a second detection sub-model. The first detection sub-model is used to represent the training parameters of the model trained using a machine learning algorithm, and the second detection sub-model is used to represent the structural parameters of the model trained using a machine learning algorithm. The generation unit includes: a first generation module configured to input the target image into the pre-trained first detection sub-model to generate a first feature map corresponding to the target image; a second generation module configured to input the target image into the pre-trained second detection sub-model to generate a second feature map corresponding to the target image; and a second determination module configured to determine, based on the first feature map and the second feature map, a feature map corresponding to the first feature map and the second feature map as the feature map corresponding to the target image.
[0079] According to embodiments of this application, this application also provides an electronic device and a readable storage medium.
[0080] like Figure 9 The diagram shown is a block diagram of an electronic device for a method of training a model according to an embodiment of this application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present application described and / or claimed herein.
[0081] like Figure 9 As shown, the electronic device includes one or more processors 901, a memory 902, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components are interconnected via different buses and can be mounted on a common motherboard or otherwise as required. The processors can process instructions executed within the electronic device, including instructions stored in or on memory to display graphical information of a GUI on an external input / output device (such as a display device coupled to the interface). In other embodiments, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple electronic devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 9 Take the 901 processor as an example.
[0082] The memory 902 is the non-transitory computer-readable storage medium provided in this application. The memory stores instructions executable by at least one processor to cause at least one processor to perform the method for training a model provided in this application. The non-transitory computer-readable storage medium of this application stores computer instructions for causing a computer to perform the method for training a model provided in this application.
[0083] Memory 902, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the method for training a model in the embodiments of this application (e.g., appendix). Figure 7 (The acquisition unit 701 and training unit 702 are shown). The processor 901 executes various functional applications and data processing of the server by running non-transient software programs, instructions, and modules stored in the memory 902, that is, it implements the method for training the model in the above method embodiments.
[0084] Memory 902 may include a program storage area and a data storage area, wherein the program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the electronic device used to train the model, etc. Furthermore, memory 902 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory 902 may optionally include memory remotely located relative to processor 901, and these remote memories may be connected to the electronic device used to train the model via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0085] The electronic device used for training the model may further include an input device 903 and an output device 904. The processor 901, memory 902, input device 903, and output device 904 may be connected via a bus or other means. Figure 9 Taking the example of a connection between China and Israel via a bus.
[0086] Input device 903 can receive input numerical or character information, and generate key signal inputs related to user settings and function control of the electronic device used for training the model, such as a touch screen, keypad, mouse, trackpad, touchpad, joystick, one or more mouse buttons, trackball, joystick, etc. Output device 904 may include a display device, auxiliary lighting device (e.g., LED), and haptic feedback device (e.g., vibration motor). The display device may include, but is not limited to, a liquid crystal display (LCD), a light-emitting diode (LED) display, and a plasma display. In some embodiments, the display device may be a touch screen.
[0087] Various implementations of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, application-specific integrated circuits (ASICs), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transferring data and instructions to the storage system, the at least one input device, and the at least one output device.
[0088] These computational programs (also referred to as programs, software, software applications, or code) include machine instructions for a programmable processor and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms “machine-readable medium” and “computer-readable medium” refer to any computer program product, device, and / or apparatus (e.g., disk, optical disk, memory, programmable logic device (PLD)) used to provide machine instructions and / or data to a programmable processor, including machine-readable media that receive machine instructions as machine-readable signals. The term “machine-readable signal” refers to any signal used to provide machine instructions and / or data to a programmable processor.
[0089] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0090] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0091] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.
[0092] The technical solution according to the embodiments of this application adopts the method of obtaining a training sample set, wherein the training samples in the training sample set include target images and feature maps corresponding to the target images; the target images included in the training samples in the training sample set are used as input data of the network, and the feature maps corresponding to the input target images are used as output data of the network to train an image detection model. The network structure of the model is constructed based on each model substructure in various substructures. The optimization objective of the image detection model is to learn the optimal solution of the model network structure by sampling the structural parameters of each model substructure in various substructures. Various substructures are obtained by analyzing the feature maps processed by each model substructure in the network structure search space of the model. This realizes the research and optimization of the image detection model structure. By classifying the model substructures, information at different levels is separated, generating model structures with different content, thus realizing the construction of an image detection model based on a separated search space. More resources are allocated to processing the required type of information according to needs, achieving lightweight and efficient image detection, avoiding resource waste, and improving the overall accuracy and efficiency of the model.
[0093] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this application can be achieved, and this is not limited herein.
[0094] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for training a model, the method comprising: Obtain a training sample set, wherein the training samples in the training sample set include a target image and a feature map corresponding to the target image; The target images included in the training samples of the training sample set are used as the input data of the network, and the feature maps corresponding to the input target images are used as the output data of the network to train an image detection model. The network structure of the model is constructed based on each model substructure in various substructures. The optimization objective of the image detection model is to learn the optimal solution of the model network structure by sampling the structural parameters of each model substructure in various substructures. The various substructures are obtained by dividing the feature maps processed by each model substructure in the network structure search space of the model into feature semantic levels. The division operation is based on semantic features and divides the model substructures corresponding to the feature maps into shallow substructures and deep substructures according to different depth operations. The shallow information corresponding to the shallow substructure includes bottom pixel features, pixel distribution, and frequency domain structure. The deep information corresponding to the deep substructure includes the structure and shape of the object. Each model substructure is obtained by performing feature information analysis on the feature maps processed by each model substructure in the network structure search space of the model and classifying them based on the analysis results. The feature information includes fake feature information in the image.
2. The method according to claim 1, wherein, The network structure of the model is constructed by summarizing the various model substructures in the same substructure and stacking them according to the hierarchy after the substructures are divided.
3. The method according to claim 1, wherein, The model training is used to characterize the transformation of each model substructure in the model by multiple feature layers. The input data of each feature layer includes: the output data of at least two model substructures preceding the corresponding model substructure in the model network structure and / or the output data of each feature layer preceding the corresponding model substructure.
4. The method according to claim 1, wherein, The various substructures include: a first type of substructure and a second type of substructure. The image detection model includes a first sub-model and a second sub-model. The network structure of the first sub-model is constructed based on each model substructure in the first type of substructure, and the network structure of the second sub-model is constructed based on each model substructure in the second type of substructure. The step of training an image detection model by using target images from the training sample set as input data to the network and feature maps corresponding to the input target images as output data to the network includes: The target images included in the training samples in the training sample set are used as the input data of the network, and the feature maps corresponding to the input target images are used as the output data of the network. The structural parameters of each model substructure in the first type of substructure are adjusted to obtain the first sub-model after training. The target images included in the training samples in the training sample set are used as the input data of the network, and the feature maps corresponding to the input target images are used as the output data of the network. The structural parameters of each model substructure in the two types of substructures are adjusted to obtain the trained second sub-model. The image detection model is determined based on the first sub-model and the second sub-model that have been trained.
5. The method according to claim 1, wherein, The image detection model includes a first detection sub-model and a second detection sub-model. The model parameters of the first detection sub-model are the training parameters of the model, and the model parameters of the second detection sub-model are the structural parameters of the model. The step of training an image detection model by using target images from the training sample set as input data to the network and feature maps corresponding to the input target images as output data to the network includes: The target images included in the training samples in the training sample set are used as input data, and the feature maps corresponding to the input target images are used as output data. The training parameters are adjusted to obtain the first detection sub-model after training. The target images included in the training samples in the training sample set are used as input data, and the feature maps corresponding to the input target images are used as output data. The structural parameters are adjusted to obtain the trained second detection sub-model. The image detection model is determined based on the first detection sub-model and the second detection sub-model that have been trained.
6. A method for generating information, the method comprising: Acquire the target image; The target image is input into a pre-trained image detection model to generate a feature map corresponding to the target image, wherein the image detection model is trained by the method described in any one of claims 1-5.
7. The method according to claim 6, wherein, The image detection model includes a first detection sub-model and a second detection sub-model. The first detection sub-model is used to represent the training parameters of the model trained using a machine learning algorithm, and the second detection sub-model is used to represent the structural parameters of the model trained using a machine learning algorithm. The step of inputting the target image into a pre-trained image detection model to generate a feature map corresponding to the target image includes: The target image is input into a pre-trained first detection sub-model to generate a first feature map corresponding to the target image; The target image is input into a pre-trained second detection sub-model to generate a second feature map corresponding to the target image; Based on the first feature map and the second feature map, a feature map corresponding to the first feature map and the second feature map is determined as the feature map corresponding to the target image.
8. An apparatus for training a model, the apparatus comprising: The acquisition unit is configured to acquire a training sample set, wherein the training samples in the training sample set include a target image and a feature map corresponding to the target image; The training unit is configured to use target images from the training sample set as input data to the network and feature maps corresponding to the input target images as output data to train an image detection model. The network structure of the model is constructed based on various model substructures within a range of substructures. The optimization objective of the image detection model is to learn the optimal solution of the network structure by sampling the structural parameters of each model substructure within the various substructures. The various substructures are obtained by dividing the feature maps processed by each model substructure in the network structure search space of the model into feature semantic levels. This division operation is based on semantic features and uses different depth operations to divide the model substructures corresponding to the feature maps into shallow substructures and deep substructures. The shallow information corresponding to the shallow substructure includes bottom-level pixel features, pixel distribution, and frequency domain structure. The deep information corresponding to the deep substructure includes the structure and shape of the object. Each model substructure is obtained by performing feature information analysis on the feature maps processed by each model substructure in the network structure search space of the model, and classifying the substructures based on the analysis results. The feature information includes forged feature information in the image.
9. The apparatus according to claim 8, wherein, The network structure of the model in the training unit is constructed by summarizing the various model substructures in the same substructure and stacking them according to the hierarchy after the substructures are divided.
10. The apparatus according to claim 8, wherein, The model training in the training unit is used to characterize the transformation of each model substructure in the model by multiple feature layers. The input data of each feature layer includes: the output data of at least two model substructures preceding the corresponding model substructure in the model network structure and / or the output data of each feature layer preceding the corresponding model substructure.
11. The apparatus according to claim 8, wherein, The various substructures in the training unit include: a first type of substructure and a second type of substructure. The image detection model includes a first sub-model and a second sub-model. The network structure of the first sub-model is constructed based on each model substructure in the first type of substructure, and the network structure of the second sub-model is constructed based on each model substructure in the second type of substructure. The training unit includes: The first training module is configured to take the target images included in the training samples in the training sample set as the input data of the network, take the feature maps corresponding to the input target images as the output data of the network, adjust the structural parameters of each model substructure in the first type of substructure, and obtain the first sub-model after training. The second training module is configured to take the target images included in the training samples in the training sample set as the input data of the network, take the feature maps corresponding to the input target images as the output data of the network, adjust the structural parameters of each model substructure in the two types of substructures, and obtain the trained second sub-model. The first determining module is configured to determine the image detection model based on the first sub-model and the second sub-model that have been trained.
12. The apparatus according to claim 8, wherein, The image detection model in the training unit includes a first detection sub-model and a second detection sub-model. The model parameters of the first detection sub-model are the training parameters of the model, and the model parameters of the second detection sub-model are the structural parameters of the model. The training unit includes: The third training module is configured to take the target images included in the training samples in the training sample set as input data, take the feature maps corresponding to the input target images as output data, adjust the training parameters, and obtain the first detection sub-model after training. The fourth training module is configured to take the target images included in the training samples in the training sample set as input data, take the feature maps corresponding to the input target images as output data, adjust the structural parameters, and obtain the trained second detection sub-model. The second determining module is configured to determine the image detection model based on the first detection sub-model and the second detection sub-model that have been trained.
13. An apparatus for generating information, the apparatus comprising: The image acquisition unit is configured to acquire the target image; The generation unit is configured to input the target image into a pre-trained image detection model to generate a feature map corresponding to the target image, wherein the image detection model is trained by the method described in any one of claims 1-5.
14. The apparatus according to claim 13, wherein, The image detection model in the generation unit includes a first detection sub-model and a second detection sub-model. The first detection sub-model is used to represent the training parameters of the model using a machine learning algorithm, and the second detection sub-model is used to represent the training of the structural parameters of the model using a machine learning algorithm. The generation unit includes: The first generation module is configured to input the target image into a pre-trained first detection sub-model to generate a first feature map corresponding to the target image; The second generation module is configured to input the target image into a pre-trained second detection sub-model to generate a second feature map corresponding to the target image; The second determining module is configured to determine, based on the first feature map and the second feature map, a feature map corresponding to the first feature map and the second feature map as the feature map corresponding to the target image.
15. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5 or 6-7.
16. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method of any one of claims 1-5 or 6-7.