[go: up one dir, main page]

WO2025040048A1 - Data processing method and apparatus - Google Patents

Data processing method and apparatus Download PDF

Info

Publication number
WO2025040048A1
WO2025040048A1 PCT/CN2024/113045 CN2024113045W WO2025040048A1 WO 2025040048 A1 WO2025040048 A1 WO 2025040048A1 CN 2024113045 W CN2024113045 W CN 2024113045W WO 2025040048 A1 WO2025040048 A1 WO 2025040048A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
processing
text
encoder
sample
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
PCT/CN2024/113045
Other languages
French (fr)
Chinese (zh)
Inventor
韩建华
徐航
王春微
曾艺涵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Publication of WO2025040048A1 publication Critical patent/WO2025040048A1/en
Pending legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/58Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/583Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/55Clustering; Classification
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/58Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/5866Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using information manually generated, e.g. tags, keywords, comments, manually generated location and time information
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • G06N3/0455Auto-encoder networks; Encoder-decoder networks
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/0464Convolutional networks [CNN, ConvNet]
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks

Definitions

  • the present application relates to the field of artificial intelligence, and in particular to a data processing method and device thereof.
  • the present application provides a data processing method that can improve the processing capability for fine-grained features and improve the accuracy of target detection under the guidance of human language.
  • the present application provides a data processing method, comprising: acquiring an image and an object detection request, the object detection request comprising a natural language description of an object to be detected in the image; processing the image through an image encoder to obtain a feature representation of each of a plurality of image regions, each image region corresponding to a candidate detection box; processing the object detection request and a plurality of the feature representations through a language model, and determining the region and category of the object to be detected from the plurality of image regions.
  • the image encoder when performing target detection, the image encoder outputs the feature representation of the entire image, and the related training method makes the language model not have/not good at fine-grained image processing capabilities.
  • the image encoder outputs the feature representation of each of the multiple image areas in the image, and each image area can correspond to a candidate detection box, and each detection box can contain an object.
  • the area where the object to be detected indicated in the object detection request is located can be selected from multiple image areas.
  • the feature representation of each image area and the object detection request can be input into the language model, and the language model determines whether the object included in each image area is the object to be identified indicated by the object detection request.
  • the language model can also output the category of the object included in the image area when it is determined that the object included in the image area is the object to be identified indicated by the object detection request.
  • Using the image encoder to obtain the features of each image area and combining it with the language model for target detection can improve the processing capabilities for fine-grained features and improve the accuracy of target detection under the guidance of human language.
  • the processing of the object detection request and the multiple feature representations through a language model to determine the area where the object to be detected is located from the multiple image areas includes: processing the object detection request and each feature representation in parallel through a language model to obtain a detection result for each image area; and determining, based on the detection results, the area where the object to be detected is located from the multiple image areas.
  • the method before the image is processed by the image encoder, the method further includes: obtaining a training sample, the training sample including an image sample and a corresponding text sample, the text sample being a text description corresponding to the image sample; processing the image sample by the image encoder to obtain a first processing result; processing the text sample by the text encoder to obtain a second processing result; and updating the image encoder and the text encoder according to the first processing result and the second processing result through comparative learning. Encoder.
  • the first processing result includes multiple detection boxes and a category of each detection box; the method also includes: updating the image encoder and the text encoder according to the first processing result and the corresponding true value.
  • the language model includes multiple network layers, at least one of the multiple network layers includes a cross-attention layer; the cross-attention layer is used to perform attention interaction between image features and text features.
  • the present application provides a data processing device, the device comprising:
  • An acquisition module configured to acquire an image and an object detection request, wherein the object detection request includes a natural language description of an object to be detected in the image;
  • a processing module configured to process the image through an image encoder to obtain a feature representation of each of a plurality of image regions, each image region corresponding to a candidate detection frame;
  • the object detection request and the plurality of feature representations are processed by a language model, and a region where the object to be detected is located is determined from among the plurality of image regions.
  • the processing module is specifically configured to:
  • the area where the object to be detected is located is determined from the multiple image areas.
  • the acquisition module is further used to:
  • the training sample includes an image sample and a corresponding text sample, wherein the text sample is a text description corresponding to the image sample;
  • the processing module is further used to: process the image sample through an image encoder to obtain a first processing result
  • the image encoder and the text encoder are updated through comparative learning.
  • the first processing result includes a plurality of detection frames and a category of each detection frame; and the processing module is further configured to:
  • the image encoder and the text encoder are updated according to the first processing result and the corresponding true value.
  • the language model includes multiple network layers, at least one of the multiple network layers includes a cross-attention layer; the cross-attention layer is used to perform attention interaction between image features and text features.
  • an embodiment of the present application provides a data processing device, which may include a memory, a processor, and a bus system, wherein the memory is used to store programs, and the processor is used to execute the programs in the memory to perform the first aspect and any optional method thereof.
  • an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored.
  • the computer-readable storage medium is run on a computer, the computer executes the above-mentioned first aspect and any optional method thereof.
  • an embodiment of the present application provides a computer program, which, when executed on a computer, enables the computer to execute the above-mentioned first aspect and any optional method thereof.
  • the present application provides a chip system, which includes a processor for supporting a data processing device to implement the functions involved in the above aspects, such as sending or processing the data involved in the above methods; or information.
  • the chip system also includes a memory, which is used to store program instructions and data necessary for executing the device or training the device.
  • the chip system can be composed of chips, or it can include chips and other discrete devices.
  • FIG1A is a schematic diagram of a structure of an artificial intelligence main framework
  • FIGS. 1B to 1D are schematic diagrams of the application framework of the present application.
  • FIG2 is a schematic diagram of the application framework of the present application.
  • FIG3 is a schematic diagram of the application framework of the present application.
  • FIG4 is a schematic diagram of the application framework of the present application.
  • FIG5A and FIG5B are schematic diagrams of a network structure of the present application.
  • FIG7B is a schematic diagram of a training process provided in an embodiment of the present application.
  • the convolution layer/pooling layer 220 may include layers 221-226, for example: in one implementation, layer 221 is a convolution layer, layer 222 is a pooling layer, layer 223 is a convolution layer, layer 224 is a pooling layer, layer 225 is a convolution layer, and layer 226 is a pooling layer; in another implementation, layers 221 and 222 are convolution layers, layer 223 is a pooling layer, layers 224 and 225 are convolution layers, and layer 226 is a pooling layer. That is, the output of a convolution layer can be used as the input of a subsequent pooling layer, or as the input of another convolution layer to continue the convolution operation.
  • the maximum pooling operator may take the pixel with the largest value in the range within a specific range as the result of maximum pooling.
  • the operator in the pooling layer should also be related to the image size.
  • the size of the image output after processing by the pooling layer may be smaller than the size of the image input to the pooling layer, and each pixel in the image output by the pooling layer represents the average value or maximum value of the corresponding sub-region of the image input to the pooling layer.
  • the convolution neural network 200 After being processed by the convolution layer/pooling layer 220, the convolution neural network 200 is not sufficient to output the required output information. Because as mentioned above, the convolution layer/pooling layer 220 will only extract features and reduce the parameters brought by the input image. However, in order to generate the final output information (the required class information or other related information), the convolution neural network 200 needs to use the fully connected layer 230 to generate one or a group of outputs of the required number of classes. Therefore, the fully connected layer 230 may include multiple hidden layers (231, 232 to 23n as shown in Figure 5A), and the parameters contained in the multiple hidden layers can be pre-trained according to the relevant training data of the specific task type. For example, the task type may include image recognition, image classification, image super-resolution reconstruction, etc.
  • the output layer 240 which has a loss function similar to the classification cross entropy, and is specifically used to calculate the prediction error.
  • the forward propagation of the entire convolutional neural network 200 (such as the propagation from 210 to 240 in Figure 5A is forward propagation) is completed, the back propagation (such as the propagation from 240 to 210 in Figure 5A is back propagation) will begin to update the weight values and biases of the aforementioned layers to reduce the loss of the convolutional neural network 200 and the error between the result output by the convolutional neural network 200 through the output layer and the ideal result.
  • the convolutional neural network 200 shown in FIG. 5A is only an example of a convolutional neural network.
  • the convolutional neural network may also exist in the form of other network models, for example, including only a part of the network structure shown in FIG. 5A.
  • the convolutional neural network used in the embodiment of the present application may only include an input layer 210, a convolutional layer/pooling layer 220 and an output layer 240.
  • the convolutional neural network 100 shown in FIG. 5A is only an example of a convolutional neural network.
  • the convolutional neural network can also exist in the form of other network models.
  • FIG. 5B multiple convolutional layers/pooling layers are used in parallel, and the features extracted respectively are input to the fully connected layer 230 for processing.
  • Deep Neural Network also known as multi-layer neural network
  • DNN Deep Neural Network
  • the neural network inside DNN can be divided into three categories: input layer, hidden layer, and output layer.
  • the first layer is the input layer
  • the last layer is the output layer
  • the layers in between are all hidden layers.
  • the layers are fully connected, that is, any neuron in the i-th layer must be connected to any neuron in the i+1-th layer.
  • the coefficients from the kth neuron in the L-1th layer to the jth neuron in the Lth layer are defined as
  • the input layer does not have a W parameter.
  • W weight matrix
  • more hidden layers allow the network to better describe complex situations in the real world. Theoretically, the more parameters a model has, the higher its complexity and the greater its "capacity", which means it can complete more complex learning tasks.
  • Training a deep neural network is the process of learning the weight matrix, and its ultimate goal is to obtain the weight matrix of all layers of the trained deep neural network (a weight matrix formed by many layers of vectors W).
  • Convolutional neural networks can use the back propagation (BP) algorithm to correct the size of the parameters in the initial super-resolution model during the training process, so that the reconstruction error loss of the super-resolution model becomes smaller and smaller. Error loss will be generated, and the parameters in the initial super-resolution model are updated by back-propagating the error loss information, so that the error loss converges.
  • the back-propagation algorithm is a back-propagation movement dominated by error loss, aiming to obtain the optimal parameters of the super-resolution model, such as the weight matrix.
  • the attention mechanism imitates the internal process of biological observation behavior, that is, a mechanism that aligns internal experience and external sensations to increase the observation precision of some areas, and can use limited attention resources to quickly filter out high-value information from a large amount of information.
  • the attention mechanism can quickly extract important features of sparse data, and is therefore widely used in natural language processing tasks, especially machine translation.
  • the self-attention mechanism is an improvement on the attention mechanism, which reduces dependence on external information and is better at capturing the internal correlation of data or features.
  • the essential idea of the attention mechanism can be rewritten as the following formula:
  • Lx
  • represents the length of Source.
  • the formula means that the elements in Source are imagined to be composed of a series of data pairs. At this time, given a certain element Query in the target Target, by calculating the similarity or correlation between Query and each Key, the weight coefficient of the Value corresponding to each Key is obtained, and then the Value is weighted and summed to obtain the final Attention value. Therefore, the Attention mechanism is essentially a weighted sum of the Value values of the elements in Source, and Query and Key are used to calculate the weight coefficient of the corresponding Value.
  • Attention can be understood as selectively filtering out a small amount of important information from a large amount of information and focusing on these important information, ignoring most of the unimportant information.
  • the focusing process is reflected in the calculation of the weight coefficient.
  • the self-attention mechanism can be understood as internal Attention (intra attention).
  • the Attention mechanism occurs between the Query element of the Target and all the elements in the Source.
  • the specific calculation process is the same, but the calculation object has changed.
  • Grounding data visual positioning data (including pictures and corresponding descriptions). There are multiple boxes in a picture, and each box corresponds to a phrase in the description, describing the object or state in the box.
  • Detection data Conventional detection data, there are multiple boxes in an image, and one box corresponds to a noun category.
  • Figure 6 is a flow chart of a data processing method provided in an embodiment of the present application.
  • a data processing method provided in an embodiment of the present application may include steps 601 to 603, and these steps are described in detail below.
  • steps 601 to 603 can be the feedforward process of the model training process, or can be the reasoning process of the model.
  • training samples including images and object detection requests (also referred to as human language instructions) can be obtained.
  • a labeling process can be built based on the existing object detection dataset and language model.
  • human language instructions are refined and divided into the following four tasks according to characteristics and requirements:
  • Task 1 is to detect all categories. In this task, we hope that the model can fully and thoroughly detect and determine all object categories in the image after receiving the user's input.
  • Task 2 is to detect partial categories. Compared with the comprehensive detection of Task 1, this task requires the model to be more targeted to identify and detect specific object categories specified by the user.
  • Task 3 is to detect the categories contained in a parent category.
  • the model needs to understand and identify the hierarchical relationship between objects. For example, if the user asks to detect all fruit categories, the model needs to detect all fruits in the picture, such as apples, oranges, etc.
  • Task 4 is to detect categories with a certain function or attribute. This task requires the model to have a higher level of understanding and recognition capabilities. For example, when the user instructs to detect all objects that can be used for writing, the model needs to recognize different categories of objects such as pencils, pens, and markers.
  • the model can better understand and execute the user's language instructions, thereby more accurately identifying and locating objects in images.
  • FIG. 7A is a schematic diagram of a natural language description of an object detection request for each task in a training sample.
  • an object detection request may indicate target detection on an image, and the semantics of the object detection request includes a description of the object to be detected.
  • the image encoder when performing target detection, the image encoder outputs the feature representation of the entire image, and the related training method makes the language model not have/not good at fine-grained image processing capabilities.
  • the image encoder outputs the feature representation of each of the multiple image areas in the image, and each image area can correspond to a candidate detection box, and each detection box can contain an object.
  • the area where the object to be detected indicated in the object detection request is located can be selected from multiple image areas.
  • the feature representation of each image area and the object detection request can be input into the language model, and the language model determines whether the object included in each image area is the object to be identified indicated by the object detection request.
  • the language model can also output the category of the object included in the image area when it is determined that the object included in the image area is the object to be identified indicated by the object detection request.
  • Using the image encoder to obtain the features of each image area and combining it with the language model for target detection can improve the processing capabilities for fine-grained features and improve the accuracy of target detection under the guidance of human language.
  • a training sample of an image encoder can be obtained, wherein the training sample includes an image sample and a corresponding text sample, wherein the text sample is a text description corresponding to the image sample; the image sample is processed by the image encoder to obtain a first processing result; the text sample is processed by the text encoder to obtain a second processing result; and the image encoder and the text encoder are updated through comparative learning based on the first processing result and the second processing result.
  • the first processing result includes multiple detection boxes and a category of each detection box; the image encoder and the text encoder can be updated according to the first processing result and the corresponding true value.
  • model architecture for image encoders, the model can use the same or similar architecture as DetCLIP. Specifically, the same ATSS architecture as the swin-T backbone can be used.
  • the FlanT5 model family can be used, for example, it can be performed on OPT, FlanT5-base, and FlanT5-Large at the same time.
  • the training process of the embodiment of the present application may include two stages.
  • the above-mentioned training process for the image encoder and the text encoder may belong to the first stage.
  • the first stage is similar to the pre-training of the open vocabulary object detector.
  • training data from detection, positioning and captioning tasks may be used.
  • the DetCLIP method can be used to align features with text.
  • open vocabulary detection pre-training can be performed in the DetCLIP manner.
  • the detector is pre-trained by optimizing the fine contrast loss between the text embedding and the object-level visual embedding, as well as the center loss and the bounding box regression loss.
  • Visual-text feature alignment is performed using detection, positioning, and image-text pair datasets.
  • a vocabulary object detector is obtained, which can extract visual object embeddings that are well aligned with text embeddings from the pre-trained CLIP text encoder.
  • the training method of DetCLIP can be continued.
  • M RoI region features V i , i ⁇ [1,M] are obtained through an image encoder ⁇ i (for example, an ATSS single-stage detector can be used), and the single-stage detector is calculated.
  • the center loss L CEN sigmoid cross entropy loss
  • regression loss L REG giou loss
  • alignment loss function LALI alignment loss function
  • a target detection result of the corresponding image area can be obtained based on each feature representation and object detection request.
  • the detection result can indicate whether the object included in the image area is the object indicated in the object detection request, and the category corresponding to the object when the object included in the image area is the object indicated in the object detection request.
  • the language model may output “other” when determining that the object included in the image region is not the object indicated in the object detection request. That is, only the detection boxes that meet the instructions will be classified, and the others are marked as other categories.
  • the object detection request and each of the feature representations can be processed in parallel through a language model to obtain a detection result for each of the image regions; and based on the detection result, the region where the object to be detected is located is determined from among the multiple image regions.
  • the language model can determine the detection results for each image region in parallel.
  • the first method is to connect the object features and train a language model to sequentially predict the output of each object. However, this does not conform to the original output habits of the language long-term memory model (LLM), which increases the difficulty of training.
  • Another method is to allow the language model to process each object feature independently. Specifically, the box-based object features obtained by each detection model interact with the corresponding instructions through LLM, and then LLM only predicts the specific category output of the object based on the instruction.
  • the language model includes multiple network layers, at least one of the multiple network layers includes a cross-attention layer; the cross-attention layer is used to perform attention interaction between image features and text features.
  • the training of the language model can be the second stage.
  • other parameters except the language model can be fixed, and the language model (such as the feature interaction module in the language model) can be trained to realize the image and text understanding detection under human instructions.
  • the language model (such as the feature interaction module in the language model) can be trained to realize the image and text understanding detection under human instructions.
  • the object detector is given the ability to follow human instructions by introducing a language model into the model.
  • the model can be trained on the IOD-Bench training set and predict object category names only for those objects that meet the instructions.
  • instruction adjustment is performed using the training data in IOD-Bench.
  • the image encoder and pre-trained language model obtained in the first stage are frozen.
  • a randomly initialized cross-attention layer that is, the cross-attention layer in the embodiment of the present application
  • the image is processed by the image encoder to extract object-level visual features.
  • the accompanying text instructions are processed by the language model.
  • Cross-attention operations are performed between object-level visual features and text features.
  • FF feed forward network
  • Attn refers to feed forward network
  • hL is the input of text features corresponding to the Lth layer block
  • a is a learnable parameter initialized to 0.
  • Vi is the visual feature of the i-th object, is the text token associated with the ith object at the tth time step, Refers to the text token related to the i-th object before the t-th time.
  • the embodiment of the present application introduces a large language model to increase the model's understanding and reasoning ability of pictures.
  • the specific approach includes: inserting a randomly initialized cross-attention layer in the decoding layer of the language model and training from scratch.
  • the image is processed by the encoder to extract object-level visual features.
  • the accompanying text instructions are processed by the language model.
  • Cross-attention operations are performed between object-level visual features and text features.
  • the model of the embodiment of the present application also shows good performance on instructions that did not appear during training.
  • Ins-DetCLIP using FlanT5-base can still achieve an average mAP of 13.7, which is only slightly lower than the result on in-domain instructions by 1.6%.
  • Ins-DetCLIP of the embodiment of the present application can not only predict category names, but also generate detailed descriptions for objects of interest. By benchmarking it on the Dense Captioning task, the superior description generation ability of the model of the embodiment of the present application is demonstrated. To ensure a fair comparison, the regression head of Ins-DetCLIP was fine-tuned using the box annotations of the Dense Captioning dataset. As shown in Table 2, the model of the embodiment of the present application consistently outperforms other methods and achieves state-of-the-art results.
  • the inference efficiency between Ins-DetCLIP and the two-stage baseline is compared in terms of frames per second (FPS).
  • FPS frames per second
  • FIG. 8 is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application.
  • a data processing device 800 provided in an embodiment of the present application includes:
  • An acquisition module 801 is used to acquire an image and an object detection request, wherein the object detection request includes a natural language description of an object to be detected in the image;
  • a processing module 802 is used to process the image through an image encoder to obtain a feature representation of each image region in a plurality of image regions, each image region corresponding to a candidate detection frame;
  • the object detection request and the plurality of feature representations are processed by a language model, and a region where the object to be detected is located is determined from among the plurality of image regions.
  • processing module 802 is specifically configured to:
  • the area where the object to be detected is located is determined from the multiple image areas.
  • the acquisition module 801 is further configured to:
  • the training sample includes an image sample and a corresponding text sample, wherein the text sample is a text description corresponding to the image sample;
  • the processing module 802 is further configured to: process the image sample through an image encoder to obtain a first processing result;
  • the image encoder and the text encoder are updated through comparative learning.
  • the first processing result includes a plurality of detection frames and a category of each detection frame; and the processing module 802 is further configured to:
  • the image encoder and the text encoder are updated according to the first processing result and the corresponding true value.
  • the language model includes multiple network layers, at least one of the multiple network layers includes a cross-attention layer; the cross-attention layer is used to perform attention interaction between image features and text features.
  • FIG. 9 is a structural schematic diagram of an execution device provided in an embodiment of the present application.
  • the execution device 900 can be specifically manifested as a virtual reality VR device, a mobile phone, a tablet, a laptop computer, a smart wearable device, a monitoring data processing device or a server, etc., which is not limited here.
  • the execution device 900 includes: a receiver 901, a transmitter 902, a processor 903 and a memory 904 (wherein the number of processors 903 in the execution device 900 can be one or more, and one processor is taken as an example in Figure 9), wherein the processor 903 may include an application processor 9031 and a communication processor 9032.
  • the receiver 901, the transmitter 902, the processor 903 and the memory 904 may be connected via a bus or other means.
  • the memory 904 may include a read-only memory and a random access memory, and provides instructions and data to the processor 903. A portion of the memory 904 may also include a non-volatile random access memory (NVRAM).
  • NVRAM non-volatile random access memory
  • the memory 904 stores processor and operation instructions, executable modules or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.
  • the processor 903 controls the operation of the execution device.
  • the various components of the execution device are coupled together through a bus system, wherein the bus system may include a power bus, a control bus, and a status signal bus in addition to a data bus.
  • the bus system may include a power bus, a control bus, and a status signal bus in addition to a data bus.
  • various buses are referred to as bus systems in the figures.
  • the method disclosed in the above embodiment of the present application can be applied to the processor 903, or implemented by the processor 903.
  • the processor 903 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 903 or the instruction in the form of software.
  • the above processor 903 can be a general processor, a digital signal processor (digital signal processing, DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (application specific integrated circuit, ASIC), a field programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
  • the processor 903 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiment of the present application.
  • the general processor can be a microprocessor or the processor can also be any conventional processor, etc.
  • the steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to be executed, or a combination of hardware and software modules in the decoding processor can be executed.
  • the software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc.
  • the storage medium is located in the memory 904, and the processor 903 reads the information in the memory 904 and completes the steps of the above method in combination with its hardware.
  • the receiver 901 can be used to receive input digital or character information and generate signal input related to the relevant settings and function control of the execution device.
  • the transmitter 902 can be used to output digital or character information through the first interface; the transmitter 902 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 902 can also include a display device such as a display screen.
  • FIG. 10 is a structural diagram of the training device provided by the embodiment of the present application, specifically, the training device 1000 is implemented by one or more servers, and the training device 1000 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1010 (for example, one or more processors) and memory 1032, one or more storage media 1030 (for example, one or more mass storage devices) storing application programs 1042 or data 1044.
  • the memory 1032 and the storage medium 1030 can be short-term storage or permanent storage.
  • the program stored in the storage medium 1030 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the training device.
  • the central processor 1010 can be configured to communicate with the storage medium 1030 to execute a series of instruction operations in the storage medium 1030 on the training device 1000.
  • the training device 1000 may also include one or more power supplies 1026, one or more wired or wireless network interfaces 1050, one or more input and output interfaces 1058; or, one or more operating systems 1041, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
  • operating systems 1041 such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
  • the central processing unit 1010 is used to execute actions related to model training in the above embodiment.
  • Also provided in an embodiment of the present application is a computer program product which, when executed on a computer, enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.
  • a computer-readable storage medium is also provided in an embodiment of the present application, which stores a program for signal processing.
  • the computer-readable storage medium When the computer-readable storage medium is run on a computer, it enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.
  • the execution device, training device or terminal device provided in the embodiments of the present application may specifically be a chip, and the chip includes: a processing unit and a communication unit, wherein the processing unit may be, for example, a processor, and the communication unit may be, for example, an input/output interface, a pin or a circuit, etc.
  • the processing unit may execute the computer execution instructions stored in the storage unit so that the chip in the execution device executes the data processing method described in the above embodiment, or so that the chip in the training device executes the data processing method described in the above embodiment.
  • the storage unit is a storage unit in the chip, such as a register, a cache, etc.
  • the storage unit may also be a storage unit located outside the chip in the wireless access device end, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.
  • ROM read-only memory
  • RAM random access memory
  • FIG. 11 is a schematic diagram of the structure of a chip provided in an embodiment of the present application.
  • the chip can be expressed as a neural network processor NPU 1100.
  • NPU 1100 is mounted on the host CPU (Host CPU) as a coprocessor, and tasks are assigned by the Host CPU.
  • the core part of the NPU is the operation circuit 1103, which is controlled by the controller 1104 to extract matrix data from the memory and perform multiplication operations.
  • the operation circuit 1103 includes multiple processing units (Process Engine, PE) inside.
  • the operation circuit 1103 is a two-dimensional systolic array.
  • the operation circuit 1103 can also be a one-dimensional systolic array or other electronic circuits capable of performing mathematical operations such as multiplication and addition.
  • the operation circuit 1103 is a general-purpose matrix processor.
  • the operation circuit takes the corresponding data of matrix B from the weight memory 1102 and caches it on each PE in the operation circuit.
  • the operation circuit takes the matrix A data from the input memory 1101 and performs matrix operation with matrix B, and the partial result or final result of the matrix is stored in the accumulator 1108.
  • the unified memory 1106 is used to store input data and output data.
  • the weight data is directly transferred to the weight memory 1102 through the direct memory access controller (DMAC) 1105.
  • the input data is also transferred to the unified memory 1106 through the DMAC.
  • DMAC direct memory access controller
  • BIU stands for Bus Interface Unit, that is, the bus interface unit 1110, which is used for the interaction between AXI bus and DMAC and instruction fetch buffer (IFB) 1109.
  • IOB instruction fetch buffer
  • the bus interface unit 1110 (BIU for short) is used for the instruction fetch memory 1109 to obtain instructions from the external memory, and is also used for the storage unit access controller 1105 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
  • DMAC is mainly used to transfer input data in the external memory DDR to the unified memory 1106 or to transfer weight data to the weight memory 1102 or to transfer input data to the input memory 1101.
  • the vector calculation unit 1107 includes multiple operation processing units, and when necessary, further processes the output of the operation circuit 1103, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional/fully connected layer network calculations in neural networks, such as Batch Normalization, pixel-level summation, upsampling of feature planes, etc.
  • the vector calculation unit 1107 can store the processed output vector to the unified memory 1106.
  • the vector calculation unit 1107 can apply a linear function; or a nonlinear function to the output of the operation circuit 1103, such as linear interpolation of the feature plane extracted by the convolution layer, and then, for example, a vector of accumulated values to generate an activation value.
  • the vector calculation unit 1107 generates a normalized value, a pixel-level summed value, or both.
  • the processed output vector can be used as an activation input to the operation circuit 1103, for example, for use in a subsequent layer in a neural network.
  • An instruction fetch buffer 1109 connected to the controller 1104 is used to store instructions used by the controller 1104;
  • Unified memory 1106, input memory 1101, weight memory 1102 and instruction fetch memory 1109 are all on-chip memories. External memories are private to the NPU hardware architecture.
  • the processor mentioned in any of the above places may be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the above programs.
  • the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
  • the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
  • the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a magnetic disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
  • a computer device which can be a personal computer, a training device, or a network device, etc.
  • all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof.
  • all or part of the embodiments may be implemented in the form of a computer program product.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, Computer network, or other programmable device.
  • the computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from one website, computer, training device or data center to another website, computer, training device or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.
  • wired e.g., coaxial cable, optical fiber, digital subscriber line (DSL)
  • wireless e.g., infrared, wireless, microwave, etc.
  • the computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, data center, etc. that includes one or more available media integrated.
  • the available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive (SSD)).

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Databases & Information Systems (AREA)
  • Library & Information Science (AREA)
  • Multimedia (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Molecular Biology (AREA)
  • Mathematical Physics (AREA)
  • Medical Informatics (AREA)
  • Image Analysis (AREA)

Abstract

A data processing method, relating to the field of artificial intelligence, and comprising: acquiring an image and an object detection request, the object detection request containing a natural language description of an object to be detected in the image; by means of an image encoder, processing the image to obtain a feature representation of each image region among a plurality of image regions, each image region corresponding to a candidate detection box; and, by means of a language model, processing the object detection request and the multiple feature representations to determine from among the plurality of image regions a region where said object is located and the category of said object. The present application uses the image encoder to obtain fine-grained features, i.e. the features of each image region, and performs object detection on the basis of the language model, thereby improving the capability of processing the fine-grained features and the precision of object detection under the guidance of human languages.

Description

一种数据处理方法及其装置A data processing method and device thereof

本申请要求于2023年8月23日提交国家知识产权局、申请号为202311071646.4、申请名称为“一种数据处理方法及其装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed with the State Intellectual Property Office on August 23, 2023, with application number 202311071646.4 and application name “A data processing method and device thereof”, the entire contents of which are incorporated by reference in this application.

技术领域Technical Field

本申请涉及人工智能领域,尤其涉及一种数据处理方法及其装置。The present application relates to the field of artificial intelligence, and in particular to a data processing method and device thereof.

背景技术Background Art

在当前的机器视觉领域,开放域检测模型,例如DetCLIP,已经展现出了强大的能力,可以针对任意给定的类别,实现精确的目标检测。然而,这个模型并不是无懈可击的,其实际应用中存在一些显而易见的问题。首先,我们往往无法提供一些具体的物体类别,这是因为现实世界中的物体种类繁多,而我们的知识库和词汇库却有限。其次,我们列举出的类别表也往往是不完整的,这个问题更多的是来源于我们的知识获取和组织方式的局限性。最后,我们无法根据类别的一些属性,功能等知识去给出具体的类别,这是因为目前的机器视觉系统缺乏对知识的深度理解和综合运用的能力。In the current field of machine vision, open domain detection models, such as DetCLIP, have demonstrated powerful capabilities and can achieve accurate target detection for any given category. However, this model is not impeccable, and there are some obvious problems in its practical application. First, we often cannot provide some specific object categories. This is because there are many kinds of objects in the real world, but our knowledge base and vocabulary are limited. Secondly, the category tables we list are often incomplete. This problem is more due to the limitations of our knowledge acquisition and organization methods. Finally, we cannot give specific categories based on some attributes, functions and other knowledge of the category. This is because the current machine vision system lacks the ability to deeply understand and comprehensively apply knowledge.

然而,现在已经有一些大型的语言模型,如ChatGPT,和多模态大模型,如miniGPT4,已经具备了较为出色的知识理解和推理能力。这些模型可以理解和处理人类的自然语言,还能根据给定的信息进行有意义的推理。但它们同样也有一些不足之处,比如缺乏对于细粒度任务如目标检测等任务的预测能力。However, there are already some large language models, such as ChatGPT, and multimodal large models, such as miniGPT4, which have excellent knowledge understanding and reasoning capabilities. These models can understand and process human natural language, and can also make meaningful inferences based on given information. But they also have some shortcomings, such as the lack of predictive capabilities for fine-grained tasks such as object detection.

发明内容Summary of the invention

本申请提供了一种数据处理方法,可以提高对于细粒度特征的处理能力,提高基于人类语言指引下目标检测的精度。The present application provides a data processing method that can improve the processing capability for fine-grained features and improve the accuracy of target detection under the guidance of human language.

第一方面,本申请提供了一种数据处理方法,所述方法包括:获取图像以及对象检测请求,所述对象检测请求包含针对于所述图像中待检测对象的自然语言描述;通过图像编码器,处理所述图像,得到多个图像区域中每个图像区域的特征表示,每个图像区域对应于一个候选的检测框;通过语言模型,处理所述对象检测请求和多个所述特征表示,从所述多个图像区域中确定所述待检测对象所在的区域和类别。In a first aspect, the present application provides a data processing method, comprising: acquiring an image and an object detection request, the object detection request comprising a natural language description of an object to be detected in the image; processing the image through an image encoder to obtain a feature representation of each of a plurality of image regions, each image region corresponding to a candidate detection box; processing the object detection request and a plurality of the feature representations through a language model, and determining the region and category of the object to be detected from the plurality of image regions.

在现有的实现中,在进行目标检测时,图像编码器输出的是整张图的特征表示,同时相关训练方式使得语言模型不具有/不擅长细粒度的图像处理能力,本申请实施例中,图像编码器输出的是图像中多个图像区域中每个图像区域的特征表示,每个图像区域可以对应一个候选的检测框,每个检测框可以包含一个对象。对象检测请求中指示的待检测对象所在的区域可以从多个图像区域内选择,具体可以将每个图像区域的特征表示和对象检测请求输入到语言模型中,由语言模型确定每个图像区域包括的对象是否是对象检测请求指示的待识别对象,语言模型还可以在确定出图像区域包括的对象是对象检测请求指示的待识别对象时,输出图像区域包括的对象的类别。In the existing implementation, when performing target detection, the image encoder outputs the feature representation of the entire image, and the related training method makes the language model not have/not good at fine-grained image processing capabilities. In the embodiment of the present application, the image encoder outputs the feature representation of each of the multiple image areas in the image, and each image area can correspond to a candidate detection box, and each detection box can contain an object. The area where the object to be detected indicated in the object detection request is located can be selected from multiple image areas. Specifically, the feature representation of each image area and the object detection request can be input into the language model, and the language model determines whether the object included in each image area is the object to be identified indicated by the object detection request. The language model can also output the category of the object included in the image area when it is determined that the object included in the image area is the object to be identified indicated by the object detection request.

利用图像编码器得到每个图像区域的特征,并结合语言模型进行目标检测,可以提高对于细粒度特征的处理能力,提高人类语言指引下目标检测的精度。Using the image encoder to obtain the features of each image area and combining it with the language model for target detection can improve the processing capabilities for fine-grained features and improve the accuracy of target detection under the guidance of human language.

在一种可能的实现中,所述通过语言模型,处理所述对象检测请求和多个所述特征表示,从所述多个图像区域中确定所述待检测对象所在的区域,包括:通过语言模型,并行处理所述对象检测请求和每个所述特征表示,得到每个所述图像区域的检测结果;根据所述检测结果,从所述多个图像区域中确定所述待检测对象所在的区域。In a possible implementation, the processing of the object detection request and the multiple feature representations through a language model to determine the area where the object to be detected is located from the multiple image areas includes: processing the object detection request and each feature representation in parallel through a language model to obtain a detection result for each image area; and determining, based on the detection results, the area where the object to be detected is located from the multiple image areas.

在一种可能的实现中,所述通过图像编码器,处理所述图像之前,所述方法还包括:获取训练样本,所述训练样本包括图像样本和对应的文本样本,所述文本样本为所述图像样本对应的文本描述;通过图像编码器,处理所述图像样本,得到第一处理结果;通过文本编码器,处理所述文本样本,得到第二处理结果;根据所述第一处理结果和所述第二处理结果,通过对比学习更新所述图像编码器和所述文本编 码器。In a possible implementation, before the image is processed by the image encoder, the method further includes: obtaining a training sample, the training sample including an image sample and a corresponding text sample, the text sample being a text description corresponding to the image sample; processing the image sample by the image encoder to obtain a first processing result; processing the text sample by the text encoder to obtain a second processing result; and updating the image encoder and the text encoder according to the first processing result and the second processing result through comparative learning. Encoder.

在一种可能的实现中,所述第一处理结果包括多个检测框,以及每个检测框的类别;所述方法还包括:根据所述第一处理结果和对应的真值,更新所述图像编码器和所述文本编码器。In a possible implementation, the first processing result includes multiple detection boxes and a category of each detection box; the method also includes: updating the image encoder and the text encoder according to the first processing result and the corresponding true value.

在一种可能的实现中,所述语言模型包括多个网络层,所述多个网络层中的至少一个网络层包括交叉注意力层;所述交叉注意力层用于对图像特征和文本特征之间进行注意力交互。In a possible implementation, the language model includes multiple network layers, at least one of the multiple network layers includes a cross-attention layer; the cross-attention layer is used to perform attention interaction between image features and text features.

第二方面,本申请提供了一种数据处理装置,所述装置包括:In a second aspect, the present application provides a data processing device, the device comprising:

获取模块,用于获取图像以及对象检测请求,所述对象检测请求包含针对于所述图像中待检测对象的自然语言描述;An acquisition module, configured to acquire an image and an object detection request, wherein the object detection request includes a natural language description of an object to be detected in the image;

处理模块,用于通过图像编码器,处理所述图像,得到多个图像区域中每个图像区域的特征表示,每个图像区域对应于一个候选的检测框;A processing module, configured to process the image through an image encoder to obtain a feature representation of each of a plurality of image regions, each image region corresponding to a candidate detection frame;

通过语言模型,处理所述对象检测请求和多个所述特征表示,从所述多个图像区域中确定所述待检测对象所在的区域。The object detection request and the plurality of feature representations are processed by a language model, and a region where the object to be detected is located is determined from among the plurality of image regions.

在一种可能的实现中,所述处理模块,具体用于:In a possible implementation, the processing module is specifically configured to:

通过语言模型,并行处理所述对象检测请求和每个所述特征表示,得到每个所述图像区域的检测结果;Processing the object detection request and each of the feature representations in parallel through a language model to obtain a detection result for each of the image regions;

根据所述检测结果,从所述多个图像区域中确定所述待检测对象所在的区域。According to the detection result, the area where the object to be detected is located is determined from the multiple image areas.

在一种可能的实现中,所述通过图像编码器,处理所述图像之前,所述获取模块,还用于:In a possible implementation, before the image is processed by the image encoder, the acquisition module is further used to:

获取训练样本,所述训练样本包括图像样本和对应的文本样本,所述文本样本为所述图像样本对应的文本描述;Acquire a training sample, wherein the training sample includes an image sample and a corresponding text sample, wherein the text sample is a text description corresponding to the image sample;

所述处理模块,还用于:通过图像编码器,处理所述图像样本,得到第一处理结果;The processing module is further used to: process the image sample through an image encoder to obtain a first processing result;

通过文本编码器,处理所述文本样本,得到第二处理结果;Processing the text sample through a text encoder to obtain a second processing result;

根据所述第一处理结果和所述第二处理结果,通过对比学习更新所述图像编码器和所述文本编码器。According to the first processing result and the second processing result, the image encoder and the text encoder are updated through comparative learning.

在一种可能的实现中,所述第一处理结果包括多个检测框,以及每个检测框的类别;所述处理模块,还用于:In a possible implementation, the first processing result includes a plurality of detection frames and a category of each detection frame; and the processing module is further configured to:

根据所述第一处理结果和对应的真值,更新所述图像编码器和所述文本编码器。The image encoder and the text encoder are updated according to the first processing result and the corresponding true value.

在一种可能的实现中,所述语言模型包括多个网络层,所述多个网络层中的至少一个网络层包括交叉注意力层;所述交叉注意力层用于对图像特征和文本特征之间进行注意力交互。In a possible implementation, the language model includes multiple network layers, at least one of the multiple network layers includes a cross-attention layer; the cross-attention layer is used to perform attention interaction between image features and text features.

第三方面,本申请实施例提供了一种数据处理装置,可以包括存储器、处理器以及总线系统,其中,存储器用于存储程序,处理器用于执行存储器中的程序,以执行如上述第一方面及其任一可选的方法。In a third aspect, an embodiment of the present application provides a data processing device, which may include a memory, a processor, and a bus system, wherein the memory is used to store programs, and the processor is used to execute the programs in the memory to perform the first aspect and any optional method thereof.

第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,当其在计算机上运行时,使得计算机执行上述第一方面及其任一可选的方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the above-mentioned first aspect and any optional method thereof.

第五方面,本申请实施例提供了一种计算机程序,当其在计算机上运行时,使得计算机执行上述第一方面及其任一可选的方法。In a fifth aspect, an embodiment of the present application provides a computer program, which, when executed on a computer, enables the computer to execute the above-mentioned first aspect and any optional method thereof.

第六方面,本申请提供了一种芯片系统,该芯片系统包括处理器,用于支持数据处理装置实现上述方面中所涉及的功能,例如,发送或处理上述方法中所涉及的数据;或,信息。在一种可能的设计中,所述芯片系统还包括存储器,所述存储器,用于保存执行设备或训练设备必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包括芯片和其他分立器件。In a sixth aspect, the present application provides a chip system, which includes a processor for supporting a data processing device to implement the functions involved in the above aspects, such as sending or processing the data involved in the above methods; or information. In one possible design, the chip system also includes a memory, which is used to store program instructions and data necessary for executing the device or training the device. The chip system can be composed of chips, or it can include chips and other discrete devices.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1A为人工智能主体框架的一种结构示意图; FIG1A is a schematic diagram of a structure of an artificial intelligence main framework;

图1B至图1D为本申请的应用框架示意;1B to 1D are schematic diagrams of the application framework of the present application;

图2为本申请的应用框架示意;FIG2 is a schematic diagram of the application framework of the present application;

图3为本申请的应用框架示意;FIG3 is a schematic diagram of the application framework of the present application;

图4为本申请的应用框架示意;FIG4 is a schematic diagram of the application framework of the present application;

图5A和图5B为本申请的一种网络结构示意;FIG5A and FIG5B are schematic diagrams of a network structure of the present application;

图6为本申请实施例提供的一种数据处理方法的流程示意;FIG6 is a flowchart of a data processing method provided in an embodiment of the present application;

图7A为本申请实施例提供的一个训练样本中文本的示意图;FIG7A is a schematic diagram of text in a training sample provided in an embodiment of the present application;

图7B为本申请实施例提供的一个训练过程示意图;FIG7B is a schematic diagram of a training process provided in an embodiment of the present application;

图8为本申请实施例提供的数据处理装置的一种结构示意图;FIG8 is a schematic diagram of a structure of a data processing device provided in an embodiment of the present application;

图9为本申请实施例提供的执行设备的一种结构示意图;FIG9 is a schematic diagram of a structure of an execution device provided in an embodiment of the present application;

图10为本申请实施例提供的训练设备一种结构示意图;FIG10 is a schematic diagram of a structure of a training device provided in an embodiment of the present application;

图11为本申请实施例提供的芯片的一种结构示意图。FIG. 11 is a schematic diagram of the structure of a chip provided in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

下面结合本发明实施例中的附图对本发明实施例进行描述。本发明的实施方式部分使用的术语仅用于对本发明的具体实施例进行解释,而非旨在限定本发明。The following describes the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. The terms used in the implementation mode of the present invention are only used to explain the specific embodiments of the present invention, and are not intended to limit the present invention.

下面结合附图,对本申请的实施例进行描述。本领域普通技术人员可知,随着技术的发展和新场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。The embodiments of the present application are described below in conjunction with the accompanying drawings. It is known to those skilled in the art that with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的术语在适当情况下可以互换,这仅仅是描述本申请的实施例中对相同属性的对象在描述时所采用的区分方式。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,以便包含一系列单元的过程、方法、系统、产品或设备不必限于那些单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它单元。The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

首先对人工智能系统总体工作流程进行描述,请参见图1A,图1A示出的为人工智能主体框架的一种结构示意图,下面从“智能信息链”(水平轴)和“IT价值链”(垂直轴)两个维度对上述人工智能主题框架进行阐述。其中,“智能信息链”反映从数据的获取到处理的一列过程。举例来说,可以是智能信息感知、智能信息表示与形成、智能推理、智能决策、智能执行与输出的一般过程。在这个过程中,数据经历了“数据—信息—知识—智慧”的凝练过程。“IT价值链”从人智能的底层基础设施、信息(提供和处理技术实现)到系统的产业生态过程,反映人工智能为信息技术产业带来的价值。First, the overall workflow of the artificial intelligence system is described. Please refer to Figure 1A. Figure 1A shows a structural diagram of the main framework of artificial intelligence. The following is an explanation of the above artificial intelligence theme framework from the two dimensions of "intelligent information chain" (horizontal axis) and "IT value chain" (vertical axis). Among them, the "intelligent information chain" reflects a series of processes from data acquisition to processing. For example, it can be a general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output. In this process, the data has undergone a condensation process of "data-information-knowledge-wisdom". The "IT value chain" reflects the value that artificial intelligence brings to the information technology industry from the underlying infrastructure of human intelligence, information (providing and processing technology implementation) to the industrial ecology process of the system.

(1)基础设施(1) Infrastructure

基础设施为人工智能系统提供计算能力支持,实现与外部世界的沟通,并通过基础平台实现支撑。通过传感器与外部沟通;计算能力由智能芯片(CPU、NPU、GPU、ASIC、FPGA等硬件加速芯片)提供;基础平台包括分布式计算框架及网络等相关的平台保障和支持,可以包括云存储和计算、互联互通网络等。举例来说,传感器和外部沟通获取数据,这些数据提供给基础平台提供的分布式计算系统中的智能芯片进行计算。The infrastructure provides computing power support for the artificial intelligence system, enables communication with the outside world, and supports it through the basic platform. It communicates with the outside world through sensors; computing power is provided by smart chips (CPU, NPU, GPU, ASIC, FPGA and other hardware acceleration chips); the basic platform includes distributed computing frameworks and networks and other related platform guarantees and support, which can include cloud storage and computing, interconnected networks, etc. For example, sensors communicate with the outside world to obtain data, and these data are provided to the smart chips in the distributed computing system provided by the basic platform for calculation.

(2)数据(2) Data

基础设施的上一层的数据用于表示人工智能领域的数据来源。数据涉及到图形、图像、语音、文本,还涉及到传统设备的物联网数据,包括已有系统的业务数据以及力、位移、液位、温度、湿度等感知数据。The data on the upper layer of the infrastructure is used to represent the data sources in the field of artificial intelligence. The data involves graphics, images, voice, text, and IoT data of traditional devices, including business data of existing systems and perception data such as force, displacement, liquid level, temperature, and humidity.

(3)数据处理(3) Data processing

数据处理通常包括数据训练,机器学习,深度学习,搜索,推理,决策等方式。Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making and other methods.

其中,机器学习和深度学习可以对数据进行符号化和形式化的智能信息建模、抽取、预处理、训练等。Among them, machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, and training.

推理是指在计算机或智能系统中,模拟人类的智能推理方式,依据推理控制策略,利用形式化的信息进行机器思维和求解问题的过程,典型的功能是搜索与匹配。Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formalized information to perform machine thinking and solve problems based on reasoning control strategies. Typical functions are search and matching.

决策是指智能信息经过推理后进行决策的过程,通常提供分类、排序、预测等功能。 Decision-making refers to the process of making decisions after intelligent information is reasoned, usually providing functions such as classification, sorting, and prediction.

(4)通用能力(4) General capabilities

对数据经过上面提到的数据处理后,进一步基于数据处理的结果可以形成一些通用的能力,比如可以是算法或者一个通用系统,例如,翻译,文本的分析,计算机视觉的处理,语音识别,图像的识别等等。After the data has undergone the data processing mentioned above, some general capabilities can be further formed based on the results of the data processing, such as an algorithm or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.

(5)智能产品及行业应用(5) Smart products and industry applications

智能产品及行业应用指人工智能系统在各领域的产品和应用,是对人工智能整体解决方案的封装,将智能信息决策产品化、实现落地应用,其应用领域主要包括:智能终端、智能交通、智能医疗、自动驾驶、智慧城市等。Smart products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall artificial intelligence solution, which productizes intelligent information decision-making and realizes practical applications. Its application areas mainly include: smart terminals, smart transportation, smart medical care, autonomous driving, smart cities, etc.

本申请可以应用于人工智能领域的图像处理领域中,下面以图像处理为例将对多个落地到产品的多个应用场景进行介绍。The present application can be applied to the field of image processing in the field of artificial intelligence. Taking image processing as an example, multiple application scenarios of products will be introduced below.

首先介绍本申请的应用场景。First, the application scenario of this application is introduced.

本申请可以但不限于应用在具备图像处理功能的应用程序(以下可以简称为图像处理类应用程序)或者云侧服务器提供的云服务等,接下来分别进行介绍:This application can be applied to, but is not limited to, applications with image processing functions (hereinafter referred to as image processing applications) or cloud services provided by cloud servers, etc., which are introduced below:

一、图像处理类应用程序1. Image processing applications

本申请实施例的产品形态可以为图像处理类应用程序,特别的,可以为具备图像分割功能的应用程序。图像处理类应用程序可以运行在终端设备或者云侧的服务器上。The product form of the embodiment of the present application can be an image processing application, in particular, an application with an image segmentation function. The image processing application can be run on a terminal device or a server on the cloud side.

在一种可能的实现中,图像处理类应用程序可以实现基于输入的图像和文本进行目标检测等任务,得到处理结果,文本可以指定检测对象的描述,处理结果可以是检测结果(例如包括检测框以及类别)。In one possible implementation, an image processing application can implement tasks such as target detection based on input images and text to obtain a processing result. The text can specify a description of the detected object, and the processing result can be a detection result (for example, including a detection box and a category).

在一种可能的实现中,用户可以打开终端设备上安装的图像处理类应用程序,并输入图像和文本,图像处理类应用程序可以通过本申请实施例提供的方法对图像和文本进行处理,并将处理结果呈现给用户(呈现方式可以但不限于是显示、保存、上传到云侧等)。In one possible implementation, a user can open an image processing application installed on a terminal device and input images and text. The image processing application can process the images and text using the method provided in an embodiment of the present application and present the processing results to the user (the presentation method may be but is not limited to display, saving, uploading to the cloud, etc.).

在一种可能的实现中,用户可以打开终端设备上安装的图像处理类应用程序,并输入图像和文本,图像处理类应用程序可以将图像和文本发送至云侧的服务器,云侧的服务器通过本申请实施例提供的方法对图像和文本进行处理,并将处理结果回传至终端设备,终端设备可以将处理结果呈现给用户(呈现方式可以但不限于是显示、保存、上传到云侧等)。In one possible implementation, a user can open an image processing application installed on a terminal device and input images and text. The image processing application can send the image and text to a server on the cloud side. The server on the cloud side processes the image and text using the method provided in an embodiment of the present application and transmits the processing results back to the terminal device. The terminal device can present the processing results to the user (the presentation method may be but is not limited to display, saving, uploading to the cloud side, etc.).

接下来分别从功能架构以及实现功能的产品架构介绍本申请实施例中的图像处理类应用程序。Next, the image processing application in the embodiment of the present application is introduced from the functional architecture and the product architecture that realizes the functions.

参照图1B,图1B为本申请实施例中图像处理类应用程序的功能架构示意:Referring to FIG. 1B , FIG. 1B is a schematic diagram of the functional architecture of an image processing application in an embodiment of the present application:

在一种可能的实现中,如图1B所示,图像处理类应用程序102可接收输入的参数101(例如包含图像和文本)且产生处理结果103。图像处理类应用程序102可在(举例来说)至少一个计算机系统上执行,且包括计算机代码,所述计算机代码在由一或多个计算机执行时致使所述计算机执行用于执行本申请实施例提供的方法。In a possible implementation, as shown in FIG1B , an image processing application 102 may receive input parameters 101 (e.g., including images and text) and generate processing results 103. The image processing application 102 may be executed on (for example) at least one computer system and includes computer codes, which, when executed by one or more computers, cause the computers to execute the method provided in the embodiments of the present application.

参照图1C,图1C为本申请实施例中运行图像处理类应用程序的实体架构示意:Referring to FIG. 1C , FIG. 1C is a schematic diagram of the physical architecture for running an image processing application in an embodiment of the present application:

参见图1C,图1C示出了一种系统架构示意图。该系统可以包括终端100、以及服务器200。其中,服务器200可以包括一个或者多个服务器(图1C中以包括一个服务器作为示例进行说明),服务器200可以为一个或者多个终端提供本申请实施例提供的方法。Referring to FIG. 1C , FIG. 1C shows a schematic diagram of a system architecture. The system may include a terminal 100 and a server 200. The server 200 may include one or more servers (FIG. 1C is illustrated by taking one server as an example), and the server 200 may provide the method provided in the embodiment of the present application for one or more terminals.

其中,终端100上可以安装有图像处理类应用程序,上述应用程序和网页可以提供一个界面,终端100可以接收用户在图像处理界面上输入的相关参数,并将上述参数发送至服务器200,服务器200可以基于接收到的参数,得到处理结果,并将处理结果返回至至终端100。Among them, an image processing application can be installed on the terminal 100. The above application and web page can provide an interface. The terminal 100 can receive relevant parameters entered by the user on the image processing interface and send the above parameters to the server 200. The server 200 can obtain the processing result based on the received parameters and return the processing result to the terminal 100.

应理解,在一些可选的实现中,终端100也可以由自身完成基于接收到的参数,得到处理结果的动作,而不需要服务器配合实现,本申请实施例并不限定。It should be understood that in some optional implementations, the terminal 100 can also complete the action of obtaining the processing result based on the received parameters by itself without the cooperation of the server, and the embodiments of the present application are not limited to this.

接下来描述图1C中终端100的产品形态;Next, the product form of the terminal 100 in FIG. 1C is described;

本申请实施例中的终端100可以为手机、平板电脑、可穿戴设备、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等,本申请实施例对此不作任何限制。The terminal 100 in the embodiment of the present application can be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (AR)/virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., and the embodiment of the present application does not impose any limitation on this.

图1D示出了终端100的一种可选的硬件结构示意图。 FIG. 1D shows a schematic diagram of an optional hardware structure of the terminal 100 .

参考图1D所示,终端100可以包括射频单元110、存储器120、输入单元130、显示单元140、摄像头150(可选的)、音频电路160(可选的)、扬声器161(可选的)、麦克风162(可选的)、处理器170、外部接口180、电源190等部件。本领域技术人员可以理解,图1D仅仅是终端或多功能设备的举例,并不构成对终端或多功能设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件。1D , the terminal 100 may include components such as a radio frequency unit 110, a memory 120, an input unit 130, a display unit 140, a camera 150 (optional), an audio circuit 160 (optional), a speaker 161 (optional), a microphone 162 (optional), a processor 170, an external interface 180, and a power supply 190. Those skilled in the art will appreciate that FIG. 1D is merely an example of a terminal or a multi-function device, and does not constitute a limitation on the terminal or the multi-function device, and may include more or fewer components than shown in the figure, or combine certain components, or different components.

输入单元130可用于接收输入的数字或字符信息,以及产生与该便携式多功能装置的用户设置以及功能控制有关的键信号输入。具体地,输入单元130可包括触摸屏131(可选的)和/或其他输入设备132。该触摸屏131可收集用户在其上或附近的触摸操作(比如用户使用手指、关节、触笔等任何适合的物体在触摸屏上或在触摸屏附近的操作),并根据预先设定的程序驱动相应的连接装置。触摸屏可以检测用户对触摸屏的触摸动作,将该触摸动作转换为触摸信号发送给该处理器170,并能接收该处理器170发来的命令并加以执行;该触摸信号至少包括触点坐标信息。该触摸屏131可以提供该终端100和用户之间的输入界面和输出界面。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触摸屏。除了触摸屏131,输入单元130还可以包括其他输入设备。具体地,其他输入设备132可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。The input unit 130 can be used to receive input digital or character information, and generate key signal input related to the user settings and function control of the portable multifunctional device. Specifically, the input unit 130 may include a touch screen 131 (optional) and/or other input devices 132. The touch screen 131 can collect the user's touch operations on or near it (such as the user's operation on or near the touch screen using any suitable object such as fingers, joints, stylus, etc.), and drive the corresponding connection device according to a pre-set program. The touch screen can detect the user's touch action on the touch screen, convert the touch action into a touch signal and send it to the processor 170, and can receive and execute the command sent by the processor 170; the touch signal at least includes the touch point coordinate information. The touch screen 131 can provide an input interface and an output interface between the terminal 100 and the user. In addition, the touch screen can be implemented using multiple types such as resistive, capacitive, infrared and surface acoustic wave. In addition to the touch screen 131, the input unit 130 can also include other input devices. Specifically, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.

其中,输入设备132可以接收到输入的图像和文本等等。The input device 132 can receive input images, texts, and the like.

该显示单元140可用于显示由用户输入的信息或提供给用户的信息、终端100的各种菜单、交互界面、文件显示和/或任意一种多媒体文件的播放。在本申请实施例中,显示单元140可用于显示图像处理类应用程序的界面、处理结果等。The display unit 140 may be used to display information input by the user or provided to the user, various menus of the terminal 100, interactive interfaces, file display, and/or playback of any multimedia file. In the embodiment of the present application, the display unit 140 may be used to display the interface of an image processing application, processing results, etc.

该存储器120可用于存储指令和数据,存储器120可主要包括存储指令区和存储数据区,存储数据区可存储各种数据,如多媒体文件、文本等;存储指令区可存储操作系统、应用、至少一个功能所需的指令等软件单元,或者他们的子集、扩展集。还可以包括非易失性随机存储器;向处理器170提供包括管理计算处理设备中的硬件、软件以及数据资源,支持控制软件和应用。还用于多媒体文件的存储,以及运行程序和应用的存储。The memory 120 can be used to store instructions and data. The memory 120 can mainly include an instruction storage area and a data storage area. The data storage area can store various data, such as multimedia files, texts, etc.; the instruction storage area can store software units such as operating systems, applications, instructions required for at least one function, or their subsets and extensions. It can also include a non-volatile random access memory; provide the processor 170 with hardware, software and data resources including management of computing and processing equipment, and support control software and applications. It is also used for the storage of multimedia files, and the storage of running programs and applications.

处理器170是终端100的控制中心,利用各种接口和线路连接整个终端100的各个部分,通过运行或执行存储在存储器120内的指令以及调用存储在存储器120内的数据,执行终端100的各种功能和处理数据,从而对终端设备进行整体控制。可选的,处理器170可包括一个或多个处理单元;优选的,处理器170可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器170中。在一些实施例中,处理器、存储器、可以在单一芯片上实现,在一些实施例中,他们也可以在独立的芯片上分别实现。处理器170还可以用于产生相应的操作控制信号,发给计算处理设备相应的部件,读取以及处理软件中的数据,尤其是读取和处理存储器120中的数据和程序,以使其中的各个功能模块执行相应的功能,从而控制相应的部件按指令的要求进行动作。The processor 170 is the control center of the terminal 100. It uses various interfaces and lines to connect various parts of the entire terminal 100. By running or executing instructions stored in the memory 120 and calling data stored in the memory 120, it executes various functions of the terminal 100 and processes data, thereby controlling the terminal device as a whole. Optionally, the processor 170 may include one or more processing units; preferably, the processor 170 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and application program, and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 170. In some embodiments, the processor and the memory may be implemented on a single chip, and in some embodiments, they may also be implemented separately on separate chips. The processor 170 may also be used to generate corresponding operation control signals, send them to corresponding components of the computing and processing device, read and process data in the software, especially read and process data and programs in the memory 120, so that each functional module therein performs corresponding functions, thereby controlling the corresponding components to act according to the requirements of the instructions.

其中,存储器120可以用于存储数据处理方法相关的软件代码,处理器170可以执行芯片的数据处理方法的步骤,也可以调度其他单元(例如上述输入单元130以及显示单元140)以实现相应的功能。Among them, the memory 120 can be used to store software codes related to the data processing method, the processor 170 can execute the steps of the chip data processing method, and can also schedule other units (such as the above-mentioned input unit 130 and display unit 140) to realize corresponding functions.

该射频单元110(可选的)可用于收发信息或通话过程中信号的接收和发送,例如,将基站的下行信息接收后,给处理器170处理;另外,将设计上行的数据发送给基站。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,射频单元110还可以通过无线通信与网络设备和其他设备通信。该无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(Global System of Mobile communication,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE)、电子邮件、短消息服务(Short Messaging Service,SMS)等。The RF unit 110 (optional) can be used for receiving and sending information or receiving and sending signals during a call, for example, after receiving the downlink information of the base station, it is sent to the processor 170 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (Low Noise Amplifier, LNA), a duplexer, etc. In addition, the RF unit 110 can also communicate with network devices and other devices through wireless communication. The wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.

其中,在本申请实施例中,该射频单元110可以将图像发送至服务器200,并接收到服务器200发送的处理结果。In this embodiment of the present application, the RF unit 110 can send the image to the server 200 and receive the processing result sent by the server 200.

应理解,该射频单元110为可选的,其可以被替换为其他通信接口,例如可以是网口。 It should be understood that the radio frequency unit 110 is optional and can be replaced by other communication interfaces, such as a network port.

终端100还包括给各个部件供电的电源190(比如电池),优选的,电源可以通过电源管理系统与处理器170逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The terminal 100 also includes a power supply 190 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 170 through a power management system, so that the power management system can manage functions such as charging, discharging, and power consumption.

终端100还包括外部接口180,该外部接口可以是标准的Micro USB接口,也可以使多针连接器,可以用于连接终端100与其他装置进行通信,也可以用于连接充电器为终端100充电。The terminal 100 also includes an external interface 180, which can be a standard Micro USB interface or a multi-pin connector. It can be used to connect the terminal 100 to communicate with other devices, and can also be used to connect a charger to charge the terminal 100.

尽管未示出,终端100还可以包括闪光灯、无线保真(wireless fidelity,WiFi)模块、蓝牙模块、不同功能的传感器等,在此不再赘述。下文中描述的部分或全部方法均可以应用在如图1D所示的终端100中。Although not shown, the terminal 100 may also include a flashlight, a wireless fidelity (WiFi) module, a Bluetooth module, sensors with different functions, etc., which are not described in detail here. Some or all of the methods described below may be applied to the terminal 100 as shown in FIG. 1D .

接下来描述图1C中服务器200的产品形态;Next, the product form of the server 200 in FIG. 1C is described;

图2提供了一种服务器200的结构示意图,如图2所示,服务器200包括总线201、处理器202、通信接口203和存储器204。处理器202、存储器204和通信接口203之间通过总线201通信。Fig. 2 provides a schematic diagram of the structure of a server 200. As shown in Fig. 2, the server 200 includes a bus 201, a processor 202, a communication interface 203 and a memory 204. The processor 202, the memory 204 and the communication interface 203 communicate with each other via the bus 201.

总线201可以是外设部件互连标准(peripheral component interconnect,PCI)总线或扩展工业标准结构(extended industry standard architecture,EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,图2中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The bus 201 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, FIG2 only uses a thick line, but does not mean that there is only one bus or one type of bus.

处理器202可以为中央处理器(central processing unit,CPU)、图形处理器(graphics processing unit,GPU)、微处理器(micro processor,MP)或者数字信号处理器(digital signal processor,DSP)等处理器中的任意一种或多种。The processor 202 may be any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

存储器204可以包括易失性存储器(volatile memory),例如随机存取存储器(random access memory,RAM)。存储器204还可以包括非易失性存储器(non-volatile memory),例如只读存储器(read-only memory,ROM),快闪存储器,机械硬盘(hard drive drive,HDD)或固态硬盘(solid state drive,SSD)。The memory 204 may include a volatile memory (volatile memory), such as a random access memory (RAM). The memory 204 may also include a non-volatile memory (non-volatile memory), such as a read-only memory (ROM), a flash memory, a hard drive (HDD), or a solid state drive (SSD).

其中,存储器204可以用于存储数据处理方法相关的软件代码,处理器202可以执行芯片的数据处理方法的步骤,也可以调度其他单元以实现相应的功能。The memory 204 may be used to store software codes related to the data processing method, and the processor 202 may execute the steps of the data processing method of the chip, and may also schedule other units to implement corresponding functions.

应理解,上述终端100和服务器200可以为集中式或者是分布式的设备,上述终端100和服务器200中的处理器(例如处理器170以及处理器202)可以为硬件电路(如专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)、通用处理器、数字信号处理器(digital signal processing,DSP)、微处理器或微控制器等等)、或这些硬件电路的组合,例如,处理器可以为具有执行指令功能的硬件系统,如CPU、DSP等,或者为不具有执行指令功能的硬件系统,如ASIC、FPGA等,或者为上述不具有执行指令功能的硬件系统以及具有执行指令功能的硬件系统的组合。It should be understood that the above-mentioned terminal 100 and server 200 can be centralized or distributed devices, and the processors in the above-mentioned terminal 100 and server 200 (such as processor 170 and processor 202) can be hardware circuits (such as application specific integrated circuit (ASIC), field-programmable gate array (FPGA), general-purpose processor, digital signal processor (DSP), microprocessor or microcontroller, etc.), or a combination of these hardware circuits. For example, the processor can be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.

应理解,本申请实施例中的和模型推理过程相关的步骤涉及AI相关的运算,在执行AI运算时,终端设备和服务器的指令执行架构不仅仅局限在上述介绍的处理器结合存储器的架构。下面结合图3对本申请实施例提供的系统架构进行详细的介绍。It should be understood that the steps related to the model reasoning process in the embodiments of the present application involve AI-related operations. When performing AI operations, the instruction execution architecture of the terminal device and the server is not limited to the processor combined with the memory architecture described above. The system architecture provided in the embodiments of the present application is described in detail below in conjunction with Figure 3.

图3为本申请实施例提供的系统架构示意图。如图3所示,系统架构500包括执行设备510、训练设备520、数据库530、客户设备540、数据存储系统550以及数据采集系统560。FIG3 is a schematic diagram of a system architecture provided by an embodiment of the present application. As shown in FIG3 , a system architecture 500 includes an execution device 510 , a training device 520 , a database 530 , a client device 540 , a data storage system 550 , and a data acquisition system 560 .

执行设备510包括计算模块511、I/O接口512、预处理模块513和预处理模块514。计算模块511中可以包括目标模型/规则501,预处理模块513和预处理模块514是可选的。The execution device 510 includes a calculation module 511, an I/O interface 512, a preprocessing module 513 and a preprocessing module 514. The calculation module 511 may include a target model/rule 501, and the preprocessing module 513 and the preprocessing module 514 are optional.

其中,执行设备510可以为上述运行图像处理类应用程序的终端设备或者服务器。The execution device 510 may be a terminal device or a server that runs the above-mentioned image processing application.

数据采集设备560用于采集训练样本。训练样本可以为图像和文本等。在采集到训练样本之后,数据采集设备560将这些训练样本存入数据库530。The data acquisition device 560 is used to collect training samples. The training samples may be images and texts, etc. After collecting the training samples, the data acquisition device 560 stores the training samples in the database 530.

训练设备520可以基于数据库530中维护训练样本,对待训练的神经网络,以得到目标模型/规则501。The training device 520 can train the neural network based on the training samples maintained in the database 530 to obtain the target model/rule 501.

应理解,训练设备520可以基于数据库530中维护训练样本,对待训练的神经网络进行预训练过程,或者是在预训练的基础上进行模型的微调。It should be understood that the training device 520 can perform a pre-training process on the neural network to be trained based on the training samples maintained in the database 530, or fine-tune the model based on the pre-training.

需要说明的是,在实际应用中,数据库530中维护的训练样本不一定都来自于数据采集设备560的采集,也有可能是从其他设备接收得到的。另外需要说明的是,训练设备520也不一定完全基于数据库530维护的训练样本进行目标模型/规则501的训练,也有可能从云端或其他地方获取训练样本进行模型训练,上述描述不应该作为对本申请实施例的限定。 It should be noted that, in actual applications, the training samples maintained in the database 530 may not all come from the data acquisition device 560, but may also be received from other devices. It should also be noted that the training device 520 may not train the target model/rule 501 entirely based on the training samples maintained in the database 530, but may also obtain training samples from the cloud or other places for model training. The above description should not be used as a limitation on the embodiments of the present application.

根据训练设备520训练得到的目标模型/规则501可以应用于不同的系统或设备中,如应用于图3所示的执行设备510,该执行设备510可以是终端,如手机终端,平板电脑,笔记本电脑,增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备,车载终端等,还可以是服务器等。The target model/rule 501 trained by the training device 520 can be applied to different systems or devices, such as the execution device 510 shown in FIG3 . The execution device 510 can be a terminal, such as a mobile phone terminal, a tablet computer, a laptop computer, an augmented reality (AR)/virtual reality (VR) device, a vehicle-mounted terminal, etc., and can also be a server, etc.

具体的,训练设备520可以将训练后的模型传递至执行设备510。Specifically, the training device 520 may transfer the trained model to the execution device 510 .

在图3中,执行设备510配置输入/输出(input/output,I/O)接口512,用于与外部设备进行数据交互,用户可以通过客户设备540向I/O接口512输入数据(例如本申请实施例中的图像和文本等)。In Figure 3, the execution device 510 is configured with an input/output (I/O) interface 512 for data interaction with an external device. The user can input data (such as images and text in the embodiment of the present application) into the I/O interface 512 through the client device 540.

预处理模块513和预处理模块514用于根据I/O接口512接收到的输入数据进行预处理。应理解,可以没有预处理模块513和预处理模块514或者只有的一个预处理模块。当不存在预处理模块513和预处理模块514时,可以直接采用计算模块511对输入数据进行处理。The preprocessing module 513 and the preprocessing module 514 are used to preprocess the input data received by the I/O interface 512. It should be understood that there may be no preprocessing module 513 and the preprocessing module 514 or only one preprocessing module. When there is no preprocessing module 513 and the preprocessing module 514, the computing module 511 may be directly used to process the input data.

在执行设备510对输入数据进行预处理,或者在执行设备510的计算模块511执行计算等相关的处理过程中,执行设备510可以调用数据存储系统550中的数据、代码等以用于相应的处理,也可以将相应处理得到的数据、指令等存入数据存储系统550中。When the execution device 510 preprocesses the input data, or when the computing module 511 of the execution device 510 performs calculations and other related processing, the execution device 510 can call the data, code, etc. in the data storage system 550 for corresponding processing, and can also store the data, instructions, etc. obtained from the corresponding processing into the data storage system 550.

最后,I/O接口512将处理结果提供给客户设备540,从而提供给用户。Finally, the I/O interface 512 provides the processing results to the client device 540 and thus to the user.

在图3所示情况下,用户可以手动给定输入数据,该“手动给定输入数据”可以通过I/O接口512提供的界面进行操作。另一种情况下,客户设备540可以自动地向I/O接口512发送输入数据,如果要求客户设备540自动发送输入数据需要获得用户的授权,则用户可以在客户设备540中设置相应权限。用户可以在客户设备540查看执行设备510输出的结果,具体的呈现形式可以是显示、声音、动作等具体方式。客户设备540也可以作为数据采集端,采集如图所示输入I/O接口512的输入数据及输出I/O接口512的输出结果作为新的样本数据,并存入数据库530。当然,也可以不经过客户设备540进行采集,而是由I/O接口512直接将如图所示输入I/O接口512的输入数据及输出I/O接口512的输出结果,作为新的样本数据存入数据库530。In the case shown in FIG. 3 , the user can manually give input data, and the “manually given input data” can be operated through the interface provided by the I/O interface 512. In another case, the client device 540 can automatically send input data to the I/O interface 512. If the client device 540 is required to automatically send input data and needs to obtain the user's authorization, the user can set the corresponding authority in the client device 540. The user can view the results output by the execution device 510 on the client device 540, and the specific presentation form can be a specific method such as display, sound, action, etc. The client device 540 can also be used as a data acquisition terminal to collect the input data of the input I/O interface 512 and the output results of the output I/O interface 512 as shown in the figure as new sample data, and store them in the database 530. Of course, it is also possible not to collect through the client device 540, but the I/O interface 512 directly stores the input data of the input I/O interface 512 and the output results of the output I/O interface 512 as new sample data in the database 530.

值得注意的是,图3仅是本申请实施例提供的一种系统架构的示意图,图中所示设备、器件、模块等之间的位置关系不构成任何限制,例如,在图3中,数据存储系统550相对执行设备510是外部存储器,在其它情况下,也可以将数据存储系统550置于执行设备510中。应理解,上述执行设备510可以部署于客户设备540中。It is worth noting that FIG. 3 is only a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in FIG. 3, the data storage system 550 is an external memory relative to the execution device 510. In other cases, the data storage system 550 can also be placed in the execution device 510. It should be understood that the above-mentioned execution device 510 can be deployed in the client device 540.

从模型的推理侧来说:From the inference side of the model:

本申请实施例中,上述执行设备520的计算模块511可以获取到数据存储系统550中存储的代码来实现本申请实施例中的和模型推理过程相关的步骤。In the embodiment of the present application, the computing module 511 of the above-mentioned execution device 520 can obtain the code stored in the data storage system 550 to implement the steps related to the model reasoning process in the embodiment of the present application.

本申请实施例中,执行设备520的计算模块511可以包括硬件电路(如专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)、通用处理器、数字信号处理器(digital signal processing,DSP)、微处理器或微控制器等等)、或这些硬件电路的组合,例如,训练设备520可以为具有执行指令功能的硬件系统,如CPU、DSP等,或者为不具有执行指令功能的硬件系统,如ASIC、FPGA等,或者为上述不具有执行指令功能的硬件系统以及具有执行指令功能的硬件系统的组合。In the embodiment of the present application, the computing module 511 of the execution device 520 may include a hardware circuit (such as an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, etc.), or a combination of these hardware circuits. For example, the training device 520 can be a hardware system with an execution instruction function, such as a CPU, a DSP, etc., or a hardware system without an execution instruction function, such as an ASIC, an FPGA, etc., or a combination of the above-mentioned hardware systems without an execution instruction function and hardware systems with an execution instruction function.

具体的,执行设备520的计算模块511可以为具有执行指令功能的硬件系统,本申请实施例提供的和模型推理过程相关的步骤可以为存储在存储器中的软件代码,执行设备520的计算模块511可以从存储器中获取到软件代码,并执行获取到的软件代码来实现本申请实施例提供的和模型推理过程相关的步骤。Specifically, the computing module 511 of the execution device 520 can be a hardware system with an execution instruction function, and the steps related to the model reasoning process provided in the embodiment of the present application can be software codes stored in the memory. The computing module 511 of the execution device 520 can obtain the software code from the memory and execute the obtained software code to implement the steps related to the model reasoning process provided in the embodiment of the present application.

应理解,执行设备520的计算模块511可以为不具有执行指令功能的硬件系统以及具有执行指令功能的硬件系统的组合,本申请实施例提供的和模型推理过程相关的步骤的部分步骤还可以通过执行设备520的计算模块511中不具有执行指令功能的硬件系统来实现,这里并不限定。It should be understood that the computing module 511 of the execution device 520 can be a combination of a hardware system that does not have the function of executing instructions and a hardware system that has the function of executing instructions. Some of the steps related to the model reasoning process provided in the embodiments of the present application can also be implemented by the hardware system that does not have the function of executing instructions in the computing module 511 of the execution device 520, which is not limited here.

从模型的训练侧来说:From the training side of the model:

本申请实施例中,上述训练设备520可以获取到存储器(图3中未示出,可以集成于训练设备520或者与训练设备520分离部署)中存储的代码来实现本申请实施例中和模型训练相关的步骤。In an embodiment of the present application, the above-mentioned training device 520 can obtain the code stored in the memory (not shown in Figure 3, which can be integrated into the training device 520 or deployed separately from the training device 520) to implement the steps related to model training in an embodiment of the present application.

本申请实施例中,训练设备520可以包括硬件电路(如专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)、通用处理器、数字信号处 理器(digital signal processing,DSP)、微处理器或微控制器等等)、或这些硬件电路的组合,例如,训练设备520可以为具有执行指令功能的硬件系统,如CPU、DSP等,或者为不具有执行指令功能的硬件系统,如ASIC、FPGA等,或者为上述不具有执行指令功能的硬件系统以及具有执行指令功能的硬件系统的组合。In the embodiment of the present application, the training device 520 may include a hardware circuit (such as an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a general processor, a digital signal processor, or a processor. For example, the training device 520 may be a hardware system with the function of executing instructions, such as a CPU, DSP, etc., or a hardware system without the function of executing instructions, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without the function of executing instructions and hardware systems with the function of executing instructions.

应理解,训练设备520可以为不具有执行指令功能的硬件系统以及具有执行指令功能的硬件系统的组合,本申请实施例提供的中和模型训练相关的部分步骤还可以通过训练设备520中不具有执行指令功能的硬件系统来实现,这里并不限定。It should be understood that the training device 520 can be a combination of a hardware system that does not have the function of executing instructions and a hardware system that has the function of executing instructions. Some of the steps related to model training provided in the embodiments of the present application can also be implemented by the hardware system that does not have the function of executing instructions in the training device 520, which is not limited here.

二、服务器提供的图像处理类云服务:2. Image processing cloud services provided by the server:

在一种可能的实现中,服务器可以通过应用程序编程接口(application programming interface,API)为端侧提供图像处理的服务。In one possible implementation, the server can provide image processing services to the end side through an application programming interface (API).

其中,终端设备可以通过云端提供的API,将相关参数(例如图像和文本)发送至服务器,服务器可以基于接收到的参数,得到处理结果等),并将处理结果返回至至终端。Among them, the terminal device can send relevant parameters (such as images and texts) to the server through the API provided by the cloud. The server can obtain processing results based on the received parameters, etc., and return the processing results to the terminal.

关于终端以及服务器的描述可以上述实施例的描述,这里不再赘述。The description of the terminal and the server can be the same as that of the above embodiments, and will not be repeated here.

如图4示出了使用一项云平台提供的图像处理类云服务的流程。FIG. 4 shows a process of using an image processing cloud service provided by a cloud platform.

1.开通并购买内容审核服务。1. Activate and purchase content review service.

2.用户可以下载内容审核服务对应的软件开发工具包(software development kit,SDK),通常云平台提供多个开发版本的SDK,供用户根据开发环境的需求选择,例如JAVA版本的SDK、python版本的SDK、PHP版本的SDK、Android版本的SDK等。2. Users can download the software development kit (SDK) corresponding to the content review service. Usually, the cloud platform provides multiple development versions of the SDK for users to choose according to the requirements of the development environment, such as JAVA version SDK, Python version SDK, PHP version SDK, Android version SDK, etc.

3.用户根据需求下载对应版本的SDK到本地后,将SDK工程导入至本地开发环境,在本地开发环境中进行配置和调试,本地开发环境还可以进行其他功能的开发,使得形成一个集合了图像处理类能力的应用。3. After the user downloads the corresponding version of the SDK to the local computer according to the needs, the SDK project is imported into the local development environment, and configuration and debugging are performed in the local development environment. The local development environment can also be used to develop other functions, thus forming an application that integrates image processing capabilities.

4.图像处理类应用在被使用的过程中,当需要进行图像处理时,可以触发图像处理的API调用。当应用触发图像处理功能时,发起API请求至云环境中的图像处理类服务的运行实例,其中,API请求中携带图像,由云环境中的运行实例对图像进行处理,获得处理结果。4. When image processing applications are used, they can trigger an API call for image processing when image processing is required. When the application triggers the image processing function, it initiates an API request to the running instance of the image processing service in the cloud environment. The API request carries the image, and the running instance in the cloud environment processes the image to obtain the processing result.

5.云环境将处理结果返回至应用,由此完成一次的本申请实施例提供的方法调用。5. The cloud environment returns the processing results to the application, thereby completing a method call provided in an embodiment of the present application.

由于本申请实施例涉及大量神经网络的应用,为了便于理解,下面先对本申请实施例涉及的相关术语及神经网络等相关概念进行介绍。Since the embodiments of the present application involve the application of a large number of neural networks, in order to facilitate understanding, the relevant terms and related concepts such as neural networks involved in the embodiments of the present application are first introduced below.

(1)神经网络(1) Neural Network

神经网络可以是由神经单元组成的,神经单元可以是指以xs(即输入数据)和截距1为输入的运算单元,该运算单元的输出可以为:
A neural network may be composed of neural units, and a neural unit may refer to an operation unit that takes xs (i.e., input data) and intercept 1 as input, and the output of the operation unit may be:

其中,s=1、2、……n,n为大于1的自然数,Ws为xs的权重,b为神经单元的偏置。f为神经单元的激活函数(activation functions),用于将非线性特性引入神经网络中,来将神经单元中的输入信号转换为输出信号。该激活函数的输出信号可以作为下一层卷积层的输入,激活函数可以是sigmoid函数。神经网络是将多个上述单一的神经单元联结在一起形成的网络,即一个神经单元的输出可以是另一个神经单元的输入。每个神经单元的输入可以与前一层的局部接受域相连,来提取局部接受域的特征,局部接受域可以是由若干个神经单元组成的区域。Where s=1, 2, ...n, n is a natural number greater than 1, Ws is the weight of xs, and b is the bias of the neural unit. f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into the output signal. The output signal of the activation function can be used as the input of the next convolutional layer, and the activation function can be a sigmoid function. A neural network is a network formed by connecting multiple single neural units mentioned above, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the characteristics of the local receptive field. The local receptive field can be an area composed of several neural units.

(2)卷积神经网络(convolutional neuron network,CNN)是一种带有卷积结构的深度神经网络。卷积神经网络包含了一个由卷积层和子采样层构成的特征抽取器,该特征抽取器可以看作是滤波器。卷积层是指卷积神经网络中对输入信号进行卷积处理的神经元层。在卷积神经网络的卷积层中,一个神经元可以只与部分邻层神经元连接。一个卷积层中,通常包含若干个特征平面,每个特征平面可以由一些矩形排列的神经单元组成。同一特征平面的神经单元共享权重,这里共享的权重就是卷积核。共享权重 可以理解为提取特征的方式与位置无关。卷积核可以以随机大小的矩阵的形式化,在卷积神经网络的训练过程中卷积核可以通过学习得到合理的权重。另外,共享权重带来的直接好处是减少卷积神经网络各层之间的连接,同时又降低了过拟合的风险。(2) Convolutional neural network (CNN) is a deep neural network with a convolutional structure. Convolutional neural network contains a feature extractor consisting of a convolution layer and a subsampling layer, which can be regarded as a filter. The convolution layer refers to the neuron layer in the convolutional neural network that performs convolution processing on the input signal. In the convolution layer of the convolutional neural network, a neuron can only be connected to some neurons in the adjacent layers. A convolutional layer usually contains several feature planes, and each feature plane can be composed of some neural units arranged in a rectangular shape. The neural units in the same feature plane share weights, and the shared weights here are the convolution kernels. Shared weights It can be understood that the way to extract features is independent of position. The convolution kernel can be formalized as a matrix of random size, and the convolution kernel can obtain reasonable weights through learning during the training process of the convolutional neural network. In addition, the direct benefit of shared weights is to reduce the connections between the layers of the convolutional neural network, while reducing the risk of overfitting.

CNN是一种非常常见的神经网络,下面结合图5A重点对CNN的结构进行详细的介绍。如前文的基础概念介绍所述,卷积神经网络是一种带有卷积结构的深度神经网络,是一种深度学习(deep learning)架构,深度学习架构是指通过机器学习的算法,在不同的抽象层级上进行多个层次的学习。作为一种深度学习架构,CNN是一种前馈(feed-forward)人工神经网络,该前馈人工神经网络中的各个神经元可以对输入其中的图像作出响应。CNN is a very common neural network. The following is a detailed introduction to the structure of CNN in conjunction with Figure 5A. As mentioned in the previous basic concept introduction, convolutional neural network is a deep neural network with a convolution structure and a deep learning architecture. Deep learning architecture refers to multiple levels of learning at different abstract levels through machine learning algorithms. As a deep learning architecture, CNN is a feed-forward artificial neural network in which each neuron can respond to the image input into it.

如图5A所示,卷积神经网络(CNN)200可以包括输入层210,卷积层/池化层220(其中池化层为可选的),以及全连接层(fully connected layer)230。As shown in Figure 5A, the convolutional neural network (CNN) 200 may include an input layer 210, a convolutional layer/pooling layer 220 (wherein the pooling layer is optional), and a fully connected layer (fully connected layer) 230.

卷积层/池化层220:Convolutional layer/pooling layer 220:

卷积层:Convolutional Layer:

如图5A所示卷积层/池化层220可以包括如示例221-226层,举例来说:在一种实现中,221层为卷积层,222层为池化层,223层为卷积层,224层为池化层,225为卷积层,226为池化层;在另一种实现方式中,221、222为卷积层,223为池化层,224、225为卷积层,226为池化层。即卷积层的输出可以作为随后的池化层的输入,也可以作为另一个卷积层的输入以继续进行卷积操作。As shown in FIG5A , the convolution layer/pooling layer 220 may include layers 221-226, for example: in one implementation, layer 221 is a convolution layer, layer 222 is a pooling layer, layer 223 is a convolution layer, layer 224 is a pooling layer, layer 225 is a convolution layer, and layer 226 is a pooling layer; in another implementation, layers 221 and 222 are convolution layers, layer 223 is a pooling layer, layers 224 and 225 are convolution layers, and layer 226 is a pooling layer. That is, the output of a convolution layer can be used as the input of a subsequent pooling layer, or as the input of another convolution layer to continue the convolution operation.

下面将以卷积层221为例,介绍一层卷积层的内部工作原理。The following will take the convolution layer 221 as an example to introduce the internal working principle of a convolution layer.

卷积层221可以包括很多个卷积算子,卷积算子也称为核,其在图像处理中的作用相当于一个从输入图像矩阵中提取特定信息的过滤器,卷积算子本质上可以是一个权重矩阵,这个权重矩阵通常被预先定义,在对图像进行卷积操作的过程中,权重矩阵通常在输入图像上沿着水平方向一个像素接着一个像素(或两个像素接着两个像素……这取决于步长stride的取值)的进行处理,从而完成从图像中提取特定特征的工作。该权重矩阵的大小应该与图像的大小相关,需要注意的是,权重矩阵的纵深维度(depth dimension)和输入图像的纵深维度是相同的,在进行卷积运算的过程中,权重矩阵会延伸到输入图像的整个深度。因此,和一个单一的权重矩阵进行卷积会产生一个单一纵深维度的卷积化输出,但是大多数情况下不使用单一权重矩阵,而是应用多个尺寸(行×列)相同的权重矩阵,即多个同型矩阵。每个权重矩阵的输出被堆叠起来形成卷积图像的纵深维度,这里的维度可以理解为由上面所述的“多个”来决定。不同的权重矩阵可以用来提取图像中不同的特征,例如一个权重矩阵用来提取图像边缘信息,另一个权重矩阵用来提取图像的特定颜色,又一个权重矩阵用来对图像中不需要的噪点进行模糊化等。该多个权重矩阵尺寸(行×列)相同,经过该多个尺寸相同的权重矩阵提取后的特征图的尺寸也相同,再将提取到的多个尺寸相同的特征图合并形成卷积运算的输出。The convolution layer 221 may include a plurality of convolution operators, which are also called kernels. The convolution operator is equivalent to a filter that extracts specific information from the input image matrix in image processing. The convolution operator may be essentially a weight matrix, which is usually predefined. In the process of performing convolution operations on the image, the weight matrix is usually processed one pixel after another (or two pixels after two pixels... depending on the value of the stride) in the horizontal direction on the input image, thereby completing the work of extracting specific features from the image. The size of the weight matrix should be related to the size of the image. It should be noted that the depth dimension of the weight matrix is the same as the depth dimension of the input image. In the process of performing convolution operations, the weight matrix extends to the entire depth of the input image. Therefore, convolution with a single weight matrix will produce a convolution output with a single depth dimension, but in most cases, a single weight matrix is not used, but multiple weight matrices of the same size (row × column), that is, multiple isotype matrices, are applied. The output of each weight matrix is stacked to form the depth dimension of the convolved image, and the dimension here can be understood as being determined by the "multiple" mentioned above. Different weight matrices can be used to extract different features in the image, for example, one weight matrix is used to extract image edge information, another weight matrix is used to extract specific colors of the image, and another weight matrix is used to blur unwanted noise in the image, etc. The multiple weight matrices have the same size (rows × columns), and the feature maps extracted by the multiple weight matrices of the same size are also the same size. The extracted feature maps of the same size are then merged to form the output of the convolution operation.

这些权重矩阵中的权重值在实际应用中需要经过大量的训练得到,通过训练得到的权重值形成的各个权重矩阵可以用来从输入图像中提取信息,从而使得卷积神经网络200进行正确的预测。The weight values in these weight matrices need to be obtained through a lot of training in practical applications. The weight matrices formed by the weight values obtained through training can be used to extract information from the input image, so that the convolutional neural network 200 can make correct predictions.

当卷积神经网络200有多个卷积层的时候,初始的卷积层(例如221)往往提取较多的一般特征,该一般特征也可以称之为低级别的特征;随着卷积神经网络200深度的加深,越往后的卷积层(例如226)提取到的特征越来越复杂,比如高级别的语义之类的特征,语义越高的特征越适用于待解决的问题。When the convolutional neural network 200 has multiple convolutional layers, the initial convolutional layer (for example, 221) often extracts more general features, which can also be called low-level features. As the depth of the convolutional neural network 200 increases, the features extracted by the later convolutional layers (for example, 226) become more and more complex, such as high-level semantic features. Features with higher semantics are more suitable for the problem to be solved.

池化层:Pooling layer:

由于常常需要减少训练参数的数量,因此卷积层之后常常需要周期性的引入池化层,在如图5A中220所示例的221-226各层,可以是一层卷积层后面跟一层池化层,也可以是多层卷积层后面接一层或多层池化层。在图像处理过程中,池化层的唯一目的就是减少图像的空间大小。池化层可以包括平均池化算子和/或最大池化算子,以用于对输入图像进行采样得到较小尺寸的图像。平均池化算子可以在特定范围内对图像中的像素值进行计算产生平均值作为平均池化的结果。最大池化算子可以在特定范围内取该范围内值最大的像素作为最大池化的结果。另外,就像卷积层中用权重矩阵的大小应该与图像尺寸相关一样,池化层中的运算符也应该与图像的大小相关。通过池化层处理后输出的图像尺寸可以小于输入池化层的图像的尺寸,池化层输出的图像中每个像素点表示输入池化层的图像的对应子区域的平均值或最大值。Since it is often necessary to reduce the number of training parameters, it is often necessary to periodically introduce a pooling layer after the convolution layer. In the layers 221-226 shown in 220 in FIG. 5A, a convolution layer may be followed by a pooling layer, or multiple convolution layers may be followed by one or more pooling layers. In the image processing process, the only purpose of the pooling layer is to reduce the spatial size of the image. The pooling layer may include an average pooling operator and/or a maximum pooling operator to sample the input image to obtain an image of smaller size. The average pooling operator may calculate the pixel values in the image within a specific range to generate an average value as the result of average pooling. The maximum pooling operator may take the pixel with the largest value in the range within a specific range as the result of maximum pooling. In addition, just as the size of the weight matrix used in the convolution layer should be related to the image size, the operator in the pooling layer should also be related to the image size. The size of the image output after processing by the pooling layer may be smaller than the size of the image input to the pooling layer, and each pixel in the image output by the pooling layer represents the average value or maximum value of the corresponding sub-region of the image input to the pooling layer.

全连接层230: Fully connected layer 230:

在经过卷积层/池化层220的处理后,卷积神经网络200还不足以输出所需要的输出信息。因为如前所述,卷积层/池化层220只会提取特征,并减少输入图像带来的参数。然而为了生成最终的输出信息(所需要的类信息或其他相关信息),卷积神经网络200需要利用全连接层230来生成一个或者一组所需要的类的数量的输出。因此,在全连接层230中可以包括多层隐含层(如图5A所示的231、232至23n),该多层隐含层中所包含的参数可以根据具体的任务类型的相关训练数据进行预先训练得到,例如该任务类型可以包括图像识别,图像分类,图像超分辨率重建等等……After being processed by the convolution layer/pooling layer 220, the convolution neural network 200 is not sufficient to output the required output information. Because as mentioned above, the convolution layer/pooling layer 220 will only extract features and reduce the parameters brought by the input image. However, in order to generate the final output information (the required class information or other related information), the convolution neural network 200 needs to use the fully connected layer 230 to generate one or a group of outputs of the required number of classes. Therefore, the fully connected layer 230 may include multiple hidden layers (231, 232 to 23n as shown in Figure 5A), and the parameters contained in the multiple hidden layers can be pre-trained according to the relevant training data of the specific task type. For example, the task type may include image recognition, image classification, image super-resolution reconstruction, etc.

在全连接层230中的多层隐含层之后,也就是整个卷积神经网络200的最后层为输出层240,该输出层240具有类似分类交叉熵的损失函数,具体用于计算预测误差,一旦整个卷积神经网络200的前向传播(如图5A由210至240方向的传播为前向传播)完成,反向传播(如图5A由240至210方向的传播为反向传播)就会开始更新前面提到的各层的权重值以及偏差,以减少卷积神经网络200的损失,及卷积神经网络200通过输出层输出的结果和理想结果之间的误差。After the multiple hidden layers in the fully connected layer 230, that is, the last layer of the entire convolutional neural network 200 is the output layer 240, which has a loss function similar to the classification cross entropy, and is specifically used to calculate the prediction error. Once the forward propagation of the entire convolutional neural network 200 (such as the propagation from 210 to 240 in Figure 5A is forward propagation) is completed, the back propagation (such as the propagation from 240 to 210 in Figure 5A is back propagation) will begin to update the weight values and biases of the aforementioned layers to reduce the loss of the convolutional neural network 200 and the error between the result output by the convolutional neural network 200 through the output layer and the ideal result.

需要说明的是,如图5A所示的卷积神经网络200仅作为一种卷积神经网络的示例,在具体的应用中,卷积神经网络还可以以其他网络模型的形式存在,例如,仅包括图5A中所示的网络结构的一部分,比如,本申请实施例中所采用的卷积神经网络可以仅包括输入层210、卷积层/池化层220和输出层240。It should be noted that the convolutional neural network 200 shown in FIG. 5A is only an example of a convolutional neural network. In specific applications, the convolutional neural network may also exist in the form of other network models, for example, including only a part of the network structure shown in FIG. 5A. For example, the convolutional neural network used in the embodiment of the present application may only include an input layer 210, a convolutional layer/pooling layer 220 and an output layer 240.

需要说明的是,如图5A所示的卷积神经网络100仅作为一种卷积神经网络的示例,在具体的应用中,卷积神经网络还可以以其他网络模型的形式存在,例如,如图5B所示的多个卷积层/池化层并行,将分别提取的特征均输入给全连接层230进行处理。It should be noted that the convolutional neural network 100 shown in FIG. 5A is only an example of a convolutional neural network. In specific applications, the convolutional neural network can also exist in the form of other network models. For example, as shown in FIG. 5B , multiple convolutional layers/pooling layers are used in parallel, and the features extracted respectively are input to the fully connected layer 230 for processing.

(3)深度神经网络(3) Deep Neural Networks

深度神经网络(Deep Neural Network,DNN),也称多层神经网络,可以理解为具有很多层隐含层的神经网络,这里的“很多”并没有特别的度量标准。从DNN按不同层的位置划分,DNN内部的神经网络可以分为三类:输入层,隐含层,输出层。一般来说第一层是输入层,最后一层是输出层,中间的层数都是隐含层。层与层之间是全连接的,也就是说,第i层的任意一个神经元一定与第i+1层的任意一个神经元相连。虽然DNN看起来很复杂,但是就每一层的工作来说,其实并不复杂,简单来说就是如下线性关系表达式:其中,是输入向量,是输出向量,是偏移向量,W是权重矩阵(也称系数),α()是激活函数。每一层仅仅是对输入向量经过如此简单的操作得到输出向量由于DNN层数多,则系数W和偏移向量的数量也就很多了。这些参数在DNN中的定义如下所述:以系数W为例:假设在一个三层的DNN中,第二层的第4个神经元到第三层的第2个神经元的线性系数定义为上标3代表系数W所在的层数,而下标对应的是输出的第三层索引2和输入的第二层索引4。Deep Neural Network (DNN), also known as multi-layer neural network, can be understood as a neural network with many hidden layers. There is no special metric for "many" here. From the position of different layers of DNN, the neural network inside DNN can be divided into three categories: input layer, hidden layer, and output layer. Generally speaking, the first layer is the input layer, the last layer is the output layer, and the layers in between are all hidden layers. The layers are fully connected, that is, any neuron in the i-th layer must be connected to any neuron in the i+1-th layer. Although DNN looks complicated, the work of each layer is actually not complicated. Simply put, it is the following linear relationship expression: in, is the input vector, is the output vector, is the offset vector, W is the weight matrix (also called coefficient), and α() is the activation function. Each layer is just an input vector After such a simple operation, the output vector Since DNN has many layers, the coefficient W and the offset vector The definition of these parameters in DNN is as follows: Take the coefficient W as an example: Assume that in a three-layer DNN, the linear coefficient from the 4th neuron in the second layer to the 2nd neuron in the third layer is defined as The superscript 3 represents the layer number of coefficient W, while the subscripts correspond to the third layer index 2 of the output and the second layer index 4 of the input.

总结就是:第L-1层的第k个神经元到第L层的第j个神经元的系数定义为 In summary, the coefficients from the kth neuron in the L-1th layer to the jth neuron in the Lth layer are defined as

需要注意的是,输入层是没有W参数的。在深度神经网络中,更多的隐含层让网络更能够刻画现实世界中的复杂情形。理论上而言,参数越多的模型复杂度越高,“容量”也就越大,也就意味着它能完成更复杂的学习任务。训练深度神经网络的也就是学习权重矩阵的过程,其最终目的是得到训练好的深度神经网络的所有层的权重矩阵(由很多层的向量W形成的权重矩阵)。It should be noted that the input layer does not have a W parameter. In a deep neural network, more hidden layers allow the network to better describe complex situations in the real world. Theoretically, the more parameters a model has, the higher its complexity and the greater its "capacity", which means it can complete more complex learning tasks. Training a deep neural network is the process of learning the weight matrix, and its ultimate goal is to obtain the weight matrix of all layers of the trained deep neural network (a weight matrix formed by many layers of vectors W).

(4)损失函数(4) Loss Function

在训练深度神经网络的过程中,因为希望深度神经网络的输出尽可能的接近真正想要预测的值,所以可以通过比较当前网络的预测值和真正想要的目标值,再根据两者之间的差异情况来更新每一层神经网络的权重向量(当然,在第一次更新之前通常会有初始化的过程,即为深度神经网络中的各层预先配置参数),比如,如果网络的预测值高了,就调整权重向量让它预测低一些,不断的调整,直到深度神经网络能够预测出真正想要的目标值或与真正想要的目标值非常接近的值。因此,就需要预先定义“如何比较预测值和目标值之间的差异”,这便是损失函数(loss function)或目标函数(objective function),它们是用于衡量预测值和目标值的差异的重要方程。其中,以损失函数举例,损失函数的输出值(loss)越高表示差异越大,那么深度神经网络的训练就变成了尽可能缩小这个loss的过程。In the process of training a deep neural network, because we hope that the output of the deep neural network is as close as possible to the value we really want to predict, we can compare the predicted value of the current network with the target value we really want, and then update the weight vector of each layer of the neural network according to the difference between the two (of course, there is usually an initialization process before the first update, that is, pre-configuring parameters for each layer in the deep neural network). For example, if the predicted value of the network is high, adjust the weight vector to make it predict a lower value, and keep adjusting until the deep neural network can predict the target value we really want or a value very close to the target value we really want. Therefore, it is necessary to pre-define "how to compare the difference between the predicted value and the target value", which is the loss function or objective function, which are important equations used to measure the difference between the predicted value and the target value. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, so the training of the deep neural network becomes a process of minimizing this loss as much as possible.

(5)反向传播算法(5) Back propagation algorithm

卷积神经网络可以采用误差反向传播(back propagation,BP)算法在训练过程中修正初始的超分辨率模型中参数的大小,使得超分辨率模型的重建误差损失越来越小。具体地,前向传递输入信号直至输 出会产生误差损失,通过反向传播误差损失信息来更新初始的超分辨率模型中参数,从而使误差损失收敛。反向传播算法是以误差损失为主导的反向传播运动,旨在得到最优的超分辨率模型的参数,例如权重矩阵。Convolutional neural networks can use the back propagation (BP) algorithm to correct the size of the parameters in the initial super-resolution model during the training process, so that the reconstruction error loss of the super-resolution model becomes smaller and smaller. Error loss will be generated, and the parameters in the initial super-resolution model are updated by back-propagating the error loss information, so that the error loss converges. The back-propagation algorithm is a back-propagation movement dominated by error loss, aiming to obtain the optimal parameters of the super-resolution model, such as the weight matrix.

(6)注意力机制(attention mechanism)(6) Attention mechanism

注意力机制模仿了生物观察行为的内部过程,即一种将内部经验和外部感觉对齐从而增加部分区域的观察精细度的机制,能够利用有限的注意力资源从大量信息中快速筛选出高价值信息。注意力机制可以快速提取稀疏数据的重要特征,因而被广泛用于自然语言处理任务,特别是机器翻译。而自注意力机制(self-attention mechanism)是注意力机制的改进,其减少了对外部信息的依赖,更擅长捕捉数据或特征的内部相关性。注意力机制的本质思想可以改写为如下公式:The attention mechanism imitates the internal process of biological observation behavior, that is, a mechanism that aligns internal experience and external sensations to increase the observation precision of some areas, and can use limited attention resources to quickly filter out high-value information from a large amount of information. The attention mechanism can quickly extract important features of sparse data, and is therefore widely used in natural language processing tasks, especially machine translation. The self-attention mechanism is an improvement on the attention mechanism, which reduces dependence on external information and is better at capturing the internal correlation of data or features. The essential idea of the attention mechanism can be rewritten as the following formula:

其中,Lx=||Source||代表Source的长度,公式含义即将Source中的构成元素想象成是由一系列的数据对构成,此时给定目标Target中的某个元素Query,通过计算Query和各个Key的相似性或者相关性,得到每个Key对应Value的权重系数,然后对Value进行加权求和,即得到了最终的Attention数值。所以本质上Attention机制是对Source中元素的Value值进行加权求和,而Query和Key用来计算对应Value的权重系数。从概念上理解,把Attention可以理解为从大量信息中有选择地筛选出少量重要信息并聚焦到这些重要信息上,忽略大多不重要的信息。聚焦的过程体现在权重系数的计算上,权重越大越聚焦于其对应的Value值上,即权重代表了信息的重要性,而Value是其对应的信息。自注意力机制可以理解为内部Attention(intra attention),Attention机制发生在Target的元素Query和Source中的所有元素之间,自注意力机制指的是在Source内部元素之间或者Target内部元素之间发生的Attention机制,也可以理解为Target=Source这种特殊情况下的注意力计算机制,其具体计算过程是一样的,只是计算对象发生了变化而已。Among them, Lx=||Source|| represents the length of Source. The formula means that the elements in Source are imagined to be composed of a series of data pairs. At this time, given a certain element Query in the target Target, by calculating the similarity or correlation between Query and each Key, the weight coefficient of the Value corresponding to each Key is obtained, and then the Value is weighted and summed to obtain the final Attention value. Therefore, the Attention mechanism is essentially a weighted sum of the Value values of the elements in Source, and Query and Key are used to calculate the weight coefficient of the corresponding Value. Conceptually, Attention can be understood as selectively filtering out a small amount of important information from a large amount of information and focusing on these important information, ignoring most of the unimportant information. The focusing process is reflected in the calculation of the weight coefficient. The larger the weight, the more focus is placed on its corresponding Value value, that is, the weight represents the importance of the information, and the Value is the corresponding information. The self-attention mechanism can be understood as internal Attention (intra attention). The Attention mechanism occurs between the Query element of the Target and all the elements in the Source. The self-attention mechanism refers to the Attention mechanism that occurs between the internal elements of the Source or between the internal elements of the Target. It can also be understood as the attention calculation mechanism in the special case of Target=Source. The specific calculation process is the same, but the calculation object has changed.

(7)Grounding数据:视觉定位数据(包含图片和对应的描述),一张图片中有多个框,一个框对应描述中的一个词组,描述框中的物体或状态。(7) Grounding data: visual positioning data (including pictures and corresponding descriptions). There are multiple boxes in a picture, and each box corresponds to a phrase in the description, describing the object or state in the box.

(8)Detection数据:常规的检测数据,一张图片中有多个框,一个框对应一个名词类别。(8) Detection data: Conventional detection data, there are multiple boxes in an image, and one box corresponds to a noun category.

在当前的机器视觉领域,开放域检测模型,例如DetCLIP,已经展现出了强大的能力,可以针对任意给定的类别,实现精确的目标检测。然而,这个模型并不是无懈可击的,其实际应用中存在一些显而易见的问题。首先,我们往往无法提供一些具体的物体类别,这是因为现实世界中的物体种类繁多,而我们的知识库和词汇库却有限。其次,我们列举出的类别表也往往是不完整的,这个问题更多的是来源于我们的知识获取和组织方式的局限性。最后,我们无法根据类别的一些属性,功能等知识去给出具体的类别,这是因为目前的机器视觉系统缺乏对知识的深度理解和综合运用的能力。In the current field of machine vision, open domain detection models, such as DetCLIP, have demonstrated powerful capabilities and can achieve accurate target detection for any given category. However, this model is not impeccable, and there are some obvious problems in its practical application. First, we often cannot provide some specific object categories. This is because there are many kinds of objects in the real world, but our knowledge base and vocabulary are limited. Secondly, the category tables we list are often incomplete. This problem is more due to the limitations of our knowledge acquisition and organization methods. Finally, we cannot give specific categories based on some attributes, functions and other knowledge of the category. This is because the current machine vision system lacks the ability to deeply understand and comprehensively apply knowledge.

然而,现在已经有一些大型的语言模型,如ChatGPT,和多模态大模型,如miniGPT4,已经具备了较为出色的知识理解和推理能力。这些模型可以理解和处理人类的自然语言,还能根据给定的信息进行有意义的推理。但它们同样也有一些不足之处,比如缺乏对于细粒度任务如目标检测等任务的预测能力。However, there are already some large language models, such as ChatGPT, and multimodal large models, such as miniGPT4, which have excellent knowledge understanding and reasoning capabilities. These models can understand and process human natural language, and can also make meaningful inferences based on given information. But they also have some shortcomings, such as the lack of predictive capabilities for fine-grained tasks such as object detection.

为了解决上述问题,参照图6,图6为本申请实施例提供的一种数据处理方法的流程示意,如图6所示,本申请实施例提供的一种数据处理方法,可以包括步骤601至603,下面分别对这些步骤进行详细的描述。In order to solve the above problems, refer to Figure 6, which is a flow chart of a data processing method provided in an embodiment of the present application. As shown in Figure 6, a data processing method provided in an embodiment of the present application may include steps 601 to 603, and these steps are described in detail below.

601、获取图像以及对象检测请求,所述对象检测请求包含针对于所述图像中待检测对象的自然语言描述。601. Obtain an image and an object detection request, where the object detection request includes a natural language description of an object to be detected in the image.

其中,步骤601至603可以为模型训练过程的前馈过程,也可以是模型的推理过程。Among them, steps 601 to 603 can be the feedforward process of the model training process, or can be the reasoning process of the model.

本申请实施例中,希望在给定用户的语言格式输入以及当前场景的图片时,能够检测并输出符合用户语言条件的物体类别及其位置(也就是检测框在图像中的位置)。In an embodiment of the present application, it is desired to detect and output object categories and their positions (that is, the position of the detection box in the image) that meet the user's language conditions when a user inputs a language format and a picture of the current scene.

在模型的训练过程中,可以获取到包括图像以及对象检测请求(也可以称之为人类语言指令)的训练样本。During the training process of the model, training samples including images and object detection requests (also referred to as human language instructions) can be obtained.

例如,可以基于现有的目标检测数据集以及语言模型构建了一个标注流程。通过这个数据标注流程, 构建了一个基于人类语言指令指引的开放域检测数据集。在这个数据集中,根据特性和需求,将人类语言指令细化并分但不限于以下四个任务:For example, a labeling process can be built based on the existing object detection dataset and language model. Through this data labeling process, We have built an open domain detection dataset based on human language instructions. In this dataset, human language instructions are refined and divided into the following four tasks according to characteristics and requirements:

任务1是检测所有的类别。在这个任务中,希望模型能够在接收到用户的输入之后,全面而彻底地检测并确定图片中的所有物体类别。Task 1 is to detect all categories. In this task, we hope that the model can fully and thoroughly detect and determine all object categories in the image after receiving the user's input.

任务2是检测部分类别。相较于任务1的全面检测,这个任务需要模型更具针对性地去识别和检测特定的、由用户所指定的物体类别。Task 2 is to detect partial categories. Compared with the comprehensive detection of Task 1, this task requires the model to be more targeted to identify and detect specific object categories specified by the user.

任务3是检测某一个父类含有的类别。在这个任务中,模型需要理解并识别出物体之间的层级关系,比如,若用户要求检测所有的水果类别,模型则需要检测出图片中所有的水果,如苹果、橙子等。Task 3 is to detect the categories contained in a parent category. In this task, the model needs to understand and identify the hierarchical relationship between objects. For example, if the user asks to detect all fruit categories, the model needs to detect all fruits in the picture, such as apples, oranges, etc.

任务4是检测具有某一种功能或属性的类别。这个任务需要模型具备更高级别的理解和识别能力,比如当用户指示检测所有可以用来写字的物体时,模型需要识别出诸如铅笔、钢笔、马克笔等不同类别的物体。Task 4 is to detect categories with a certain function or attribute. This task requires the model to have a higher level of understanding and recognition capabilities. For example, when the user instructs to detect all objects that can be used for writing, the model needs to recognize different categories of objects such as pencils, pens, and markers.

通过这种方式,能够让模型更好地理解并执行用户的语言指令,从而更准确地在图像中识别和定位物体。In this way, the model can better understand and execute the user's language instructions, thereby more accurately identifying and locating objects in images.

例如,参照图7A,图7A为训练样本中各个任务的对象检测请求的自然语言描述的示意。For example, referring to FIG. 7A , FIG. 7A is a schematic diagram of a natural language description of an object detection request for each task in a training sample.

在模型的推理过程中,对象检测请求可以指示对图像进行目标检测,且该对象检测请求的语义包含了待检测对象的描述。During the inference process of the model, an object detection request may indicate target detection on an image, and the semantics of the object detection request includes a description of the object to be detected.

602、通过图像编码器,处理所述图像,得到多个图像区域中每个图像区域的特征表示,每个图像区域对应于一个候选的检测框;602. Process the image by an image encoder to obtain a feature representation of each of a plurality of image regions, each image region corresponding to a candidate detection frame;

在现有的实现中,在进行目标检测时,图像编码器输出的是整张图的特征表示,同时相关训练方式使得语言模型不具有/不擅长细粒度的图像处理能力,本申请实施例中,图像编码器输出的是图像中多个图像区域中每个图像区域的特征表示,每个图像区域可以对应一个候选的检测框,每个检测框可以包含一个对象。对象检测请求中指示的待检测对象所在的区域可以从多个图像区域内选择,具体可以将每个图像区域的特征表示和对象检测请求输入到语言模型中,由语言模型确定每个图像区域包括的对象是否是对象检测请求指示的待识别对象,语言模型还可以在确定出图像区域包括的对象是对象检测请求指示的待识别对象时,输出图像区域包括的对象的类别。In the existing implementation, when performing target detection, the image encoder outputs the feature representation of the entire image, and the related training method makes the language model not have/not good at fine-grained image processing capabilities. In the embodiment of the present application, the image encoder outputs the feature representation of each of the multiple image areas in the image, and each image area can correspond to a candidate detection box, and each detection box can contain an object. The area where the object to be detected indicated in the object detection request is located can be selected from multiple image areas. Specifically, the feature representation of each image area and the object detection request can be input into the language model, and the language model determines whether the object included in each image area is the object to be identified indicated by the object detection request. The language model can also output the category of the object included in the image area when it is determined that the object included in the image area is the object to be identified indicated by the object detection request.

利用图像编码器得到每个图像区域的特征,并结合语言模型进行目标检测,可以提高对于细粒度特征的处理能力,提高人类语言指引下目标检测的精度。Using the image encoder to obtain the features of each image area and combining it with the language model for target detection can improve the processing capabilities for fine-grained features and improve the accuracy of target detection under the guidance of human language.

接下来介绍如何训练得到具备上述细粒度处理能力的图像编码器。Next, we will introduce how to train an image encoder with the above-mentioned fine-grained processing capabilities.

在一种可能的实现中,可以获取到图像编码器的训练样本,所述训练样本包括图像样本和对应的文本样本,所述文本样本为所述图像样本对应的文本描述;通过图像编码器,处理所述图像样本,得到第一处理结果;通过文本编码器,处理所述文本样本,得到第二处理结果;根据所述第一处理结果和所述第二处理结果,通过对比学习更新所述图像编码器和所述文本编码器。In a possible implementation, a training sample of an image encoder can be obtained, wherein the training sample includes an image sample and a corresponding text sample, wherein the text sample is a text description corresponding to the image sample; the image sample is processed by the image encoder to obtain a first processing result; the text sample is processed by the text encoder to obtain a second processing result; and the image encoder and the text encoder are updated through comparative learning based on the first processing result and the second processing result.

在一种可能的实现中,所述第一处理结果包括多个检测框,以及每个检测框的类别;可以根据所述第一处理结果和对应的真值,更新所述图像编码器和所述文本编码器。In a possible implementation, the first processing result includes multiple detection boxes and a category of each detection box; the image encoder and the text encoder can be updated according to the first processing result and the corresponding true value.

从模型架构来说,在图像编码器方面,该模型可以采用了与DetCLIP相同或者相似的架构。具体来说,可以使用与swin-T主干相同的ATSS架构。对于文本编码器,可以采用FlanT5模型家族,例如可以同时在OPT,FlanT5-base和FlanT5-Large上进行。In terms of model architecture, for image encoders, the model can use the same or similar architecture as DetCLIP. Specifically, the same ATSS architecture as the swin-T backbone can be used. For text encoders, the FlanT5 model family can be used, for example, it can be performed on OPT, FlanT5-base, and FlanT5-Large at the same time.

示例性的,本申请实施例的训练过程可以包括两阶段,参照图7B,上述对于图像编码器和文本编码器的训练过程可以属于第一阶段,第一阶段类似于开放词汇表对象检测器的预训练,例如,可以采用来自检测、定位和captioning任务的训练数据。第一阶段可以用DetCLIP方法对齐特征与文本。具体来说,可以按照DetCLIP的方式进行开放词汇检测预训练。通过优化文本嵌入和物体级视觉嵌入之间的精细对比损失,以及中心度损失和边框回归损失来预训练检测器。利用检测、定位以及图像-文本对数据集,执行视觉-文本特征对齐。第一阶段结束后,得到了一个词汇对象检测器,它能够从预训练好的CLIP文本编码器中提取与文本嵌入良好对齐的视觉对象嵌入。Exemplarily, the training process of the embodiment of the present application may include two stages. Referring to Figure 7B, the above-mentioned training process for the image encoder and the text encoder may belong to the first stage. The first stage is similar to the pre-training of the open vocabulary object detector. For example, training data from detection, positioning and captioning tasks may be used. In the first stage, the DetCLIP method can be used to align features with text. Specifically, open vocabulary detection pre-training can be performed in the DetCLIP manner. The detector is pre-trained by optimizing the fine contrast loss between the text embedding and the object-level visual embedding, as well as the center loss and the bounding box regression loss. Visual-text feature alignment is performed using detection, positioning, and image-text pair datasets. After the first stage, a vocabulary object detector is obtained, which can extract visual object embeddings that are well aligned with text embeddings from the pre-trained CLIP text encoder.

示例性的,在第一阶段中,可以延续DetCLIP的训练方式。给定一个输入的图像x,先通过图像编码器Φi(例如,可以采用ATSS单阶段检测器)得到M个RoI区域特征Vi,i∈[1,M],计算单阶段检 测模型对应的中心度损失LCEN(sigmoid cross entropy loss),回归损失LREG(giou loss)以及对齐损失函数LALI(alignment loss)。注意对于detection或者grounding数据,可以使用大分辨率小batch size进行训练,对于图文对数据可以使用小分辨率大batch size进行训练。For example, in the first stage, the training method of DetCLIP can be continued. Given an input image x, firstly, M RoI region features V i , i∈[1,M] are obtained through an image encoder Φ i (for example, an ATSS single-stage detector can be used), and the single-stage detector is calculated. The center loss L CEN (sigmoid cross entropy loss), regression loss L REG (giou loss) and alignment loss function LALI (alignment loss) corresponding to the test model are used. Note that for detection or grounding data, large resolution and small batch size can be used for training, and for image-text data, small resolution and large batch size can be used for training.

603、通过语言模型,处理所述对象检测请求和多个所述特征表示,从所述多个图像区域中确定所述待检测对象所在的区域。603. Process the object detection request and the multiple feature representations through a language model, and determine a region where the object to be detected is located from the multiple image regions.

在一种可能的实现中,可以根据每个特征表示和对象检测请求,得到对应的图像区域的目标检测结果,该检测结果可以指示图像区域包括的对象是否是对象检测请求中指示的对象,以及在图像区域包括的对象是对象检测请求中指示的对象时该对象对应的类别。In one possible implementation, a target detection result of the corresponding image area can be obtained based on each feature representation and object detection request. The detection result can indicate whether the object included in the image area is the object indicated in the object detection request, and the category corresponding to the object when the object included in the image area is the object indicated in the object detection request.

在一种可能的实现中,参照图7B,语言模型可以在确定图像区域包括的对象不是对象检测请求中指示的对象时,输出“other”。也就是只有符合指令的检测框才会被分类,其他均标记为其他类别。In a possible implementation, referring to FIG7B , the language model may output “other” when determining that the object included in the image region is not the object indicated in the object detection request. That is, only the detection boxes that meet the instructions will be classified, and the others are marked as other categories.

在一种可能的实现中,可以通过语言模型,并行处理所述对象检测请求和每个所述特征表示,得到每个所述图像区域的检测结果;根据所述检测结果,从所述多个图像区域中确定所述待检测对象所在的区域。In a possible implementation, the object detection request and each of the feature representations can be processed in parallel through a language model to obtain a detection result for each of the image regions; and based on the detection result, the region where the object to be detected is located is determined from among the multiple image regions.

也就是说,语言模型可以并行的确定出每个图像区域的检测结果。That is, the language model can determine the detection results for each image region in parallel.

通过使用DetCLIP从图像中提取对象级视觉特征后,有两种方式可以训练模型以实现本申请实施例的目标。第一种方法是将对象特征连接起来,训练语言模型以顺序预测每个对象的输出。然而,这并不符合语言长期记忆模型(LLM)的原始输出习惯,导致训练难度增大。另一种方法,可以让语言模型独立处理每个对象特征。具体来说,每个检测模型得到的基于框的对象特征通过LLM与对应的指令进行交互,然后LLM只预测该对象基于指令的具体类别输出。After extracting object-level visual features from an image using DetCLIP, there are two ways to train a model to achieve the goals of an embodiment of the present application. The first method is to connect the object features and train a language model to sequentially predict the output of each object. However, this does not conform to the original output habits of the language long-term memory model (LLM), which increases the difficulty of training. Another method is to allow the language model to process each object feature independently. Specifically, the box-based object features obtained by each detection model interact with the corresponding instructions through LLM, and then LLM only predicts the specific category output of the object based on the instruction.

在一种可能的实现中,所述语言模型包括多个网络层,所述多个网络层中的至少一个网络层包括交叉注意力层;所述交叉注意力层用于对图像特征和文本特征之间进行注意力交互。In a possible implementation, the language model includes multiple network layers, at least one of the multiple network layers includes a cross-attention layer; the cross-attention layer is used to perform attention interaction between image features and text features.

在模型的训练过程中,对于语言模型的训练可以为第二阶段,在第二阶段中,可以固定除了语言模型之外的其他参数,训练语言模型(例如语言模型中的特征交互模块),实现了在人类指令下的图文理解检测。具体来说:In the model training process, the training of the language model can be the second stage. In the second stage, other parameters except the language model can be fixed, and the language model (such as the feature interaction module in the language model) can be trained to realize the image and text understanding detection under human instructions. Specifically:

在第二阶段,通过将语言模型引入模型,使对象检测器具有遵循人类指令的能力。例如,该模型可以在IOD-Bench训练集上进行训练,仅对那些符合指令的对象预测对象类别名称。In the second stage, the object detector is given the ability to follow human instructions by introducing a language model into the model. For example, the model can be trained on the IOD-Bench training set and predict object category names only for those objects that meet the instructions.

在第二阶段,利用IOD-Bench中的训练数据进行指令调整。具体来说,冻结第一阶段获得的图像编码器和预训练的语言模型。然后,在语言模型的解码层中插入随机初始化的跨注意力层(也就是本申请实施例中的交叉注意力层),并从头开始训练。图像通过图像编码器处理,提取出物体级视觉特征。同时,伴随的文本指令通过语言模型处理。物体级视觉特征和文本特征之间进行跨注意力操作。最后,优化语言模型输出的语言建模损失。In the second stage, instruction adjustment is performed using the training data in IOD-Bench. Specifically, the image encoder and pre-trained language model obtained in the first stage are frozen. Then, a randomly initialized cross-attention layer (that is, the cross-attention layer in the embodiment of the present application) is inserted into the decoding layer of the language model, and training is started from scratch. The image is processed by the image encoder to extract object-level visual features. At the same time, the accompanying text instructions are processed by the language model. Cross-attention operations are performed between object-level visual features and text features. Finally, the language modeling loss output by the language model is optimized.

示例性的,给定一个输入的图像x,先通过图像编码器Φi(例如,可以采用ATSS单阶段检测器)得到M个对象级的视觉特征Vi,i∈[1,M],为了实现跨模态融合,在语言模型的解码器层中插入随机初始化的交叉注意力层,并从头开始训练。针对于视觉部分出的每一个RoI特征及输入文本T在LLM每一层block上的操作为:
hL+1=FF[tanh(α)×X Attn(Attn(hL),V)+Attn(hL)];
For example, given an input image x, firstly, M object-level visual features V i , i∈[1,M] are obtained through an image encoder Φ i (for example, an ATSS single-stage detector can be used). In order to achieve cross-modal fusion, a randomly initialized cross-attention layer is inserted into the decoder layer of the language model and training is started from scratch. For each RoI feature and input text T from the visual part, the operation on each block of the LLM layer is:
h L+1 = FF [tanh (α) × X Attn (Attn (h L ), V) + Attn (h L )];

其中FF,XAttn和Attn分别指的是feed forward network,cross attention layer(交叉注意力层)和self-attention layer(自注意力层)。hL是第L层block对应的文本特征的输入,a是一个初始化为0的可学习的参数。Where FF, XAttn and Attn refer to feed forward network, cross attention layer and self-attention layer respectively. hL is the input of text features corresponding to the Lth layer block, and a is a learnable parameter initialized to 0.

最后,优化语言模型输出的语言建模损失,可以公式化为如下形式:
Finally, the language modeling loss that optimizes the output of the language model can be formulated as follows:

其中,Φ表示LLM,Vi是第i个对象的视觉特征,是与第i个对象在第t个时间步骤相关的文本token,指的是i个对象在第t个时间前相关的文本token。 Where Φ represents LLM, Vi is the visual feature of the i-th object, is the text token associated with the ith object at the tth time step, Refers to the text token related to the i-th object before the t-th time.

本申请实施例中,提出基于对象级别object-level的细粒度特征交互模块。区别于传统全图特征输入,模型引入object-level视觉特征,使特征交互模块能学习object与指令特征融合。进一步优化了细粒度特征的处理。In the embodiment of the present application, a fine-grained feature interaction module based on object level is proposed. Different from the traditional full-image feature input, the model introduces object-level visual features, so that the feature interaction module can learn the fusion of object and instruction features. The processing of fine-grained features is further optimized.

现有技术DetCLIP虽然在多项指标上展现出了卓越的性能,但其也存在一些明显的限制。首先,它需要给出具体的物体类别,这在某些场景中可能不太方便。其次,它无法根据人类语言指令直接进行检测,这限制了其在人机交互等应用中的实用性。本申请实施例通过引入大语言模型来增加模型对图片的理解及推理reasoning能力。具体做法包含:在语言模型的解码层中插入随机初始化的跨注意力层,并从头开始训练。图像通过编码器处理,提取出物体级视觉特征。同时,伴随的文本指令通过语言模型处理。物体级视觉特征和文本特征之间进行跨注意力操作。最后,优化语言模型输出的语言建模损失。Although the prior art DetCLIP has shown excellent performance in many indicators, it also has some obvious limitations. First, it needs to give a specific object category, which may not be convenient in some scenarios. Secondly, it cannot directly detect according to human language instructions, which limits its practicality in applications such as human-computer interaction. The embodiment of the present application introduces a large language model to increase the model's understanding and reasoning ability of pictures. The specific approach includes: inserting a randomly initialized cross-attention layer in the decoding layer of the language model and training from scratch. The image is processed by the encoder to extract object-level visual features. At the same time, the accompanying text instructions are processed by the language model. Cross-attention operations are performed between object-level visual features and text features. Finally, the language modeling loss output by the language model is optimized.

接下来结合具体的实验介绍本申请实施例的有益效果:Next, the beneficial effects of the embodiments of the present application are introduced in combination with specific experiments:

通过在IOD-Bench数据集上与基线方法进行比较,展示了本申请实施例的模型和训练策略的有效性。与BLIP2和MiniGPT4的变体进行了比较。对于BLIP2,使用FlanT5-XL和FlanT5-XXL作为语言模型进行了实验。对于MiniGPT4,使用Vicunna-7b作为语言模型。如表1所示,本申请实施例的Ins-DetCLIP大幅超越了其他对手。具体来说,使用FlanT5-base模型的Ins-DetCLIP就已经在所有任务上平均超越了MiniGPT4基线9.78%。由于LLM的泛化能力,本申请实施例的模型在训练期间未出现的指令上也表现出了良好的性能。例如,对于不可见域指令,使用FlanT5-base的Ins-DetCLIP平均仍然能达到13.7的mAP,这只比在域内指令上的结果稍低1.6%。By comparing with the baseline method on the IOD-Bench dataset, the effectiveness of the model and training strategy of the embodiment of the present application is demonstrated. It is compared with variants of BLIP2 and MiniGPT4. For BLIP2, experiments were conducted using FlanT5-XL and FlanT5-XXL as language models. For MiniGPT4, Vicunna-7b was used as the language model. As shown in Table 1, Ins-DetCLIP of the embodiment of the present application significantly surpasses other opponents. Specifically, Ins-DetCLIP using the FlanT5-base model has surpassed the MiniGPT4 baseline by an average of 9.78% on all tasks. Due to the generalization ability of LLM, the model of the embodiment of the present application also shows good performance on instructions that did not appear during training. For example, for invisible domain instructions, Ins-DetCLIP using FlanT5-base can still achieve an average mAP of 13.7, which is only slightly lower than the result on in-domain instructions by 1.6%.

表1
Table 1

借助LLM的卓越生成能力,本申请实施例的Ins-DetCLIP不仅可以预测类别名称,还能为感兴趣的对象生成详细的描述。通过在Dense Captioning任务上对其进行基准测试,展示了本申请实施例的模型的优越描述生成能力。为了确保公平比较,使用Dense Captioning数据集的框注释对Ins-DetCLIP的回归头进行了微调。如表2所示,本申请实施例的模型始终优于其他方法,并取得了state-of-the-art的效果。With the excellent generation ability of LLM, Ins-DetCLIP of the embodiment of the present application can not only predict category names, but also generate detailed descriptions for objects of interest. By benchmarking it on the Dense Captioning task, the superior description generation ability of the model of the embodiment of the present application is demonstrated. To ensure a fair comparison, the regression head of Ins-DetCLIP was fine-tuned using the box annotations of the Dense Captioning dataset. As shown in Table 2, the model of the embodiment of the present application consistently outperforms other methods and achieves state-of-the-art results.

表2
Table 2

在推理效率上,在每秒帧数(FPS)方面比较了Ins-DetCLIP和二阶段基线之间的推理效率。如表3所示,与基线方法相比,本申请实施例的模型能够达到更好的性能以及更快的推理速度。In terms of inference efficiency, the inference efficiency between Ins-DetCLIP and the two-stage baseline is compared in terms of frames per second (FPS). As shown in Table 3, compared with the baseline method, the model of the embodiment of the present application can achieve better performance and faster inference speed.

表3
Table 3

参照图8,图8为本申请实施例提供的一种数据处理装置的结构示意,如图8所示,本申请实施例提供的一种数据处理装置800,包括:Referring to FIG. 8 , FIG. 8 is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. As shown in FIG. 8 , a data processing device 800 provided in an embodiment of the present application includes:

获取模块801,用于获取图像以及对象检测请求,所述对象检测请求包含针对于所述图像中待检测对象的自然语言描述;An acquisition module 801 is used to acquire an image and an object detection request, wherein the object detection request includes a natural language description of an object to be detected in the image;

其中,关于获取模块801的描述可以参照上述实施例中步骤601的描述,这里不再赘述。The description of the acquisition module 801 may refer to the description of step 601 in the above embodiment, which will not be repeated here.

处理模块802,用于通过图像编码器,处理所述图像,得到多个图像区域中每个图像区域的特征表示,每个图像区域对应于一个候选的检测框;A processing module 802 is used to process the image through an image encoder to obtain a feature representation of each image region in a plurality of image regions, each image region corresponding to a candidate detection frame;

通过语言模型,处理所述对象检测请求和多个所述特征表示,从所述多个图像区域中确定所述待检测对象所在的区域。The object detection request and the plurality of feature representations are processed by a language model, and a region where the object to be detected is located is determined from among the plurality of image regions.

其中,关于处理模块802的描述可以参照上述实施例中步骤602和603的描述,这里不再赘述。The description of the processing module 802 may refer to the description of steps 602 and 603 in the above embodiment, which will not be repeated here.

在一种可能的实现中,所述处理模块802,具体用于:In a possible implementation, the processing module 802 is specifically configured to:

通过语言模型,并行处理所述对象检测请求和每个所述特征表示,得到每个所述图像区域的检测结果;Processing the object detection request and each of the feature representations in parallel through a language model to obtain a detection result for each of the image regions;

根据所述检测结果,从所述多个图像区域中确定所述待检测对象所在的区域。According to the detection result, the area where the object to be detected is located is determined from the multiple image areas.

在一种可能的实现中,所述通过图像编码器,处理所述图像之前,所述获取模块801,还用于:In a possible implementation, before the image is processed by the image encoder, the acquisition module 801 is further configured to:

获取训练样本,所述训练样本包括图像样本和对应的文本样本,所述文本样本为所述图像样本对应的文本描述;Acquire a training sample, wherein the training sample includes an image sample and a corresponding text sample, wherein the text sample is a text description corresponding to the image sample;

所述处理模块802,还用于:通过图像编码器,处理所述图像样本,得到第一处理结果;The processing module 802 is further configured to: process the image sample through an image encoder to obtain a first processing result;

通过文本编码器,处理所述文本样本,得到第二处理结果;Processing the text sample through a text encoder to obtain a second processing result;

根据所述第一处理结果和所述第二处理结果,通过对比学习更新所述图像编码器和所述文本编码器。According to the first processing result and the second processing result, the image encoder and the text encoder are updated through comparative learning.

在一种可能的实现中,所述第一处理结果包括多个检测框,以及每个检测框的类别;所述处理模块802,还用于:In a possible implementation, the first processing result includes a plurality of detection frames and a category of each detection frame; and the processing module 802 is further configured to:

根据所述第一处理结果和对应的真值,更新所述图像编码器和所述文本编码器。The image encoder and the text encoder are updated according to the first processing result and the corresponding true value.

在一种可能的实现中,所述语言模型包括多个网络层,所述多个网络层中的至少一个网络层包括交叉注意力层;所述交叉注意力层用于对图像特征和文本特征之间进行注意力交互。In a possible implementation, the language model includes multiple network layers, at least one of the multiple network layers includes a cross-attention layer; the cross-attention layer is used to perform attention interaction between image features and text features.

接下来介绍本申请实施例提供的一种执行设备,请参阅图9,图9为本申请实施例提供的执行设备的一种结构示意图,执行设备900具体可以表现为虚拟现实VR设备、手机、平板、笔记本电脑、智能穿戴设备、监控数据处理设备或服务器等,此处不做限定。具体的,执行设备900包括:接收器901、发射器902、处理器903和存储器904(其中执行设备900中的处理器903的数量可以一个或多个,图9中以一个处理器为例),其中,处理器903可以包括应用处理器9031和通信处理器9032。在本申请的一些实施例中,接收器901、发射器902、处理器903和存储器904可通过总线或其它方式连接。Next, an execution device provided in an embodiment of the present application is introduced. Please refer to Figure 9. Figure 9 is a structural schematic diagram of an execution device provided in an embodiment of the present application. The execution device 900 can be specifically manifested as a virtual reality VR device, a mobile phone, a tablet, a laptop computer, a smart wearable device, a monitoring data processing device or a server, etc., which is not limited here. Specifically, the execution device 900 includes: a receiver 901, a transmitter 902, a processor 903 and a memory 904 (wherein the number of processors 903 in the execution device 900 can be one or more, and one processor is taken as an example in Figure 9), wherein the processor 903 may include an application processor 9031 and a communication processor 9032. In some embodiments of the present application, the receiver 901, the transmitter 902, the processor 903 and the memory 904 may be connected via a bus or other means.

存储器904可以包括只读存储器和随机存取存储器,并向处理器903提供指令和数据。存储器904的一部分还可以包括非易失性随机存取存储器(non-volatile random access memory,NVRAM)。存储器904存储有处理器和操作指令、可执行模块或者数据结构,或者它们的子集,或者它们的扩展集,其中,操作指令可包括各种操作指令,用于实现各种操作。The memory 904 may include a read-only memory and a random access memory, and provides instructions and data to the processor 903. A portion of the memory 904 may also include a non-volatile random access memory (NVRAM). The memory 904 stores processor and operation instructions, executable modules or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.

处理器903控制执行设备的操作。具体的应用中,执行设备的各个组件通过总线系统耦合在一起,其中总线系统除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚 说明起见,在图中将各种总线都称为总线系统。The processor 903 controls the operation of the execution device. In a specific application, the various components of the execution device are coupled together through a bus system, wherein the bus system may include a power bus, a control bus, and a status signal bus in addition to a data bus. However, for the sake of clarity, For the sake of explanation, various buses are referred to as bus systems in the figures.

上述本申请实施例揭示的方法可以应用于处理器903中,或者由处理器903实现。处理器903可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器903中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器903可以是通用处理器、数字信号处理器(digital signal processing,DSP)、微处理器或微控制器,还可进一步包括专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。该处理器903可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器904,处理器903读取存储器904中的信息,结合其硬件完成上述方法的步骤。The method disclosed in the above embodiment of the present application can be applied to the processor 903, or implemented by the processor 903. The processor 903 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 903 or the instruction in the form of software. The above processor 903 can be a general processor, a digital signal processor (digital signal processing, DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (application specific integrated circuit, ASIC), a field programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The processor 903 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiment of the present application. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to be executed, or a combination of hardware and software modules in the decoding processor can be executed. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 904, and the processor 903 reads the information in the memory 904 and completes the steps of the above method in combination with its hardware.

接收器901可用于接收输入的数字或字符信息,以及产生与执行设备的相关设置以及功能控制有关的信号输入。发射器902可用于通过第一接口输出数字或字符信息;发射器902还可用于通过第一接口向磁盘组发送指令,以修改磁盘组中的数据;发射器902还可以包括显示屏等显示设备。The receiver 901 can be used to receive input digital or character information and generate signal input related to the relevant settings and function control of the execution device. The transmitter 902 can be used to output digital or character information through the first interface; the transmitter 902 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 902 can also include a display device such as a display screen.

本申请实施例还提供了一种训练设备,请参阅图10,图10是本申请实施例提供的训练设备一种结构示意图,具体的,训练设备1000由一个或多个服务器实现,训练设备1000可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上中央处理器(central processing units,CPU)1010(例如,一个或一个以上处理器)和存储器1032,一个或一个以上存储应用程序1042或数据1044的存储介质1030(例如一个或一个以上海量存储设备)。其中,存储器1032和存储介质1030可以是短暂存储或持久存储。存储在存储介质1030的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对训练设备中的一系列指令操作。更进一步地,中央处理器1010可以设置为与存储介质1030通信,在训练设备1000上执行存储介质1030中的一系列指令操作。The embodiment of the present application also provides a training device, please refer to Figure 10, Figure 10 is a structural diagram of the training device provided by the embodiment of the present application, specifically, the training device 1000 is implemented by one or more servers, and the training device 1000 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1010 (for example, one or more processors) and memory 1032, one or more storage media 1030 (for example, one or more mass storage devices) storing application programs 1042 or data 1044. Among them, the memory 1032 and the storage medium 1030 can be short-term storage or permanent storage. The program stored in the storage medium 1030 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the training device. Furthermore, the central processor 1010 can be configured to communicate with the storage medium 1030 to execute a series of instruction operations in the storage medium 1030 on the training device 1000.

训练设备1000还可以包括一个或一个以上电源1026,一个或一个以上有线或无线网络接口1050,一个或一个以上输入输出接口1058;或,一个或一个以上操作系统1041,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等等。The training device 1000 may also include one or more power supplies 1026, one or more wired or wireless network interfaces 1050, one or more input and output interfaces 1058; or, one or more operating systems 1041, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

本申请实施例中,中央处理器1010,用于执行上述实施例中和模型训练相关的动作。In the embodiment of the present application, the central processing unit 1010 is used to execute actions related to model training in the above embodiment.

本申请实施例中还提供一种包括计算机程序产品,当其在计算机上运行时,使得计算机执行如前述执行设备所执行的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。Also provided in an embodiment of the present application is a computer program product which, when executed on a computer, enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.

本申请实施例中还提供一种计算机可读存储介质,该计算机可读存储介质中存储有用于进行信号处理的程序,当其在计算机上运行时,使得计算机执行如前述执行设备所执行的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。A computer-readable storage medium is also provided in an embodiment of the present application, which stores a program for signal processing. When the computer-readable storage medium is run on a computer, it enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.

本申请实施例提供的执行设备、训练设备或终端设备具体可以为芯片,芯片包括:处理单元和通信单元,所述处理单元例如可以是处理器,所述通信单元例如可以是输入/输出接口、管脚或电路等。该处理单元可执行存储单元存储的计算机执行指令,以使执行设备内的芯片执行上述实施例描述的数据处理方法,或者,以使训练设备内的芯片执行上述实施例描述的数据处理方法。可选地,所述存储单元为所述芯片内的存储单元,如寄存器、缓存等,所述存储单元还可以是所述无线接入设备端内的位于所述芯片外部的存储单元,如只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)等。The execution device, training device or terminal device provided in the embodiments of the present application may specifically be a chip, and the chip includes: a processing unit and a communication unit, wherein the processing unit may be, for example, a processor, and the communication unit may be, for example, an input/output interface, a pin or a circuit, etc. The processing unit may execute the computer execution instructions stored in the storage unit so that the chip in the execution device executes the data processing method described in the above embodiment, or so that the chip in the training device executes the data processing method described in the above embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit may also be a storage unit located outside the chip in the wireless access device end, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.

具体的,请参阅图11,图11为本申请实施例提供的芯片的一种结构示意图,所述芯片可以表现为神经网络处理器NPU 1100,NPU 1100作为协处理器挂载到主CPU(Host CPU)上,由Host CPU分配任务。NPU的核心部分为运算电路1103,通过控制器1104控制运算电路1103提取存储器中的矩阵数据并进行乘法运算。 Specifically, please refer to FIG. 11, which is a schematic diagram of the structure of a chip provided in an embodiment of the present application. The chip can be expressed as a neural network processor NPU 1100. NPU 1100 is mounted on the host CPU (Host CPU) as a coprocessor, and tasks are assigned by the Host CPU. The core part of the NPU is the operation circuit 1103, which is controlled by the controller 1104 to extract matrix data from the memory and perform multiplication operations.

在一些实现中,运算电路1103内部包括多个处理单元(Process Engine,PE)。在一些实现中,运算电路1103是二维脉动阵列。运算电路1103还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路1103是通用的矩阵处理器。In some implementations, the operation circuit 1103 includes multiple processing units (Process Engine, PE) inside. In some implementations, the operation circuit 1103 is a two-dimensional systolic array. The operation circuit 1103 can also be a one-dimensional systolic array or other electronic circuits capable of performing mathematical operations such as multiplication and addition. In some implementations, the operation circuit 1103 is a general-purpose matrix processor.

举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器1102中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器1101中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器(accumulator)1108中。For example, assume there is an input matrix A, a weight matrix B, and an output matrix C. The operation circuit takes the corresponding data of matrix B from the weight memory 1102 and caches it on each PE in the operation circuit. The operation circuit takes the matrix A data from the input memory 1101 and performs matrix operation with matrix B, and the partial result or final result of the matrix is stored in the accumulator 1108.

统一存储器1106用于存放输入数据以及输出数据。权重数据直接通过存储单元访问控制器(Direct Memory Access Controller,DMAC)1105,DMAC被搬运到权重存储器1102中。输入数据也通过DMAC被搬运到统一存储器1106中。The unified memory 1106 is used to store input data and output data. The weight data is directly transferred to the weight memory 1102 through the direct memory access controller (DMAC) 1105. The input data is also transferred to the unified memory 1106 through the DMAC.

BIU为Bus Interface Unit即,总线接口单元1110,用于AXI总线与DMAC和取指存储器(Instruction Fetch Buffer,IFB)1109的交互。BIU stands for Bus Interface Unit, that is, the bus interface unit 1110, which is used for the interaction between AXI bus and DMAC and instruction fetch buffer (IFB) 1109.

总线接口单元1110(Bus Interface Unit,简称BIU),用于取指存储器1109从外部存储器获取指令,还用于存储单元访问控制器1105从外部存储器获取输入矩阵A或者权重矩阵B的原数据。The bus interface unit 1110 (BIU for short) is used for the instruction fetch memory 1109 to obtain instructions from the external memory, and is also used for the storage unit access controller 1105 to obtain the original data of the input matrix A or the weight matrix B from the external memory.

DMAC主要用于将外部存储器DDR中的输入数据搬运到统一存储器1106或将权重数据搬运到权重存储器1102中或将输入数据数据搬运到输入存储器1101中。DMAC is mainly used to transfer input data in the external memory DDR to the unified memory 1106 or to transfer weight data to the weight memory 1102 or to transfer input data to the input memory 1101.

向量计算单元1107包括多个运算处理单元,在需要的情况下,对运算电路1103的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。主要用于神经网络中非卷积/全连接层网络计算,如Batch Normalization(批归一化),像素级求和,对特征平面进行上采样等。The vector calculation unit 1107 includes multiple operation processing units, and when necessary, further processes the output of the operation circuit 1103, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional/fully connected layer network calculations in neural networks, such as Batch Normalization, pixel-level summation, upsampling of feature planes, etc.

在一些实现中,向量计算单元1107能将经处理的输出的向量存储到统一存储器1106。例如,向量计算单元1107可以将线性函数;或,非线性函数应用到运算电路1103的输出,例如对卷积层提取的特征平面进行线性插值,再例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元1107生成归一化的值、像素级求和的值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路1103的激活输入,例如用于在神经网络中的后续层中的使用。In some implementations, the vector calculation unit 1107 can store the processed output vector to the unified memory 1106. For example, the vector calculation unit 1107 can apply a linear function; or a nonlinear function to the output of the operation circuit 1103, such as linear interpolation of the feature plane extracted by the convolution layer, and then, for example, a vector of accumulated values to generate an activation value. In some implementations, the vector calculation unit 1107 generates a normalized value, a pixel-level summed value, or both. In some implementations, the processed output vector can be used as an activation input to the operation circuit 1103, for example, for use in a subsequent layer in a neural network.

控制器1104连接的取指存储器(instruction fetch buffer)1109,用于存储控制器1104使用的指令;An instruction fetch buffer 1109 connected to the controller 1104 is used to store instructions used by the controller 1104;

统一存储器1106,输入存储器1101,权重存储器1102以及取指存储器1109均为On-Chip存储器。外部存储器私有于该NPU硬件架构。Unified memory 1106, input memory 1101, weight memory 1102 and instruction fetch memory 1109 are all on-chip memories. External memories are private to the NPU hardware architecture.

其中,上述任一处提到的处理器,可以是一个通用中央处理器,微处理器,ASIC,或一个或多个用于控制上述程序执行的集成电路。The processor mentioned in any of the above places may be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the above programs.

另外需说明的是,以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。另外,本申请提供的装置实施例附图中,模块之间的连接关系表示它们之间具有通信连接,具体可以实现为一条或多条通信总线或信号线。It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到本申请可借助软件加必需的通用硬件的方式来实现,当然也可以通过专用硬件包括专用集成电路、专用CPU、专用存储器、专用元器件等来实现。一般情况下,凡由计算机程序完成的功能都可以很容易地用相应的硬件来实现,而且,用来实现同一功能的具体硬件结构也可以是多种多样的,例如模拟电路、数字电路或专用电路等。但是,对本申请而言更多情况下软件程序实现是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在可读取的存储介质中,如计算机的软盘、U盘、移动硬盘、ROM、RAM、磁碟或者光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,训练设备,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a magnetic disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、 计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、训练设备或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、训练设备或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的训练设备、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘(Solid State Disk,SSD))等。 The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, Computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, training device or data center to another website, computer, training device or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, data center, etc. that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive (SSD)).

Claims (13)

一种数据处理方法,其特征在于,所述方法包括:A data processing method, characterized in that the method comprises: 获取图像以及对象检测请求,所述对象检测请求包含针对于所述图像中待检测对象的自然语言描述;Obtaining an image and an object detection request, wherein the object detection request includes a natural language description of an object to be detected in the image; 通过图像编码器,处理所述图像,得到多个图像区域中每个图像区域的特征表示,每个图像区域对应于一个候选的检测框;Processing the image by an image encoder to obtain a feature representation of each of a plurality of image regions, each image region corresponding to a candidate detection frame; 通过语言模型,处理所述对象检测请求和多个所述特征表示,从所述多个图像区域中确定所述待检测对象所在的区域和类别。The object detection request and the plurality of feature representations are processed by a language model, and the region and category of the object to be detected are determined from the plurality of image regions. 根据权利要求1所述的方法,其特征在于,所述通过语言模型,处理所述对象检测请求和多个所述特征表示,从所述多个图像区域中确定所述待检测对象所在的区域,包括:The method according to claim 1, characterized in that the step of processing the object detection request and the plurality of feature representations through a language model, and determining the region where the object to be detected is located from the plurality of image regions, comprises: 通过语言模型,并行处理所述对象检测请求和每个所述特征表示,得到每个所述图像区域的检测结果;Processing the object detection request and each of the feature representations in parallel through a language model to obtain a detection result for each of the image regions; 根据所述检测结果,从所述多个图像区域中确定所述待检测对象所在的区域。According to the detection result, the area where the object to be detected is located is determined from the multiple image areas. 根据权利要求1或2所述的方法,其特征在于,所述通过图像编码器,处理所述图像之前,所述方法还包括:The method according to claim 1 or 2, characterized in that before processing the image by the image encoder, the method further comprises: 获取训练样本,所述训练样本包括图像样本和对应的文本样本,所述文本样本为所述图像样本对应的文本描述;Acquire a training sample, wherein the training sample includes an image sample and a corresponding text sample, wherein the text sample is a text description corresponding to the image sample; 通过图像编码器,处理所述图像样本,得到第一处理结果;Processing the image sample through an image encoder to obtain a first processing result; 通过文本编码器,处理所述文本样本,得到第二处理结果;Processing the text sample through a text encoder to obtain a second processing result; 根据所述第一处理结果和所述第二处理结果,通过对比学习更新所述图像编码器和所述文本编码器。According to the first processing result and the second processing result, the image encoder and the text encoder are updated through comparative learning. 根据权利要求3所述的方法,其特征在于,所述第一处理结果包括多个检测框,以及每个检测框的类别;所述方法还包括:The method according to claim 3, characterized in that the first processing result includes multiple detection boxes and a category of each detection box; the method further comprises: 根据所述第一处理结果和对应的真值,更新所述图像编码器和所述文本编码器。The image encoder and the text encoder are updated according to the first processing result and the corresponding true value. 根据权利要求1至4任一所述的方法,其特征在于,所述语言模型包括多个网络层,所述多个网络层中的至少一个网络层包括交叉注意力层;所述交叉注意力层用于对图像特征和文本特征之间进行注意力交互。The method according to any one of claims 1 to 4 is characterized in that the language model includes multiple network layers, at least one of the multiple network layers includes a cross-attention layer; the cross-attention layer is used to perform attention interaction between image features and text features. 一种数据处理装置,其特征在于,所述装置包括:A data processing device, characterized in that the device comprises: 获取模块,用于获取图像以及对象检测请求,所述对象检测请求包含针对于所述图像中待检测对象的自然语言描述;An acquisition module, configured to acquire an image and an object detection request, wherein the object detection request includes a natural language description of an object to be detected in the image; 处理模块,用于通过图像编码器,处理所述图像,得到多个图像区域中每个图像区域的特征表示,每个图像区域对应于一个候选的检测框;A processing module, configured to process the image through an image encoder to obtain a feature representation of each of a plurality of image regions, each image region corresponding to a candidate detection frame; 通过语言模型,处理所述对象检测请求和多个所述特征表示,从所述多个图像区域中确定所述待检测对象所在的区域和类别。The object detection request and the plurality of feature representations are processed by a language model, and the region and category of the object to be detected are determined from the plurality of image regions. 根据权利要求6所述的装置,其特征在于,所述处理模块,具体用于:The device according to claim 6, characterized in that the processing module is specifically used to: 通过语言模型,并行处理所述对象检测请求和每个所述特征表示,得到每个所述图像区域的检测结果;Processing the object detection request and each of the feature representations in parallel through a language model to obtain a detection result for each of the image regions; 根据所述检测结果,从所述多个图像区域中确定所述待检测对象所在的区域。According to the detection result, the area where the object to be detected is located is determined from the multiple image areas. 根据权利要求6或7所述的装置,其特征在于,所述通过图像编码器,处理所述图像之前,所述获取模块,还用于: The device according to claim 6 or 7, characterized in that before the image is processed by the image encoder, the acquisition module is further used to: 获取训练样本,所述训练样本包括图像样本和对应的文本样本,所述文本样本为所述图像样本对应的文本描述;Acquire a training sample, wherein the training sample includes an image sample and a corresponding text sample, wherein the text sample is a text description corresponding to the image sample; 所述处理模块,还用于:通过图像编码器,处理所述图像样本,得到第一处理结果;The processing module is further used to: process the image sample through an image encoder to obtain a first processing result; 通过文本编码器,处理所述文本样本,得到第二处理结果;Processing the text sample through a text encoder to obtain a second processing result; 根据所述第一处理结果和所述第二处理结果,通过对比学习更新所述图像编码器和所述文本编码器。According to the first processing result and the second processing result, the image encoder and the text encoder are updated through comparative learning. 根据权利要求8所述的装置,其特征在于,所述第一处理结果包括多个检测框,以及每个检测框的类别;所述处理模块,还用于:The device according to claim 8, wherein the first processing result includes a plurality of detection frames and a category of each detection frame; and the processing module is further configured to: 根据所述第一处理结果和对应的真值,更新所述图像编码器和所述文本编码器。The image encoder and the text encoder are updated according to the first processing result and the corresponding true value. 根据权利要求6至9任一所述的装置,其特征在于,所述语言模型包括多个网络层,所述多个网络层中的至少一个网络层包括交叉注意力层;所述交叉注意力层用于对图像特征和文本特征之间进行注意力交互。The device according to any one of claims 6 to 9 is characterized in that the language model includes multiple network layers, at least one of the multiple network layers includes a cross-attention layer; the cross-attention layer is used to perform attention interaction between image features and text features. 一种计算机存储介质,其特征在于,所述计算机存储介质存储有一个或多个指令,所述指令在由一个或多个计算机执行时使得所述一个或多个计算机执行权利要求1至5中任一项所述方法的操作。A computer storage medium, characterized in that the computer storage medium stores one or more instructions, which, when executed by one or more computers, enable the one or more computers to perform the operations of the method described in any one of claims 1 to 5. 一种计算机程序产品,其特征在于,包括计算机可读指令,当所述计算机可读指令在计算机设备上运行时,使得所述计算机设备执行如权利要求1至5任一所述的方法。A computer program product, characterized in that it comprises computer-readable instructions, and when the computer-readable instructions are executed on a computer device, the computer device is caused to execute the method according to any one of claims 1 to 5. 一种系统,包括至少一个处理器,至少一个存储器;所述处理器、所述存储器通过通信总线连接并完成相互间的通信;A system comprises at least one processor and at least one memory; the processor and the memory are connected via a communication bus and communicate with each other; 所述至少一个存储器用于存储代码;The at least one memory is used to store code; 所述至少一个处理器用于执行所述代码,以执行如权利要求1至5任一所述的方法。 The at least one processor is configured to execute the code to perform the method according to any one of claims 1 to 5.
PCT/CN2024/113045 2023-08-23 2024-08-19 Data processing method and apparatus Pending WO2025040048A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202311071646.4A CN117251592A (en) 2023-08-23 2023-08-23 A data processing method and its device
CN202311071646.4 2023-08-23

Publications (1)

Publication Number Publication Date
WO2025040048A1 true WO2025040048A1 (en) 2025-02-27

Family

ID=89135925

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2024/113045 Pending WO2025040048A1 (en) 2023-08-23 2024-08-19 Data processing method and apparatus

Country Status (2)

Country Link
CN (1) CN117251592A (en)
WO (1) WO2025040048A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120216149A (en) * 2025-05-26 2025-06-27 北京富通东方科技有限公司 Multi-level large model scheduling and knowledge base self-adaptive optimization method and system
CN120411661A (en) * 2025-07-04 2025-08-01 上海小零网络科技有限公司 Large model data annotation method, device and storage medium based on multi-candidate arbitration

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117251592A (en) * 2023-08-23 2023-12-19 华为技术有限公司 A data processing method and its device
CN117975028A (en) * 2024-02-04 2024-05-03 北京有竹居网络技术有限公司 Method, device, apparatus and storage medium for object detection
CN118962499B (en) * 2024-07-17 2025-11-25 国网福建省电力有限公司 A database-based integrated management and control method for standard testing examples of energy storage devices
CN119359996B (en) * 2024-10-15 2025-08-01 中电信人工智能科技(北京)有限公司 Fine tuning method and device for open domain target detection model, electronic equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220198228A1 (en) * 2020-12-22 2022-06-23 Hon Hai Precision Industry Co., Ltd. Method for detecting defects in multi-scale images and computing device utilizing method
CN115578570A (en) * 2022-09-29 2023-01-06 北京有竹居网络技术有限公司 Image processing method, device, readable medium and electronic equipment
CN115757692A (en) * 2022-10-20 2023-03-07 华为技术有限公司 Data processing method and device
CN116468725A (en) * 2023-06-13 2023-07-21 北京航空航天大学杭州创新研究院 Industrial defect detection method, device and storage medium based on pre-training model
CN117251592A (en) * 2023-08-23 2023-12-19 华为技术有限公司 A data processing method and its device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US12374325B2 (en) * 2021-01-21 2025-07-29 Servicenow, Inc. Domain-aware vector encoding (DAVE) system for a natural language understanding (NLU) framework
CN114821622B (en) * 2022-03-10 2023-07-21 北京百度网讯科技有限公司 Text extraction method, text extraction model training method, device and equipment
CN115375781A (en) * 2022-07-20 2022-11-22 华为技术有限公司 Data processing method and device
CN116343004A (en) * 2023-02-28 2023-06-27 华为技术有限公司 A kind of image processing method and related equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220198228A1 (en) * 2020-12-22 2022-06-23 Hon Hai Precision Industry Co., Ltd. Method for detecting defects in multi-scale images and computing device utilizing method
CN115578570A (en) * 2022-09-29 2023-01-06 北京有竹居网络技术有限公司 Image processing method, device, readable medium and electronic equipment
CN115757692A (en) * 2022-10-20 2023-03-07 华为技术有限公司 Data processing method and device
CN116468725A (en) * 2023-06-13 2023-07-21 北京航空航天大学杭州创新研究院 Industrial defect detection method, device and storage medium based on pre-training model
CN117251592A (en) * 2023-08-23 2023-12-19 华为技术有限公司 A data processing method and its device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120216149A (en) * 2025-05-26 2025-06-27 北京富通东方科技有限公司 Multi-level large model scheduling and knowledge base self-adaptive optimization method and system
CN120411661A (en) * 2025-07-04 2025-08-01 上海小零网络科技有限公司 Large model data annotation method, device and storage medium based on multi-candidate arbitration

Also Published As

Publication number Publication date
CN117251592A (en) 2023-12-19

Similar Documents

Publication Publication Date Title
WO2025040048A1 (en) Data processing method and apparatus
WO2024083121A1 (en) Data processing method and apparatus
WO2024041479A1 (en) Data processing method and apparatus
WO2024260402A1 (en) Data processing method and apparatus
WO2023284716A1 (en) Neural network searching method and related device
WO2025026210A1 (en) Data processing method and apparatus
WO2024255755A1 (en) Data processing method and related device
WO2024213099A1 (en) Data processing method and apparatus
WO2024239983A1 (en) Method and apparatus for controllable generation
WO2024199409A1 (en) Data processing method and apparatus thereof
WO2025067211A1 (en) Data processing method and apparatus
WO2024245061A1 (en) Data processing method and apparatus
WO2024017287A1 (en) Model training method and apparatus therefor
WO2024046473A1 (en) Data processing method and apparatus
WO2024230757A1 (en) Data processing method and related apparatus
WO2024255677A1 (en) Dialogue data generation method and related device thereof
WO2024245349A1 (en) Data processing method and apparatus
WO2024179485A1 (en) Image processing method and related device thereof
WO2024114659A1 (en) Summary generation method and related device
WO2024140630A1 (en) Model training method and related device
EP4404080A1 (en) Method and apparatus for determining reply statement
WO2024000512A1 (en) Model training method and related device
WO2025044967A1 (en) Data processing method and apparatus
WO2025130968A1 (en) Data processing method and apparatus therefor
WO2025113374A1 (en) Task information acquisition method and related device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 24855771

Country of ref document: EP

Kind code of ref document: A1