Inference device, inference method, and inference program
By converting image data to DCT format and bypassing the decoding process, the inference device reduces processing load and resource constraints in two-layer inference systems, enhancing real-time performance in video AI applications.
Patent Information
- Application Number
- PCT/JP2023/014626
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-04-10
- Publication Date
- 2024-10-17
AI Technical Summary
Conventional two-layer inference systems face significant processing load and resource constraints due to the need for decoding RAW data twice, which becomes a bottleneck in video AI systems using Deep Neural Networks (DNNs).
An inference device that acquires and converts image data into JPEG format, then into DCT format, omitting the decoding process by supplying DCT format data directly to the first-layer model, reducing computational resources and processing load.
This approach reduces the overall processing load and resource usage, improving real-time inference performance on IoT devices by minimizing decoding processing and enhancing computational efficiency.
Smart Images

Figure JP2023014626_17102024_PF_FP_ABST
Abstract
Description
Inference device, inference method, and inference program
[0001] The present invention relates to an inference device, an inference method, and an inference program.
[0002] The widespread use of IoT (Internet of Things) devices and the development of deep learning have created a demand for real-time inference. While it is desirable to perform inference in real-time on IoT devices, due to significant resource constraints, a two-tier inference method has been proposed that assumes collaboration between IoT devices and the cloud (see Non-Patent Document 1).
[0003] In two-layer inference, low-load inference is performed using a lightweight first-layer model on the edge, and inference is performed using a higher-performance, higher-quality second-layer model on the cloud side, at a reduced frequency, only when deemed necessary. A video AI system using two-layer inference uses a combination of multiple DNN (Deep Neural Network) models.
[0004] Daniel Kang, Ankit Mathur, Teja Veeramacheneni, Peter Bailis, Matei Zaharia, “Jointly Optimizing Preprocessing and Inference for DNN-based Visual Analytics”, Stanford DAWN Project
[0005] However, according to conventional techniques, it is difficult to reduce the processing load in a system using two-layer inference. For example, a video AI system using two-layer inference generally uses raw video / image data as input for DNN inference, which requires a relatively heavy decoding process before inference. In particular, in two-layer inference, communication is sandwiched between the two layers, so considering the encoding during inter-layer communication, decoding must be performed twice, which may cause a bottleneck.
[0006] The present invention has been made in view of the above, and has as its object to reduce the processing load in a system using two-layer inference.
[0007] In order to solve the above-mentioned problems and achieve the object, the inference device of the present invention is characterized by having an acquisition unit that acquires JPEG format image data to be processed, a conversion unit that converts the image data into DCT format, and a supply unit that supplies the converted DCT format image data as input to a model that outputs specified features.
[0008] According to the present invention, in a system using two-layer inference, it is possible to reduce the computational resources and the processing load.
[0009] FIG. 1 is a diagram for explaining an overview of the inference device of this embodiment. FIG. 2 is a diagram for explaining an overview of the inference device of this embodiment. FIG. 3 is a diagram for explaining an overview of the inference device of this embodiment. FIG. 4 is a schematic diagram illustrating a general configuration of an inference system including the inference device of this embodiment. FIG. 5 is a diagram for explaining inference processing. FIG. 6 is a flowchart showing the inference processing procedure. FIG. 7 is a diagram for explaining the background of the inference processing. FIG. 8 is a diagram for explaining the background of the inference processing. FIG. 9 is a diagram for explaining the background of the inference processing. FIG. 10 is a diagram for explaining the effect of the inference processing. FIG. 11 is a diagram for explaining the effect of the inference processing. FIG. 12 is a diagram for explaining the effect of the inference processing. FIG. 13 is a diagram showing an example of a computer that executes an inference program.
[0010] Hereinafter, an embodiment of the present invention will be described in detail with reference to the drawings. Note that the present invention is not limited to this embodiment. In addition, in the description of the drawings, the same parts are designated by the same reference numerals.
[0011] [Outline of Inference Device] Figures 1 to 3 are diagrams for explaining an outline of the inference device of this embodiment. First, Figure 1 illustrates an example of a processing procedure for conventional two-layer inference. As illustrated in Figure 1, conventionally, video data in H.264 / H.265 / MJPEG format or the like input to a video AI system is converted to JPEG, decoded and converted to RGB format RAW data, undergoes preprocessing such as resizing, and is input to the first layer DNN1.
[0012] The inference device then transmits the filtered image (RAW data in RGB format) to the second-layer DNN 2 on the cloud side at the downstream stage. At this time, in order to reduce communication volume, the RAW data is re-encoded as a time-series image such as JPEG or video such as H.264 / H.265 / MJPEG.
[0013] Then, on the cloud side, the data is decoded again and converted into RGB format raw data, and after preprocessing such as resizing, it is input to the second-layer DNN 2. In this way, conventional two-layer inference requires two decoding processes before inference.
[0014] Here, the decoding process refers to the process of restoring compressed image data in JPEG format to RGB. The arrows in Figure 2 indicate the procedure of the encoding process, which is the reverse of the decoding process, and the process of following the arrows in the opposite direction is the decoding process.
[0015] That is, the encoding process first converts the image from its RGB representation to the YCbCr color space, where Y represents luminance or brightness, Cb represents the hue and saturation of blue-based colors, and Cr represents the hue and saturation of red-based colors. The Cb and Cr channels are then downsampled by a predetermined factor (usually 2 or 3), a lossy compression process, reducing the amount of data to two-thirds of the RGB equivalent.
[0016] Next, each YCbCr channel is divided into an 8x8 block and subjected to a Discrete Cosine Transform (DCT), a reversible transformation to frequency space similar to the Fourier transform, which converts the 8x8 spatial block into 64 channels.
[0017] The DCT coefficients are then quantized, a lossy transformation that is carefully designed to compress the DCT coefficients. This quantization is controlled by the JPEG quality parameter, with lower quality settings resulting in more compression and smaller files. The quantized integer DCT coefficients are then compressed using a variant of Huffman encoding.
[0018] Here, the preprocessing and DNN inference (DNN1, DNN2) illustrated in FIG. 1 can be executed by a graphics processing unit (GPU), but the decoding process is executed by a central processing unit (CPU), which often becomes a bottleneck in the inference process. That is, the decoding process may increase latency and require more computational resources. It is important to reduce the decoding process, especially at the edge where computational resources are limited.
[0019] Therefore, in the inference device of this embodiment, most of the decoding process is omitted, as illustrated in Figure 3(b). Specifically, in the inference device, by inputting JPEG data in DCT representation into the first-layer DNN1', the YCbCr conversion and RGB conversion processes of the conventional decoding process illustrated in Figure 3(a) are omitted. In this way, by omitting the decoding process, the inference device can reduce the overall processing load and achieve a reduction in the amount of resources required.
[0020] [Configuration of Inference Device] FIG. 4 is a schematic diagram illustrating the general configuration of an inference system including an inference device according to this embodiment. FIG. 5 is a diagram illustrating inference processing. In this embodiment, an inference system 1 performing two-layer inference is composed of a first-stage inference device (inference device) 10 that performs a first-layer inference and a second-stage inference device 20 that performs a second-layer inference. For example, the first-stage inference device 10 is implemented in an edge device, and the second-stage inference device 20 is implemented in the cloud. Alternatively, both the first-stage inference device 10 and the second-stage inference device 20 may be implemented in the cloud. As illustrated in FIG. 4, the first-stage inference device 10, which is the inference device according to this embodiment, is realized by a general-purpose computer such as a personal computer, and includes an input unit 11, an output unit 12, a communication control unit 13, a storage unit 14, and a control unit 15.
[0021] The input unit 11 is realized using input devices such as a keyboard and a mouse, and inputs various instruction information such as a command to start processing to the control unit 15 in response to input operations by an operator. The output unit 12 is realized by a display device such as a liquid crystal display, a printing device such as a printer, etc. For example, the output unit 12 displays the results of the inference processing described below.
[0022] The communication control unit 13 is realized by a NIC (Network Interface Card) or the like, and controls communication between the control unit 15 and external devices via telecommunication lines such as a LAN (Local Area Network) or the Internet. For example, the communication control unit 13 controls communication between the control unit 15 and a management device that manages data and various information to be processed in the inference process described below, and devices that constitute the subsequent-stage inference device 20.
[0023] The storage unit 14 is realized by a semiconductor memory element such as RAM (Random Access Memory) or flash memory, or a storage device such as a hard disk or optical disk. The storage unit 14 stores in advance the processing program that operates the pre-stage inference device 10, data used during execution of the processing program, etc., or stores them temporarily each time processing is performed. The storage unit 14 may be configured to communicate with the control unit 15 via the communication control unit 13.
[0024] In this embodiment, the storage unit 14 stores a first layer model (DNN1) 14a used in the inference process described below.
[0025] Here, the first-layer model 14a is, for example, a lightweight object detection DNN, while the second-layer model 24a arranged in the subsequent-stage inference device 20 is, for example, a high-precision object detection DNN.
[0026] The control unit 15 is realized using a CPU, GPU, NP (Network Processor), FPGA (Field Programmable Gate Array), etc., and executes a processing program stored in memory. As a result, the control unit 15 functions as an acquisition unit 15a, a conversion unit 15b, a supply unit 15c, and a transfer unit 15d, as illustrated in FIG. 4, to execute the inference process. Note that these functional units may be implemented individually or in part in different hardware. The control unit 15 may also include other functional units.
[0027] The acquisition unit 15a acquires image data in JPEG format to be processed. Specifically, as illustrated in Fig. 5, the acquisition unit 15a may acquire video data in MJPEG format to be processed and convert the video data into a time series of image data in JPEG format.
[0028] Here, MJPEG format video data contains consecutive JPEG format data, making it easy to convert to JPEG. Furthermore, the cost of converting MJPEG format video data to JPEG is lower than that of H264 / H265 format video data, making it advantageous for expected future broadband communications.
[0029] That is, H.264 / H.265, MJPEG, etc. are used to encode video data. Although H.264 / H.265 has better compression efficiency than MJPEG, RAW data for each frame is required for inference, and extracting this data incurs a large processing cost. On the other hand, while MJPEG does not have very good compression efficiency, the processing cost required to extract frame data (more precisely, JPEG data for each frame) is very small. For this reason, when the communication bandwidth is relatively wide, MJPEG is considered to be advantageous for video inference.
[0030] The converter 15b converts the image data into DCT format. For example, as shown in Fig. 5, the converter 15b decodes the Huffman coding from the acquired image and converts it into a DCT representation, which is a frequency band.
[0031] The supply unit 15c supplies the converted DCT format image data as input to the first-layer model (DNN1) 14a, which outputs either an inference result or a predetermined feature. Specifically, as shown in Fig. 5, the supply unit 15c inputs the DCT representation data (≠RGB) as it is to the first-layer model (DNN1) 14a, which can be inferred.
[0032] In this way, by using DCT format image data instead of RGB format data, the front-stage inference device 10 is able to execute DNN inference quickly and efficiently. In other words, the front-stage inference device 10 does not need to decode JPEG format data, i.e., convert it to RAW data, and the amount of calculation is reduced. This allows for smaller calculation resources, improving the capacity at edge locations such as station buildings and enabling power consumption to be reduced.
[0033] The transfer unit 15d transfers image data selected from the acquired image data based on the first-layer inference result as input to the second-layer model 24a. For example, as illustrated in FIG. 5, the transfer unit 15d filters images to be sent to the second-layer inference in the subsequent stage. The transfer unit 15d then transfers JPEG image data extracted from the MJPEG video data or input JPEG image data to the subsequent-stage inference device 20 as input to the second-layer model (DNN2) 24a. In this case, JPEG encoding is not required in the previous-stage inference device 10, making it possible to reduce the processing volume of the entire system compared to conventional methods.
[0034] Alternatively, the transfer unit 15d transfers the DCT representation data as input to the second-layer model (DNN2) 24a to the subsequent-stage inference device 20 without encoding it. This also makes it possible to reduce the amount of processing in the entire system.
[0035] The transfer unit 15d further transfers the results of the feature quantities and the like output by the first-layer model 14a to the subsequent-stage inference device 20 without encoding them. This also makes it possible to reduce the amount of processing in the entire system.
[0036] [Inference Processing] Next, the inference processing by the front-stage inference device 10 according to this embodiment will be described with reference to Fig. 6. Fig. 6 is a flowchart showing the procedure of the inference processing. The flowchart of the inference processing illustrated in Fig. 6 starts, for example, when the user performs an operation input to instruct the start of the inference processing.
[0037] First, the acquisition unit 15a acquires MJPEG format video data to be processed (step S1), and converts the video data into JPEG format image data (step S2).
[0038] Next, the conversion unit 15b converts the image data into DCT format (step S3). For example, the conversion unit 15b decodes the Huffman coding from the acquired image and converts it into a DCT representation that is a frequency band.
[0039] The supply unit 15c then supplies the converted DCT image data as input to the first-layer model (DNN1) 14a, which outputs predetermined features (step S4). Specifically, the supply unit 15c inputs the DCT representation data (≠RGB format) directly to the DNN1, which is capable of inference. The DNN1 then outputs the inference result or the predetermined features (step S5).
[0040] Thereafter, if the result of filtering based on the inference result of the first-layer model 14a or inference in the second-layer model 24a is required (step S6, Yes), the transfer unit 15d transfers image data selected from the acquired image data as input to the second-layer model 24a (step S7). The transfer unit 15d further transfers the results, such as feature quantities, output by the first-layer model 14a to the subsequent-stage inference device 20 without encoding. This completes the series of inference processes.
[0041] On the other hand, if second-layer inference is not required (step S6, No), the transfer unit 15d does not send the image data to the second-layer model 24a (step S8), and ends the series of inference processes.
[0042] [Effects] As described above, in the first-stage inference device 10 of this embodiment, the acquisition unit 15a acquires JPEG-format image data to be processed. The conversion unit 15b converts the image data into DCT format. The supply unit 15c supplies the converted DCT-format image data as input to the first-layer model 14a, which outputs either an inference result or predetermined features.
[0043] Specifically, the acquisition unit 15a may further acquire MJPEG format video data to be processed and convert the video data into a time series of JPEG format image data.
[0044] In this way, the front-stage inference device 10 uses DCT-format image data instead of RGB-format data, enabling high-speed and high-efficiency DNN inference. In other words, the front-stage inference device 10 does not require decoding JPEG-format data, i.e., converting it to RAW data, and the decoding process can be omitted, reducing the amount of calculations. This allows for smaller computational resources, improving the capacity at edge locations such as station buildings and enabling reduced power consumption. In this way, the inference device enables reduced computational resources and reduced processing load in a system that performs two-layer inference.
[0045] The transfer unit 15d also transfers image data selected from the acquired image data to the second-layer model 24a. In this case, the transfer unit 15d may also transfer either the inference result or a predetermined feature value output by the first-layer model 14a.
[0046] This eliminates the need for encoding when transmitting to the second-layer model 24a, reducing the decoding processing load on the subsequent-stage inference device 20 that has the second-layer model 24a. Therefore, compared to conventional H264 / H265 video data, it is possible to reduce the processing load on the entire video AI system that uses two-layer inference.
[0047] 7 to 9 are diagrams for explaining the background of the inference process. With the development of deep learning and the spread of IoT devices, various applications have emerged, such as automatic analysis of surveillance camera footage as shown in FIG. 7, as well as autonomous driving and smart speakers. These applications require real-time inference. It is desirable to perform inference that ensures real-time performance on IoT devices. However, IoT devices have significant resource constraints, making it difficult to deploy highly accurate DNN models.
[0048] Therefore, to achieve both accuracy and real-time performance, a two-layer inference method has been proposed that assumes cooperation between IoT devices and the cloud. In two-layer inference, low-load inference is performed on the IoT device side, and advanced inference is performed on the cloud side, as shown in Fig. 8.
[0049] Specifically, as shown in FIG. 9, the output results of the confidence level and the like from the light model in the first layer are referenced, and inference using the model in the second layer is performed only when it is determined that inference is necessary. This reduces the frequency of inference and improves the performance of the entire system. In the example shown in FIG. 9(a), whether inference using the second layer model is necessary is determined using a lower threshold. In the example shown in FIG. 9(b), whether light inference using the first layer model alone is sufficient is determined using an upper threshold.
[0050] As shown in Figure 8, in two-layer inference, the IoT device is limited by computational resources and power consumption, and only minor processing is possible. In contrast, the cloud performs highly accurate DNN inference and returns inference results to the user, resulting in increased latency. Furthermore, communication costs increase due to the transfer of inference data between the IoT device and the cloud. Therefore, applying the inference processing of the above embodiment effectively reduces the processing load of the entire system.
[0051] 10 to 12 are diagrams illustrating the effects of the inference process. First, FIG. 10 illustrates a comparison between DNN inference using RGB format data and DNN inference using JPEG DCT format data. Specifically, as shown in FIG. 10( a), an FBS (Frequency Band Selection) method is illustrated, which selects the most relevant DCT coefficients as a frequency band. In this case, as shown in FIG. 10( b), it can be seen that the amount of DNN calculations can be reduced by approximately 18% when using DCT format data compared to RGB format data.
[0052] FIG. 11 also illustrates a comparison of image loading times between DCT format data and RGB format data. In the example shown in FIG. 11, the image was previously subjected to 4:2:0 chroma subsampling and resized to 224 x 224. The time from image loading to transfer to GPU memory was then measured. An Inter Xeon Gold 6246 with two cores was used, with a batch size of 100, and the DataLoader of Pytorch, an open-source machine learning library, was utilized to transfer 50,000 images. In this case, as illustrated in FIG. 11, it can be seen that the transfer time of DCT format image data is significantly reduced compared to RGB format image data.
[0053] 12 illustrates an example of a video AI system to which the first-stage inference device 10 of the above embodiment can be applied. In other words, in the video AI system illustrated in FIG. 12, analysis of multiple cameras is performed at the edge, and the narrowed-down data is collected in a fog environment, such as a central office connected via a closed network, where a DNN1, which is a first-layer model 14a, is executed. Some of the data is collected in a cloud or the like, where a DNN2, which is a second-layer model 24a, is executed. The first-layer DNN1 in this second-layer edge can be applied to the first-layer DNN1. In this way, even if there are constraints on the edge's capacity, power, and other computing resources, the system can be implemented with a reduced decoding load.
[0054] [Program] A program describing the processing executed by the first-stage inference device 10 according to the above embodiment in a computer-executable language can also be created. In one embodiment, the first-stage inference device 10 can be implemented by installing an inference program that executes the above inference processing as package software or online software on a desired computer. For example, by executing the above inference program on an information processing device, the information processing device can function as the first-stage inference device 10. The information processing device referred to here includes desktop and notebook personal computers. Other examples of information processing devices also include mobile communication terminals such as smartphones, mobile phones, and PHS (Personal Handyphone Systems), as well as slate terminals such as PDAs (Personal Digital Assistants). The functions of the first-stage inference device 10 may also be implemented on a cloud server.
[0055] 13 is a diagram showing an example of a computer that executes an inference program. The computer 1000 includes, for example, a memory 1010, a CPU 1020, a hard disk drive interface 1030, a disk drive interface 1040, a serial port interface 1050, a video adapter 1060, and a network interface 1070. These components are connected by a bus 1080.
[0056] The memory 1010 includes a ROM (Read Only Memory) 1011 and a RAM 1012. The ROM 1011 stores a boot program such as a BIOS (Basic Input Output System). The hard disk drive interface 1030 is connected to a hard disk drive 1031. The disk drive interface 1040 is connected to a disk drive 1041. A removable storage medium such as a magnetic disk or optical disk is inserted into the disk drive 1041. The serial port interface 1050 is connected to a mouse 1051 and a keyboard 1052, for example. The video adapter 1060 is connected to a display 1061, for example.
[0057] Here, the hard disk drive 1031 stores, for example, an OS (Operating System) 1091, an application program 1092, a program module 1093, and program data 1094. The various pieces of information described in the above embodiments are stored in the hard disk drive 1031 or the memory 1010, for example.
[0058] The inference program is stored in the hard disk drive 1031, for example, as a program module 1093 in which instructions to be executed by the computer 1000 are written. Specifically, the hard disk drive 1031 stores the program module 1093 in which each process executed by the pre-stage inference device 10 described in the above embodiment is written.
[0059] Furthermore, data used for information processing by the inference program is stored as program data 1094, for example, in the hard disk drive 1031. Then, the CPU 1020 reads the program module 1093 and the program data 1094 stored in the hard disk drive 1031 into the RAM 1012 as necessary, and executes each of the above-described procedures.
[0060] The program module 1093 and program data 1094 related to the inference program are not limited to being stored in the hard disk drive 1031, but may be stored in a removable storage medium, for example, and read by the CPU 1020 via the disk drive 1041. Alternatively, the program module 1093 and program data 1094 related to the inference program may be stored in another computer connected via a network such as a LAN or a WAN (Wide Area Network), and read by the CPU 1020 via the network interface 1070.
[0061] Although the present invention has been described above as an embodiment, the present invention is not limited to the description and drawings that form part of the disclosure of the present invention. In other words, other embodiments, examples, and operational techniques that can be made by those skilled in the art based on the present invention are all included in the scope of the present invention.
[0062] REFERENCE NUMERALS 1 Inference system 10 First-stage inference device 11 Input unit 12 Output unit 13 Communication control unit 14 Memory unit 14a First-layer model (DNN1) 15 Control unit 15a Acquisition unit 15b Conversion unit 15c Supply unit 15d Transfer unit 20 Second-stage inference device 24a Second-layer model (DNN2)
Claims
1. An inference device comprising: an acquisition unit that acquires JPEG format image data to be processed; a conversion unit that converts the image data into DCT format; and a supply unit that supplies the converted DCT format image data as input to a model that outputs either an inference result or a specified feature.
2. The inference device according to claim 1, wherein said acquisition unit further acquires MJPEG format video data to be processed and converts the video data into JPEG format image data.
3. The inference device according to claim 1, further comprising a transfer unit that transfers image data selected from the acquired image data as an input to a second model.
4. The inference device according to claim 3, wherein the transfer unit further transfers either the inference result or a predetermined feature quantity output by the model.
5. An inference method executed by an inference device, comprising: an acquisition step of acquiring JPEG format image data to be processed; a conversion step of converting the image data into DCT format; and a supply step of supplying the converted DCT format image data as input to a model that outputs either an inference result or a specified feature.
6. An inference program for causing a computer to execute the following steps: an acquisition step of acquiring image data in JPEG format to be processed; a conversion step of converting the image data into DCT format; and a supply step of supplying the converted image data in DCT format as input to a model that outputs either an inference result or a specified feature.
Citation Information
Patent Citations
Data preprocessing and data augmentation in frequency domain
US20210203992A1
Processing system and processing method
WO2021255803A1
