Data processing method and apparatus
By introducing a combination of image encoder and language model in machine vision systems, the problem of the lack of deep knowledge understanding in object detection in existing systems is solved, and more efficient fine-grained feature processing and object detection accuracy under human language guidance is achieved.
Patent Information
- Application Number
- PCT/CN2024/113045
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-08-23
- Filing Date
- 2024-08-19
- Publication Date
- 2025-02-27
AI Technical Summary
The existing machine vision system lacks deep understanding and comprehensive application of knowledge in object detection, resulting in the inability to effectively handle the target detection tasks under fine-grained characteristics and human language guidance.
By obtaining natural language descriptions in image and object detection requests, the image is divided into multiple image areas using an image encoder, each area corresponds to a candidate detection box, and then these feature representations and object detection requests are input into the language model, and parallel processing is performed to determine the area and category of the object to be detected.
It improves the processing ability of fine-grained features and the accuracy of object detection under human language guidance, and enhances the model's understanding and comprehensive application ability of knowledge.
Smart Images

Figure CN2024113045_27022025_PF_FP_ABST
Abstract
Description
A data processing method and device thereof
[0001] This application claims priority to 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 into this application. Technical Field
[0002] The present application relates to the field of artificial intelligence, and in particular to a data processing method and device thereof. Background Art
[0003] 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 infallible, and there are some obvious problems in its practical application. First, we are often unable to provide some specific object categories. This is because there are many types of objects in the real world, and our knowledge base and vocabulary are limited. Second, the category tables we list are often incomplete. This problem stems more from the limitations of our knowledge acquisition and organization methods. Finally, we are unable to give specific categories based on some of the category's attributes, functions, and other knowledge. This is because current machine vision systems lack the ability to deeply understand and comprehensively apply knowledge.
[0004] However, some large language models, such as ChatGPT, and multimodal models, such as miniGPT4, already possess impressive knowledge understanding and reasoning capabilities. These models can understand and process natural human language and make meaningful inferences based on given information. However, they also have some shortcomings, such as a lack of predictive power for fine-grained tasks such as object detection.
[0005] Summary of the Invention
[0006] This application provides a data processing method that can improve the processing capability of fine-grained features and improve the accuracy of target detection under the guidance of human language.
[0007] 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 including 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 multiple image regions, each image region corresponding to a candidate detection box; processing the object detection request and multiple feature representations through a language model, and determining the region and category of the object to be detected from the multiple image regions.
[0008] In existing implementations, when performing target detection, the image encoder outputs a feature representation of the entire image. At the same time, the related training method makes the language model not have / not good at fine-grained image processing capabilities. In an embodiment of the present application, the image encoder outputs a feature representation of each of the multiple image regions in the image. Each image region can correspond to a candidate detection frame, and each detection frame 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 regions. Specifically, the feature representation of each image region and the object detection request can be input into the language model. The language model determines whether the object included in each image region 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 region when it is determined that the object included in the image region is the object to be identified indicated by the object detection request.
[0009] Using an image encoder to obtain the features of each image region and combining it with a language model for target detection can improve the processing capabilities of fine-grained features and improve the accuracy of target detection under the guidance of human language.
[0010] In one possible implementation, processing the object detection request and the multiple feature representations through a language model, and determining 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 the area where the object to be detected is located from the multiple image areas based on the detection results.
[0011] In one possible implementation, before processing the image through 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 through the image encoder to obtain a first processing result; processing the text sample through the text encoder to obtain a second processing result; and updating the image encoder and the text encoder through comparative learning based on the first processing result and the second processing result.
[0012] In a possible implementation, the first processing result includes multiple detection boxes and a category of each detection box; the method further includes: updating the image encoder and the text encoder according to the first processing result and the corresponding true value.
[0013] In one 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.
[0014] In a second aspect, the present application provides a data processing device, comprising:
[0015] 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;
[0016] 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;
[0017] 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 the plurality of image regions.
[0018] In a possible implementation, the processing module is specifically configured to:
[0019] 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;
[0020] According to the detection result, the area where the object to be detected is located is determined from the multiple image areas.
[0021] In a possible implementation, before the image is processed by the image encoder, the acquisition module is further configured to:
[0022] Acquire a training sample, where the training sample includes an image sample and a corresponding text sample, where the text sample is a text description corresponding to the image sample;
[0023] The processing module is further configured to: process the image sample through an image encoder to obtain a first processing result;
[0024] Processing the text sample through a text encoder to obtain a second processing result;
[0025] The image encoder and the text encoder are updated through comparative learning according to the first processing result and the second processing result.
[0026] In a possible implementation, the first processing result includes multiple detection boxes and a category of each detection box; and the processing module is further configured to:
[0027] The image encoder and the text encoder are updated according to the first processing result and the corresponding true value.
[0028] In one 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.
[0029] 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.
[0030] 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.
[0031] 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.
[0032] In a sixth aspect, the present application provides a chip system comprising a processor configured to support a data processing device in implementing the functions described in the aforementioned aspects, such as transmitting or processing the data or information described in the aforementioned methods. In one possible design, the chip system further comprises a memory configured to store program instructions and data necessary for executing or training the device. The chip system may consist solely of a chip or may include a chip and other discrete components. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] FIG1A is a schematic diagram of a structure of an artificial intelligence main framework;
[0034] Figures 1B to 1D are schematic diagrams of the application framework of this application;
[0035] Figure 2 is a schematic diagram of the application framework of this application;
[0036] Figure 3 is a schematic diagram of the application framework of this application;
[0037] Figure 4 is a schematic diagram of the application framework of this application;
[0038] Figures 5A and 5B are schematic diagrams of a network structure of the present application;
[0039] FIG6 is a flowchart of a data processing method provided in an embodiment of the present application;
[0040] FIG7A is a schematic diagram of text in a training sample provided in an embodiment of the present application;
[0041] FIG7B is a schematic diagram of a training process provided in an embodiment of the present application;
[0042] FIG8 is a schematic structural diagram of a data processing device provided in an embodiment of the present application;
[0043] FIG9 is a schematic diagram of a structure of an execution device provided in an embodiment of the present application;
[0044] FIG10 is a schematic diagram of a structure of a training device provided in an embodiment of the present application;
[0045] FIG11 is a schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] The following describes the embodiments of the present invention in conjunction with the accompanying drawings. The terms used in the embodiments 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.
[0047] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate 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.
[0048] 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 are not necessarily 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, and this is merely a way of distinguishing the objects of the same attributes when describing them 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.
[0049] First, let's describe the overall workflow of an AI system. See Figure 1A, which shows a schematic diagram of the main AI framework. This AI framework will be explained from two perspectives: the "intelligent information chain" (horizontal axis) and the "IT value chain" (vertical axis). The "intelligent information chain" reflects the entire process from data acquisition to processing. For example, it could be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, and intelligent execution and output. Throughout this process, data undergoes a condensed journey from "data-information-knowledge-wisdom." The "IT value chain," spanning the underlying infrastructure of human intelligence, information (provided and processed by technology), and the system's industrial ecosystem, reflects the value that AI brings to the information technology industry.
[0050] (1) Infrastructure
[0051] Infrastructure provides computing power for AI systems, enabling communication with the outside world and supporting this through a foundational platform. External communication occurs through sensors; computing power is provided by intelligent chips (CPUs, NPUs, GPUs, ASICs, FPGAs, and other hardware accelerators). The foundational platform includes a distributed computing framework and network-related platform guarantees and support, including cloud storage and computing, and interconnected networks. For example, sensors communicate with the outside world to acquire data, which is then fed into the intelligent chips within the distributed computing system provided by the foundational platform for computation.
[0052] (2) Data
[0053] Data above the infrastructure layer represents data sources for AI. This data includes graphics, images, voice, and text, as well as IoT data from traditional devices. This includes business data from existing systems and sensor data such as force, displacement, liquid level, temperature, and humidity.
[0054] (3) Data processing
[0055] Data processing generally includes data training, machine learning, deep learning, search, reasoning, decision-making, etc.
[0056] Among them, machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, and training.
[0057] 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.
[0058] Decision-making refers to the process of making decisions after intelligent information is reasoned, and usually provides functions such as classification, sorting, and prediction.
[0059] (4) General ability
[0060] 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 algorithms or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.
[0061] (5) Smart products and industry applications
[0062] 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 application. Its application areas mainly include: smart terminals, smart transportation, smart medical care, autonomous driving, smart cities, etc.
[0063] This application can be applied to the field of image processing in the field of artificial intelligence. Taking image processing as an example, the following will introduce multiple application scenarios that have been implemented in products.
[0064] First, the application scenario of this application is introduced.
[0065] This application can be applied to, but is not limited to, applications with image processing capabilities (hereinafter referred to as image processing applications) or cloud services provided by cloud-side servers, etc., which are described below:
[0066] 1. Image processing applications
[0067] The product form of the embodiment of the present application can be an image processing application, in particular, an application with image segmentation function. The image processing application can be run on a terminal device or a cloud-side server.
[0068] In one possible implementation, an image processing application can perform tasks such as target detection based on an input image 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).
[0069] 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 the embodiment of the present application and present the processing results to the user (the presentation method can be but is not limited to display, saving, uploading to the cloud, etc.).
[0070] 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 images and text to a server on the cloud side. The server on the cloud side processes the images 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 can be, but is not limited to, display, saving, uploading to the cloud side, etc.).
[0071] Next, the image processing application in the embodiment of this application is introduced from the perspective of functional architecture and product architecture that implements the functions.
[0072] 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:
[0073] In one possible implementation, as shown in FIG1B , an image processing application 102 may receive input parameters 101 (e.g., including an image and text) and generate a processing result 103. The image processing application 102 may be executed on, for example, at least one computer system and include computer code that, when executed by one or more computers, causes the computers to execute the method provided in the embodiments of the present application.
[0074] 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:
[0075] Referring to FIG1C , FIG1C 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 (FIG1C illustrates one server as an example), and the server 200 may provide the method provided in the embodiments of the present application to one or more terminals.
[0076] 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 results based on the received parameters and return the processing results to the terminal 100.
[0077] 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 need for the cooperation of the server, and the embodiments of the present application are not limited to this.
[0078] Next, the product form of the terminal 100 in FIG1C is described;
[0079] The terminal 100 in the embodiment of the present application can be a mobile phone, a tablet computer, a wearable device, an in-vehicle 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 restrictions on this.
[0080] FIG1D shows a schematic diagram of an optional hardware structure of the terminal 100 .
[0081] 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 FIG1D is merely an example of a terminal or multi-function device and does not limit the terminal or multi-function device. The terminal or multi-function device may include more or fewer components than shown, or may combine certain components or have different components.
[0082] The input unit 130 can be used to receive input digital or character information and generate key signal input related to user settings and function control of the portable multifunction device. Specifically, the input unit 130 may include a touch screen 131 (optional) and / or other input devices 132. The touch screen 131 can detect user touch operations on or near it (for example, operations performed on or near the touch screen using a finger, joint, stylus, or any other suitable object) and drive corresponding connected devices according to pre-set programs. The touch screen can detect user touch actions on the touch screen, convert the touch actions into touch signals and transmit them to the processor 170. It can also receive and execute commands sent by the processor 170; the touch signals include at least touch point coordinate information. The touch screen 131 provides an input interface and an output interface between the terminal 100 and the user. Touch screens can be implemented using various types, including resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch screen 131, the input unit 130 may also include other input devices. Specifically, the 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.
[0083] The input device 132 can receive input images, texts, and the like.
[0084] 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 an embodiment of the present application, the display unit 140 may be used to display the interface of an image processing application, processing results, etc.
[0085] Memory 120 can be used to store instructions and data. It primarily includes an instruction storage area and a data storage area. The data storage area can store various data, such as multimedia files and text. The instruction storage area can store software units such as the operating system, applications, and instructions required for at least one function, or subsets or extensions thereof. It may also include non-volatile random access memory (RAM). It provides processor 170 with management functions for the hardware, software, and data resources within the computing and processing device, supporting control software and applications. It is also used to store multimedia files and running programs and applications.
[0086] The processor 170 is the control center of the terminal 100. It connects all components of the terminal 100 using various interfaces and circuits. By executing instructions stored in the memory 120 and accessing data stored therein, it executes various functions of the terminal 100 and processes data, thereby providing overall control of the terminal device. Optionally, the processor 170 may include one or more processing units. Preferably, the processor 170 may integrate an application processor and a modem processor, with the application processor primarily processing the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into the processor 170. In some embodiments, the processor and memory may be implemented on a single chip; in other embodiments, they may be implemented on separate chips. The processor 170 may also generate corresponding operational control signals and send them to the corresponding components of the computing and processing device. It may also read and process data in the software, particularly the data and programs in the memory 120, to enable the various functional modules therein to perform their corresponding functions, thereby controlling the corresponding components to operate as instructed.
[0087] 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's data processing method, and can also schedule other units (such as the above-mentioned input unit 130 and display unit 140) to achieve corresponding functions.
[0088] The RF unit 110 (optional) can be used to send and receive information or receive and send signals during a call. For example, after receiving downlink information from the base station, it is passed to the processor 170 for processing; in addition, it sends the designed uplink data 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 (LNA), a duplexer, etc. In addition, the RF unit 110 can also communicate with network devices and other devices via wireless communication. This 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.
[0089] In this embodiment of the present application, the RF unit 110 may send the image to the server 200 and receive the processing result sent by the server 200.
[0090] 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.
[0091] 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, thereby managing functions such as charging, discharging, and power consumption through the power management system.
[0092] The terminal 100 further includes an external interface 180 , which may be a standard Micro USB interface or a multi-pin connector, and may be used to connect the terminal 100 to other devices for communication, or to connect a charger to charge the terminal 100 .
[0093] Although not shown, the terminal 100 may also include a flash, 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 shown in FIG1D .
[0094] Next, the product form of the server 200 in FIG1C is described;
[0095] FIG2 provides a schematic diagram of the structure of a server 200. As shown in FIG2, 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.
[0096] Bus 201 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, and control buses. For ease of illustration, FIG2 shows only one thick line, but this does not imply that there is only one bus or only one type of bus.
[0097] 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).
[0098] The memory 204 may include volatile memory, such as random access memory (RAM). The memory 204 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard drive (HDD), or solid state drive (SSD).
[0099] 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.
[0100] 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.
[0101] It should be understood that the steps related to the model reasoning process in the embodiments of this application involve AI-related operations. When performing AI operations, the instruction execution architecture of the terminal device and server is not limited to the processor-memory architecture described above. The system architecture provided in the embodiments of this application is described in detail below with reference to Figure 3.
[0102] FIG3 is a schematic diagram of the system architecture provided by an embodiment of the present application. As shown in FIG3 , the 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 .
[0103] The execution device 510 includes a calculation module 511, an I / O interface 512, a pre-processing module 513, and a post-processing module 514. The calculation module 511 may include the target model / rule 501, and the pre-processing module 513 and the post-processing module 514 are optional.
[0104] The execution device 510 may be a terminal device or a server that runs the above-mentioned image processing application.
[0105] The data acquisition device 560 is used to collect training samples. The training samples can be images and texts. After collecting the training samples, the data acquisition device 560 stores them in the database 530.
[0106] 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.
[0107] 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.
[0108] It should be noted that, in actual applications, the training samples maintained in the database 530 may not all be collected by 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.
[0109] The target model / rule 501 obtained through training with 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, an in-vehicle terminal, etc., or a server, etc.
[0110] Specifically, the training device 520 may transfer the trained model to the execution device 510 .
[0111] In Figure 3, the execution device 510 is configured with an input / output (I / O) interface 512 for data interaction with external devices. 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.
[0112] Preprocessing module 513 and preprocessing module 514 are used to preprocess the input data received by I / O interface 512. It should be understood that preprocessing module 513 and preprocessing module 514 may be absent or only one preprocessing module may be present. If preprocessing module 513 and preprocessing module 514 are absent, computing module 511 may be used directly to process the input data.
[0113] 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 in the data storage system 550.
[0114] Finally, the I / O interface 512 provides the processed results to the client device 540 and thus to the user.
[0115] In the scenario shown in FIG3 , the user can manually input data, and this "manual input data" can be operated through the interface provided by I / O interface 512. In another scenario, client device 540 can automatically send input data to I / O interface 512. If user authorization is required for client device 540 to automatically send input data, the user can set the corresponding permissions in client device 540. The user can view the results output by execution device 510 on client device 540, and the specific presentation form can be a display, sound, action, or other specific method. Client device 540 can also serve as a data acquisition terminal, collecting input data input into I / O interface 512 and output results output from I / O interface 512 as new sample data, and storing them in database 530. Of course, collection can also be performed without client device 540, and instead the I / O interface 512 directly stores the input data input into I / O interface 512 and output results output from I / O interface 512 as new sample data in database 530.
[0116] It is worth noting that FIG3 is merely a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationships between the devices, components, modules, etc. shown in the figure do not constitute any limitation. For example, in FIG3 , 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 execution device 510 can be deployed in the client device 540.
[0117] From the inference side of the model:
[0118] 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.
[0119] In an 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 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.
[0120] Specifically, the computing module 511 of the execution device 520 can be a hardware system with the function of executing instructions, 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.
[0121] 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 embodiment 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.
[0122] From the training side of the model:
[0123] 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 the embodiment of the present application.
[0124] In an 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-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 may 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.
[0125] 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 in the training device 520 that does not have the function of executing instructions, which is not limited here.
[0126] 2. Image processing cloud services provided by the server:
[0127] In a possible implementation, the server may provide image processing services to the terminal side through an application programming interface (API).
[0128] Among them, the terminal device can send relevant parameters (such as images and text) 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.
[0129] The description of the terminal and the server can be the same as that of the above embodiments, and will not be repeated here.
[0130] FIG4 shows a process of using an image processing cloud service provided by a cloud platform.
[0131] 1. Activate and purchase content review services.
[0132] 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.
[0133] 3. After the user downloads the corresponding version of the SDK to the local computer as needed, import the SDK project into the local development environment, configure and debug it in the local development environment. The local development environment can also be used to develop other functions, forming an application that integrates image processing capabilities.
[0134] 4. When image processing is needed during use, an image processing application can trigger an image processing API call. 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 includes the image, and the running instance in the cloud environment processes the image and obtains the processing result.
[0135] 5. The cloud environment returns the processing results to the application, thereby completing a method call provided in an embodiment of the present application.
[0136] 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.
[0137] (1) Neural Network
[0138] A neural network can be composed of neural units, which can be represented by x s (i.e. input data) and intercept 1 as input operation unit, the output of the operation unit can be:
[0139] 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 of 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 features of the local receptive field. The local receptive field can be an area composed of several neural units.
[0140] (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 layer. A convolution layer usually contains several feature planes, and each feature plane can be composed of some rectangularly arranged neural units. The neural units in the same feature plane share weights, and the shared weights here are convolution kernels. Shared weights can be understood as the way of extracting 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.
[0141] CNN is a very common neural network. The following details its structure, focusing on Figure 5A. As previously mentioned in the basic concepts, a convolutional neural network is a deep neural network with a convolutional structure. It is a deep learning architecture, which uses machine learning algorithms to perform multiple levels of learning at different levels of abstraction. As a deep learning architecture, a CNN is a feed-forward artificial neural network, in which individual neurons respond to input images.
[0142] As shown in FIG5A , a 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 230 .
[0143] Convolutional layer / pooling layer 220:
[0144] Convolutional layer:
[0145] As shown in FIG5A , the convolutional layer / pooling layer 220 may include layers 221-226. For example, in one implementation, layer 221 is a convolutional layer, layer 222 is a pooling layer, layer 223 is a convolutional layer, layer 224 is a pooling layer, layer 225 is a convolutional layer, and layer 226 is a pooling layer. In another implementation, layers 221 and 222 are convolutional layers, layer 223 is a pooling layer, layers 224 and 225 are convolutional layers, and layer 226 is a pooling layer. That is, the output of a convolutional layer can serve as the input of a subsequent pooling layer, or as the input of another convolutional layer to continue the convolution operation.
[0146] The following will take convolutional layer 221 as an example to introduce the internal working principle of a convolutional layer.
[0147] Convolution layer 221 can include multiple convolution operators, also known as kernels. In image processing, a convolution operator acts as a filter that extracts specific information from an input image matrix. A convolution operator is essentially a weight matrix, which is typically predefined. During the convolution operation, the weight matrix is typically applied horizontally to the input image, pixel by pixel (or two pixels by two pixels, depending on the stride), thereby extracting specific features from the image. The size of the weight matrix should be related to the image size. It is important to note that the depth dimension of the weight matrix is the same as the depth dimension of the input image. During the convolution operation, the weight matrix extends across the entire depth of the input image. Therefore, convolution with a single weight matrix produces a convolution output with a single depth dimension. However, in most cases, a single weight matrix is not used. Instead, multiple weight matrices of the same size (rows × columns) are applied, i.e., multiple homogeneous matrices. The outputs of each weight matrix are stacked to form the depth dimension of the convolved image, where the dimension is determined by the "multiple" mentioned above. Different weight matrices can be used to extract different features from an image. For example, one weight matrix can be used to extract edge information, another weight matrix can be used to extract specific colors, and yet another weight matrix can be used to blur unwanted noise in the image. The weight matrices have the same size (rows × columns), and the feature maps extracted by these weight matrices are also the same size. The extracted feature maps of the same size are then merged to form the output of the convolution operation.
[0148] 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.
[0149] 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.
[0150] Pooling layer:
[0151] Because it's often necessary to reduce the number of training parameters, pooling layers are often periodically introduced after convolutional layers. For example, in layers 221-226, as shown in the example of 220 in Figure 5A , a single convolutional layer can be followed by a pooling layer, or multiple convolutional layers can be followed by one or more pooling layers. In image processing, the sole purpose of a pooling layer is to reduce the spatial size of an image. Pooling layers can include average pooling and / or max pooling operators, which are used to downsample the input image to produce a smaller image. The average pooling operator calculates the average value of pixel values within a specific range as the average pooling result. The max pooling operator takes the pixel with the largest value within a specific range as the max pooling result. Furthermore, just as the size of the weight matrix used in the convolutional layer should be related to the image size, the operators in the pooling layer should also be related to the image size. The output image size after processing by the pooling layer can be smaller than the size of the image input to the pooling layer. Each pixel in the output image of the pooling layer represents the average or maximum value of the corresponding subregion of the image input to the pooling layer.
[0152] Fully connected layer 230:
[0153] After being processed by the convolutional layer / pooling layer 220, the convolutional neural network 200 is still insufficient to output the required output information. As previously mentioned, the convolutional layer / pooling layer 220 only extracts features and reduces 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 convolutional 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 (such as 231, 232 to 23n as shown in Figure 5A). The parameters contained in these multiple hidden layers can be pre-trained based on relevant training data for a specific task type. For example, the task type may include image recognition, image classification, image super-resolution reconstruction, etc.
[0154] 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. The output layer 240 has a loss function similar to the classification cross entropy, which 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.
[0155] It should be noted that the convolutional neural network 200 shown in Figure 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, including only a part of the network structure shown in Figure 5A. For example, the convolutional neural network used in the embodiment of the present application can only include an input layer 210, a convolution layer / pooling layer 220 and an output layer 240.
[0156] It should be noted that the convolutional neural network 100 shown in Figure 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 Figure 5B, multiple convolutional layers / pooling layers are run in parallel, and the extracted features are input into the fully connected layer 230 for processing.
[0157] (3) Deep Neural Networks
[0158] 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. Based on the position of different layers in 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 there are many DNN 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 the coefficient W, while the subscripts correspond to the third layer index 2 of the output and the second layer index 4 of the input.
[0159] In summary, the coefficient from the kth neuron in the L-1th layer to the jth neuron in the Lth layer is defined as
[0160] It's important to note that the input layer has no W parameter. In deep neural networks, more hidden layers allow the network to better capture complex real-world situations. Theoretically, a model with more parameters has higher complexity and greater "capacity," meaning it can handle more complex learning tasks. Training a deep neural network is essentially the process of learning the weight matrix, with the ultimate goal of obtaining the weight matrices for all layers of a trained deep neural network (a weight matrix formed by the vectors W across many layers).
[0161] (4) Loss function
[0162] During the training of a deep neural network, because we want the output of the deep neural network to be as close as possible to the desired predicted value, we can compare the current network's predicted value with the desired target value and then update the weight vector of each layer of the neural network based on the difference between the two. (Of course, before the first update, there is usually an initialization process, which pre-configures the parameters for each layer in the deep neural network.) For example, if the network's predicted value is too high, the weight vector is adjusted to make it predict a lower value. This adjustment is continued until the deep neural network can predict the desired target value or a value very close to the desired target value. Therefore, it is necessary to predefine "how to compare the difference between the predicted value and the target value." This is the loss function (or objective function), which is an important equation used to measure the difference between the predicted value and the target value. For example, the loss function output value (loss) indicates a greater difference, so training a deep neural network becomes a process of minimizing this loss.
[0163] (5) Backpropagation algorithm
[0164] Convolutional neural networks can use the back propagation (BP) algorithm to correct the size of the parameters in the initial super-resolution model during training, reducing the reconstruction error loss of the super-resolution model. Specifically, the forward propagation of the input signal to the output generates an error loss. This error loss information is then backpropagated to update the parameters of the initial super-resolution model, thereby converging the error loss. The BP algorithm is a backward propagation movement dominated by the error loss, aiming to obtain the optimal super-resolution model parameters, such as the weight matrix.
[0165] (6) Attention mechanism
[0166] The attention mechanism mimics the internal process of biological observation behavior, namely, a mechanism that aligns internal experience and external sensations to increase the observation precision of certain areas. It can quickly filter out high-value information from a large amount of information using limited attention resources. The attention mechanism can quickly extract important features from 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:
[0167] Here, Lx = ||Source|| represents the length of the Source. This formula implies that the elements in the Source are imagined to consist of a series of data pairs. Given a Query element in the target, the similarity or correlation between the Query and each Key is calculated to obtain the weight coefficient for each Key's corresponding Value. The weighted sum of the Values is then taken to obtain the final Attention value. Essentially, the Attention mechanism performs a weighted sum of the Values of the Source elements, with the Query and Key used to calculate the weight coefficient for 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 this important information, while ignoring the majority of less important information. This focusing process is reflected in the calculation of the weight coefficients: the larger the weight, the more focus is placed on the corresponding Value. In other words, the weight represents the importance of the information, while the Value represents the corresponding information. The self-attention mechanism can be understood as internal attention. The attention mechanism occurs between the Query element of the Target and all elements of the Source. The self-attention mechanism refers to the attention mechanism that occurs between the internal elements of the Source or 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, only the calculation object has changed.
[0168] (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.
[0169] (8) Detection data: Conventional detection data, there are multiple boxes in an image, and one box corresponds to a noun category.
[0170] 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 infallible, and there are some obvious problems in its practical application. First, we are often unable to provide some specific object categories. This is because there are many types of objects in the real world, and our knowledge base and vocabulary are limited. Second, the category tables we list are often incomplete. This problem stems more from the limitations of our knowledge acquisition and organization methods. Finally, we are unable to give specific categories based on some of the category's attributes, functions, and other knowledge. This is because current machine vision systems lack the ability to deeply understand and comprehensively apply knowledge.
[0171] However, some large language models, such as ChatGPT, and multimodal models, such as miniGPT4, already possess impressive knowledge understanding and reasoning capabilities. These models can understand and process natural human language and make meaningful inferences based on given information. However, they also have some shortcomings, such as a lack of predictive power for fine-grained tasks such as object detection.
[0172] 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.
[0173] 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.
[0174] Among them, steps 601 to 603 can be the feedforward process of the model training process, or the inference process of the model.
[0175] 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 given a user's language format input and a picture of the current scene.
[0176] During the model training process, training samples including images and object detection requests (also known as human language instructions) can be obtained.
[0177] For example, we can build a labeling pipeline based on an existing object detection dataset and language model. Through this data labeling pipeline, we construct an open-domain detection dataset based on human language instructions. In this dataset, the human language instructions are refined and divided into the following four tasks based on characteristics and requirements:
[0178] Task 1 is to detect all categories. In this task, we hope that the model can fully and thoroughly detect and determine the categories of all objects in the image after receiving user input.
[0179] Task 2 is to detect some 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.
[0180] 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 image, such as apples, oranges, etc.
[0181] 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 identify different categories of objects such as pencils, pens, and markers.
[0182] In this way, the model can better understand and execute the user's language instructions, thereby more accurately identifying and locating objects in images.
[0183] For example, referring to FIG. 7A , FIG. 7A is a diagram illustrating a natural language description of an object detection request for each task in a training sample.
[0184] 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.
[0185] 602. Process the image using 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;
[0186] In existing implementations, when performing target detection, the image encoder outputs a feature representation of the entire image. At the same time, the related training method makes the language model not have / not good at fine-grained image processing capabilities. In an embodiment of the present application, the image encoder outputs a feature representation of each of the multiple image regions in the image. Each image region can correspond to a candidate detection frame, and each detection frame 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 regions. Specifically, the feature representation of each image region and the object detection request can be input into the language model. The language model determines whether the object included in each image region 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 region when it is determined that the object included in the image region is the object to be identified indicated by the object detection request.
[0187] Using an image encoder to obtain the features of each image region and combining it with a language model for target detection can improve the processing capabilities of fine-grained features and improve the accuracy of target detection under the guidance of human language.
[0188] Next, we will introduce how to train an image encoder with the above-mentioned fine-grained processing capabilities.
[0189] In one 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, where 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 based on the first processing result and the second processing result, the image encoder and the text encoder are updated through comparative learning.
[0190] 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.
[0191] In terms of model architecture, the image encoder can use the same or similar architecture as DetCLIP. Specifically, the ATSS architecture, which is the same as the swin-T backbone, can be used. For the text encoder, the FlanT5 model family can be used, for example, running on OPT, FlanT5-base, and FlanT5-Large simultaneously.
[0192] 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, localization and captioning tasks may be used. The first stage may use the DetCLIP method to align features with text. Specifically, open vocabulary detection pre-training may be performed in the manner of DetCLIP. The detector is pre-trained by optimizing the fine contrast loss between text embedding and object-level visual embedding, as well as the center loss and bounding box regression loss. Visual-text feature alignment is performed using detection, localization 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.
[0193] For example, in the first stage, the training method of DetCLIP can be continued. Given an input image x, first pass it through the image encoder Φ i (For example, ATSS single-stage detector can be used) to obtain M RoI region features V i , i∈[1,M], calculate the center loss L corresponding to the single-stage detection model CEN (sigmoid cross entropy loss), regression loss L REG (giou loss) and alignment loss function L ALI Note that for detection or grounding data, a large resolution and a small batch size can be used for training, while for image-text data, a small resolution and a large batch size can be used for training.
[0194] 603. Process the object detection request and the multiple feature representations using a language model, and determine a region where the object to be detected is located from the multiple image regions.
[0195] 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.
[0196] In one 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 all others will be marked as other categories.
[0197] 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 the multiple image regions.
[0198] That is, the language model can determine the detection results for each image region in parallel.
[0199] After extracting object-level visual features from the image using DetCLIP, there are two ways to train the model to achieve the goals of the embodiments of the present application. The first method is to connect the object features and train the language model to predict the output of each object sequentially. 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 let the language model 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.
[0200] In one 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.
[0201] During the model training process, the language model training 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 achieve image and text understanding detection under human instructions. Specifically:
[0202] 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.
[0203] 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.
[0204] For example, given an input image x, it is first passed through the image encoder Φ i (For example, ATSS single-stage detector can be used) to obtain M object-level visual features V i , i∈[1,M], in order to achieve cross-modal fusion, a randomly initialized cross-attention layer is inserted into the decoder layer of the language model and trained from scratch. For each RoI feature and input text T from the visual part, the operation on each block of the LLM layer is: L+1 =FF[tanh(α)×X Attn(Attn(h L ), V)+Attn(h L )];
[0205] Where FF, XAttn, and Attn refer to the feed forward network, cross attention layer, and self-attention layer, respectively. hL is the input text feature corresponding to the Lth block, and a is a learnable parameter initialized to 0.
[0206] Finally, the language modeling loss that optimizes the language model output can be formulated as follows:
[0207] Where Φ represents LLM, V i is the visual feature of the i-th object, is the text token associated with the i-th object at the t-th time step, Refers to the text token related to object i before time t.
[0208] In this application, a fine-grained object-level feature interaction module is proposed. Unlike traditional full-image feature input, the model incorporates object-level visual features, enabling the feature interaction module to learn the fusion of object and instruction features. This further optimizes the processing of fine-grained features.
[0209] Although the existing technology DetCLIP has demonstrated 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 based on 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 capabilities of images. The specific approach includes: inserting a randomly initialized cross-attention layer into 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.
[0210] Next, the beneficial effects of the embodiments of the present application are described in conjunction with specific experiments:
[0211] The effectiveness of the model and training strategy of the embodiment of the present application is demonstrated by comparing with the baseline method on the IOD-Bench dataset. Comparisons were made 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 surpassed 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 showed good performance on instructions that did not appear during training. For example, for unseen 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%.
[0212] Table 1
[0213] Leveraging the superior generative capabilities of LLM, Ins-DetCLIP, an embodiment of the present application, not only predicts category names but also generates detailed descriptions for objects of interest. Benchmarking the model on the Dense Captioning task demonstrates its superior description generation capabilities. To ensure a fair comparison, the regression head of Ins-DetCLIP was fine-tuned using box annotations from the Dense Captioning dataset. As shown in Table 2, the model in this embodiment consistently outperforms other methods and achieves state-of-the-art results.
[0214] Table 2
[0215] In terms of inference efficiency, we compared the inference efficiency of Ins-DetCLIP and the two-stage baseline in terms of frames per second (FPS). As shown in Table 3, the model of the present invention can achieve better performance and faster inference speed compared to the baseline method.
[0216] Table 3
[0217] 8 , which is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. As shown in FIG8 , a data processing device 800 provided in an embodiment of the present application includes:
[0218] An acquisition module 801 is 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;
[0219] The description of the acquisition module 801 may refer to the description of step 601 in the above embodiment, and will not be repeated here.
[0220] a processing module 802 configured to process the image using 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;
[0221] 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 the plurality of image regions.
[0222] The description of the processing module 802 may refer to the description of steps 602 and 603 in the above embodiment, and will not be repeated here.
[0223] In a possible implementation, the processing module 802 is specifically configured to:
[0224] 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;
[0225] According to the detection result, the area where the object to be detected is located is determined from the multiple image areas.
[0226] In a possible implementation, before the image is processed by the image encoder, the acquisition module 801 is further configured to:
[0227] Acquire a training sample, where the training sample includes an image sample and a corresponding text sample, where the text sample is a text description corresponding to the image sample;
[0228] The processing module 802 is further configured to: process the image sample through an image encoder to obtain a first processing result;
[0229] Processing the text sample through a text encoder to obtain a second processing result;
[0230] The image encoder and the text encoder are updated through comparative learning according to the first processing result and the second processing result.
[0231] In a possible implementation, the first processing result includes multiple detection boxes and a category of each detection box; the processing module 802 is further configured to:
[0232] The image encoder and the text encoder are updated according to the first processing result and the corresponding true value.
[0233] In one 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.
[0234] Next, an execution device provided in an embodiment of the present application is introduced. Please refer to Figure 9. Figure 9 is a structural 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 Figure 9 takes one processor as an example), 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.
[0235] 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 non-volatile random access memory (NVRAM). The memory 904 stores processor and operation instructions, executable modules, or data structures, or subsets or extended sets thereof. The operation instructions may include various operation instructions for implementing various operations.
[0236] Processor 903 controls the operation of the execution device. In specific applications, the various components of the execution device are coupled together via a bus system. In addition to a data bus, the bus system may also include a power bus, a control bus, and a status signal bus. However, for clarity, all bus systems are referred to as a bus system in the figure.
[0237] The methods disclosed in the above embodiments of the present application can be applied to or implemented by the processor 903. The processor 903 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in the processor 903 or by software instructions. The above processor 903 can be a general-purpose processor, a digital signal processor (DSP), a microprocessor, or a microcontroller, and can further include an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The processor 903 can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of the present application can be directly implemented as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in memory 904, and processor 903 reads information in memory 904 and, in conjunction with its hardware, completes the steps of the above method.
[0238] Receiver 901 can be used to receive input digital or character information and generate signal input related to executing device-related settings and function control. Transmitter 902 can be used to output digital or character information through the first interface. Transmitter 902 can also be used to send instructions to the disk pack through the first interface to modify data in the disk pack. Transmitter 902 can also include a display device such as a display screen.
[0239] The present application also provides a training device. Please refer to FIG. 10 , which is a schematic diagram of the structure of a training device provided by an embodiment of the present application. Specifically, the training device 1000 is implemented by one or more servers. The training device 1000 may vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1010 (e.g., one or more processors), a memory 1032, and one or more storage media 1030 (e.g., one or more mass storage devices) storing application programs 1042 or data 1044. The memory 1032 and storage medium 1030 may be either ephemeral or persistent storage. The program stored in the storage medium 1030 may include one or more modules (not shown), each of which may include a series of instruction operations on the training device. Furthermore, the CPU 1010 may be configured to communicate with the storage medium 1030, executing the series of instruction operations in the storage medium 1030 on the training device 1000.
[0240] 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 Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0241] 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.
[0242] An embodiment of the present application also provides a computer program product, which, when running 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.
[0243] 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.
[0244] The execution device, training device or terminal device provided in the embodiments of the present application can specifically be a chip, and the chip includes: a processing unit and a communication unit, the processing unit can be, for example, a processor, and the communication unit can be, for example, an input / output interface, a pin or a circuit, etc. The processing unit can 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 can also be a storage unit located outside the chip in the wireless access device, 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.
[0245] Specifically, see Figure 11, which is a schematic diagram of the structure of a chip provided in an embodiment of the present application. The chip can be represented as a neural network processor NPU 1100. NPU 1100 is mounted on the host CPU (host CPU) as a coprocessor and is assigned tasks by the host CPU. The core of the NPU is arithmetic circuit 1103, which is controlled by controller 1104 to extract matrix data from memory and perform multiplication operations.
[0246] In some implementations, the arithmetic circuit 1103 includes multiple processing units (PEs). In some implementations, the arithmetic circuit 1103 is a two-dimensional systolic array. The arithmetic circuit 1103 may also be a one-dimensional systolic array or other electronic circuitry capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit 1103 is a general-purpose matrix processor.
[0247] For example, assume there are input matrix A, weight matrix B, and output matrix C. The arithmetic circuit retrieves the corresponding data of matrix B from weight memory 1102 and caches it on each PE in the arithmetic circuit. The arithmetic circuit retrieves the data of matrix A from input memory 1101 and performs a matrix operation on matrix B. The partial or final matrix result is stored in accumulator 1108.
[0248] Unified memory 1106 is used to store input and output data. Weight data is directly transferred to weight memory 1102 through the Direct Memory Access Controller (DMAC) 1105. Input data is also transferred to unified memory 1106 through the DMAC.
[0249] BIU stands for Bus Interface Unit, i.e., bus interface unit 1110 , which is used for interaction between the AXI bus, DMAC, and instruction fetch buffer (IFB) 1109 .
[0250] The bus interface unit 1110 (BIU) 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.
[0251] DMAC is mainly used to move input data in the external memory DDR to the unified memory 1106 or to move weight data to the weight memory 1102 or to move input data to the input memory 1101.
[0252] The vector calculation unit 1107 includes multiple operation processing units. When necessary, it 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, and upsampling of feature planes.
[0253] In some implementations, the vector calculation unit 1107 can store the processed output vector in 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, or accumulate a vector of 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 subsequent layers in a neural network.
[0254] An instruction fetch buffer 1109 connected to the controller 1104 is used to store instructions used by the controller 1104;
[0255] 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.
[0256] The processor mentioned in any of the above places can be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the above program.
[0257] It should also be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, 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 across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the device embodiments provided in this application, the connection relationship between the modules indicates that there is a communication connection between them, which can be specifically implemented as one or more communication buses or signal lines.
[0258] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course can also be implemented by special hardware including application-specific integrated circuits, special CPUs, special memories, special components, etc. In general, all functions performed by computer programs can be easily implemented with corresponding hardware, and the specific hardware structures used to implement the same function can also be diverse, such as analog circuits, digital circuits or special circuits, etc. However, for the present application, software program implementation is a better implementation method in most cases. Based on this 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's floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., and includes a number of instructions to enable a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods described in each embodiment of the present application.
[0259] 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.
[0260] 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 can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can 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 can be transmitted from a website, a computer, a training device or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website, a computer, a training device or a data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
Claims
1. 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.
2. The method according to claim 1, characterized in that: The step of processing the object detection request and the plurality of feature representations by using 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.
3. 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.
4. The method according to claim 3, characterized in that The first processing result includes a plurality of detection frames and a category of each detection frame; the method further includes: The image encoder and the text encoder are updated according to the first processing result and the corresponding true value.
5. The method according to any one of claims 1 to 4, 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.
6. 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.
7. The device according to claim 6, characterized in that The processing module is specifically used for: 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.
8. 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.
9. The device according to claim 8, characterized in that The first processing result includes a plurality of detection frames and a category of each detection frame; the processing module is further used to: The image encoder and the text encoder are updated according to the first processing result and the corresponding true value.
10. The device according to any one of claims 6 to 9, 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.
11. A computer storage medium, characterized in that: The computer storage medium stores one or more instructions, which when executed by one or more computers cause the one or more computers to perform the operations of any one of claims 1 to 5.
12. A computer program product, characterized in that The method 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.
13. A system comprising 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; The at least one processor is configured to execute the code to perform the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Image processing method and device, readable medium and electronic equipment
CN115578570A
Data processing method and device
CN115757692A
Industrial defect detection method and device based on pre-training model and storage medium
CN116468725A
Data processing method and device
CN117251592A
Method for detecting defects in multi-scale images and computing device utilizing method
US20220198228A1
Cited By
Multi-level large model scheduling and knowledge base adaptive optimization method and system
CN120216149A
Large model data labeling method and device based on multi-candidate arbitration and storage medium
CN120411661A
Large model cooperative ANIL target identification method and system for camera icing and fogging
CN122090396A
Large model cooperative anil target identification method and system for camera icing fog
CN122090396B