# Difference between revisions of "Adacompress: Adaptive compression for online computer vision services"

(→Presented by) |
|||

Line 1: | Line 1: | ||

== Presented by == | == Presented by == | ||

− | Ahmed Salamah | + | Ahmed Hussein Salamah |

== Introduction == | == Introduction == |

## Revision as of 04:58, 20 November 2020

## Contents

## Presented by

Ahmed Hussein Salamah

## Introduction

Big data and deep learning has been merged to create the great success of artificial intelligence which increases the burden on the network's speed, computational complexity, and storage in many applications. The image Classification task is one of the most important computer vision tasks which has shown a high dependency on Deep Neural Networks to improve their performance in many applications. Recently, they tend to use different image classification models on the cloud just to share the computational power between the different users as mentioned in this paper (e.g., SenseTime, Baidu Vision and Google Vision, etc.). Most of the researchers in the literature work to improve the structure and increase the depth of DNNs to achieve better performance from the point of how the features are represented and crafted using Conventional Neural Networks (CNNs). As the most well-known image classification datasets (e.g. ImageNet) are compressed using JPEG as this compression technique is optimized for Human Visual System (HVS) but not the machines (i.e. DNNs), so to be aligned with HVS the authors have to reconfigure the JPEG while maintaining the same classification accuracy.

### Methodology

One of the major parameters that can be changed in the JPEG pipeline is the quantization table, which is the main source of artifacts to be added in the image to make it lossless compression. The authors got motivated to change the JPEG configuration to optimize the uploading rate of different cloud computer vision without considering pre-knowledge of the original model and dataset. The authors used Deep Reinforcement learning (DRL) in an online manner to choose the quantization level to upload an image to the cloud for the computer vision model and this is the only approach to design an adaptive JPEG based on RL mechanism.

The approach is designed based on an interactive training environment which represents any computer vision cloud services, then they needed a tool to evaluate and predict the performance of quantization level on an uploaded image, so they used a deep Q neural network agent. They feed the agent with a reward function which considers two optimization parameters, accuracy and image size. It works as iterative behavior interacting with the environment. The environment is exposed to different images with different virtual redundant information that needs an adaptive solution for each image to select the suitable compression level for the model. Thus, they designed an explore-exploit mechanism to train the agent on different scenery which is designed in deep Q agent as an inference-estimate-retain mechanism to control to restart the training procedure for each image. The authors verify their approach by providing some analysis and insight using Grad-Cam by showing some patterns of each image with its own corresponding quality factor. Each image shows a different response from a deep model to show that images are more sensitive to large smooth areas, while is more robust compression for images with complex textures.

### Problem Formulation

The authors formulate the problem by referring to the cloud deep learning service as [math] \vec{y}_i = M(x_i)[/math] to predict results list [math] \vec{y}_i [/math] for an input image [math] x_i [/math], and for reference input [math] x \in X_{\rm ref} [/math] the output is [math] \vec{y}_{\rm ref} = M(x_{\rm ref}) [/math]. It is referred [math] \vec{y}_{\rm ref} [/math] as the ground truth label and also [math] \vec{y}_c = M(x_c) [/math] for compressed image [math] x_{c} [/math] with quality factor [math] c [/math].

\begin{align} \tag{1} \label{eq:accuracy}
\mathcal{A} =& \sum_{k}\min_jd(l_j, g_k) \\
& l_j \in \vec{y}_c, \quad j=1,...,5 \nonumber \\
& g_k \in \vec{y}_{\rm ref}, \quad k=1, ..., {\rm length}(\vec{y}_{\rm ref}) \nonumber \\
& d(x, y) = 1 \ \text{if} \ x=y \ \text{else} \ 0 \nonumber
\end{align}

The authors divided the used datasets according to their contextual group [math] X [/math] according to [*] and they compare their results using compression ratio [math] \Delta s = \frac{s_c}{s_{\rm ref}} [/math], where [math]s_{c}[/math] is the compressed size and [math]s_{\rm ref}[/math] is the original size, and accuracy metric [math] \mathcal{A}_c [/math] which is calculated based on the hamming distance of Top-5 of the output of softmax probabilities for both original and compressed images as shown in Eq. \eqref{eq:accuracy}. In the RL designing stage, continuous numerical vectors are represented as the input features to the DRL agent which is Deep Q Network (DQN). The challenges of using this approach are: (1) the state space of RL is too large to cover, so it should have more layers and nodes to the neural network which make the DRL agent hard to converge and time-consuming during training; (2) The DRL always start with the random initial state that should start to converge to high reward so it will start the train of the DQN. The authors solve this problem by using a pre-trained small model called MobileNetV2 as a feature extractor [math] \mathcal{E} [/math] for its ability in lightweight and image classification, and it is fixed during training the Q Network [math] \phi [/math]. The last convolution layer of [math] \mathcal{E} [/math] is connected as an input to the Q Network [math]\phi [/math], so by optimizing the parameters of Q network [math] \phi [/math], the RL agent's policy is updated.

## Reinforcement learning framework

## Conclusion

Most of the research focused on modifying the deep learning model instead of deal with the currently available approaches. The authors succeed in defined the compression level for each uploaded image to decrease the size and maintain the top-5 accuracy in a robust manner even the scenery is changed. In my opinion, Eq. \eqref{eq:accuracy} is not defined well as I found it does not really affect the reward function. Also, they did not use the whole validation set from ImageNet which highlights the question of what is the higher file size that they considered from in the mention current set. In addition, if they considered the whole data set, should we expect the same performance for the mechanism.

## Critiques

The authors used a pre-trained model as a feature extractor to select a Quality Factor (QF) for the JPEG. I think what would be missing that they did not report the distribution of each of their span of QFs as it is important to understand which one is expected to contribute more. In my video, I have done one experiment using Inception-V3 to understand if it is possible to get better accuracy. I found that it is possible by using the inception model as a pre-trained model to choose a lower QF, but as well known that the mobile models are shallower than the inception models which make it less complex to run on edge devices. I think it is possible to achieve at least the same accuracy or even more if we replaced the mobile model with the inception. Another point, the authors did not run their approach on a complete database like ImageNet, they only included a part of two different datasets. I know they might have limitations in the available datasets to test like CIFARs, as they are not totally comparable from the resolution perspective for the real online computer vision services work with higher resolutions.