YOLOv7
Abstract
~ 대충 다른 모델보다 성능이 좋다는 내용 ~
1. Introduction
In addition to architecture optimization, our proposed methods will focus on the optimization of the training process. Our focus will be on some optomized modules and optimization methods which may strengthen the training cost for improving the accuracy of object detection, but without increasing the inference cost. We call the proposed modules and optimization methods trainable bag-of-freebies.
> 우리는 구조적 최적화 뿐만 아니라 훈련 과정의 최적화에도 신경을 썼다.
> 이로써 object detection의 성능 향상을 시키면서도, inference에 필요한 비용은 늘리지 않는다.
> 우리는 이를 trainable bag of freebies라고 부른다.
For model re-parameterization, we analyze the model re-parameterization strategies applicable to layers in different networks with the concept of graident propagation path, and propose planned re-parameterized model. In addition, when we discover that with dynamic label assignment technology, the training of model with multiple output layers will generate new issues. That is: "How to assign dynamic targets for the outputs of different branches?" For this problem, we propose a new label assignment method called coarse-to-fine lead guided label assignment.
> 모델 re-parameterization에 대해서는, gradient propagation path 개념과 함께 다른 모델들에 적용 가능한 전략들에 대해서 생각해보았다.
> 또한 dynamic label assignment 기술이 output layer 가 여러개인 경우에 문제를 발생시킬 것이라는 것을 발견했다.
> 이 솔루션은 coarse-to-fine lead guided label assignment라고 부른다.
Contributions:
(1) we design several trainable bag-of-freebies methods, so that real time object detection can greatly improve the detection accuracy without increasing the inference cost
(2) we found 2 new issues, namely how re-parameterized medule replaces original module, and how dynamic label assignment strategy deals with assignment to different output layers. We also propose methods to address the difficulties arising from these issues.
(3) we propose 'extend' and 'compound scaling' methods for the real-time object detector that can effectively utilize parameters and computation
(4) the method we proposed can effectively reduce about 40% parameters and 50% computation of state of the art real time object detector, and has faster inference speed and higher detection accuracy
> 훈련 가능한 bag-of-freebies를 디자인 하였다.
> re-parameterization과 dynamic label assignment 전략들로부터 발생하는 어려움을 해결하기 위한 방법들을 제안한다
> 효과적으로 parameter와 computation을 사용할 수 있는 'extend'와 'compound scaling' 방법들을 제안한다
> SOTA real time object detector의 40% parameter, 50% computation읠 효과적으로 줄일 수 있는 방법과 inference 속도를 더 빠르고, detection 정확도가 더 높은 방법을 제안한다
2. Related Work
2-1. Real-time object detectors
Being able to become a state-of-the-art real-time object detector usually requires the following characteristics: ... (4) a more robust loss functions; (5) a more efficient label assignment method; (6) a more efficient training method. ... we will design new trainable bag of freebies method for the issues derived from the state of the art methods associated with (4), (5), and (6) mentioned above.
> SOTA real-time object detector가 되기 위한 6가지 중에 3가지는 (4) 강인한 loss function, (5) 효율적인 label assignment 방법, (6) 더 효율적인 훈련 방법이다. 우리가 디자인한 새로운 훈련 가능한 bag of freebies 방법은 4-6번에 해당한다.
2-2. Model re-parameterization
The model re-parameterization technique can be regarded as an ensemble technique, and we can divide it into two categories, module level ensemble and model level ensemble.
model level -
There are two common practices for model-level re-parameterization to obtain the final inference model. One is to train multiple identical models with different training data, and then average the weights of multiple trained models. The other is to perform a weighted average of the weights of models at different iteration number.
module-level -
Module-level re-parameterization is a more popular research issue recently. This type of method splits a module into multiple identical or different module branches during training and integrates multiple branched modules into a completely equivalent module during inference.
However, not all proposed re-parameterized module can be perfectly applied to different architectures. we have developed new re-parameterization module and designed related application strategies for various architectures.
> model re-parameterization technique은 ensemble technique이라고 볼 수 있다. module level과 model level의 ensemble으로 나눠서 볼 수 있다.
> model level의 ensemble은 또 두 가지로 나뉘는데, 첫번째는 여러 개의 같은 모델을 다른 훈련 데이터로 훈련 시키고 그 훈련된 데이터들의 가중치를 평균내는 것이다. 두번째는 그 모델들의 iteration number에 따라 가중치를 주어 평균을 내는 것이다.
> module level의 ensemble은 좀 더 인기있는 방법이다. module을 훈련 중에 동일한, 혹은 다른 module branch로 나누고, inference시에 한 module로 합치는 방법이다.
> 그러나 이런 방법들은 모든 구조에 적용될 수 있는 방법들은 아니다. 우리는 다양한 구조에 적용될 수 있는 새로운 re-parameterization 방법을 디자인하였다.
2-3. Model scaling
Model scaling is a way to scale up or down an already designed model and make it fit in different computing devices. The model scaling method usually uses different scaling factors, such as resolution(size of input image), depth(number of layer), width(number of channel), and stage(number of feature pyramid), so as to achieve a good trade-off for the amount of network parameters, computation, inference speed, and accuracy.
Network architecture search(NAS) is one of the commonly used model scaling methods.
...
Checking the literature, we found that almost all model scaling methods analyze individual scaling factor independently, and even the methods in the compound scaling category also optimized scaling factor independently. The reason for this is because most popular NAS architectures deal with scaling factors that are not very correlated.
> Model scaling이란 computing 장치에 모델이 적합할 수 있도록 스케일을 키우거나 작게하는 것을 의미한다.
> Scaling factors에는 해상도(input image size), 깊이(layer의 수), 너비(channel의 수), stage(feature pyramid의 수)가 있고, 이는 모두 네트워크의 parameter, computation, inference 속도, 정확도와 좋은 trade-off 관계를 유지하기 위해 조절된다.
> NAS는 model scaling 중 잘 사용되는 방법 중 하나이다.
> 우리는 논문을 확인해본 결과, model scaling 방법들은 scaling factor을 독립적으로 분석하며, 복합 scaling factor 조차도 독립적으로 최적화되는 것을 알아냈다. 이는 NAS 논문들의 scaling factor들이 별로 관련이 없는 것들이기 때문이기 때문이다.
3. Architecture
3-1. Extended efficient layer aggregation networks
In most of the literature on designing the efficient architectures, ...
Starting from the characteristics of memory access cost, Ma et al. also analyzed the influence of the input/output channel ratio, the number of branches of the architecture, and the element-wise operation on the network inference speed. Dollar et al. additionally considered activation when performing model scaling.
The architecture of CSPVoVNet also analyzes the gradient path, in order to enable the weights of different layers to learn more diverse features.
ELAN considers the following design strategy - "How to design an efficient network?", They came out with a conclusion: By controlling the shortest longest gradient path, a deeper network can learn and converge effectively. We propose Extended-ELAN(E-ELAN) based on ELAN.
> Ma et al은 메모리 접근 비용 특징, 입출력 채널 비율의 영향, 구조의 브랜치의 개수, 그리고 inference 시 요소별 계산 속도에 대해 분석했다.
> Dollar et al은 model scaling시 activation을 고려했다.
> CSPVoVNet의 구조는 다양한 layer들이 더 다양한 feature를 배우게 하기 위해 gradient path를 분석하였다.
> ELAN은 "어떻게하면 효율적인 네트워크를 디자인할까"라는 질문을 고민한 결과이다. 그 결과, 가장 짧고도 긴 gradient path를 통제함으로써 더 깊은 네트워크가 배우고 효율적으로 converge 할수 있게되었다.
> 우리는 Extended ELAN을 제안한다.
E-ELAN uses expand, shuffle, merge cardinality to achieve the ability to continuously enhance the learning ability of the network without destroying the original gradient path. E-ELAN only changes the architecture in computational block, while the architecture of trasition layer is completely unchanged. Our strategy is to use group convolution to expand the channel and cardinality of computational blocks. We will apply the same group parameter and channel multiplier to all the computational blocks of a computational layer. Then, the feature map calculated by each compuatational block will be shuffled into g groups according to the set group parameter g, and then concatenate them together. At this time, the number of channels in each group of feature map will be the same as the number of channels in the original architecture. ...
Finally, we add g groups of feature maps to perform merge cardinality. E-ELAN can also guide different groups of computational blocks to learn more diverse features.
> E-ELAN은 기존의 gradient path를 손상시키지 않고 지속적으로 배우는 능력을 발전시키기 위해 expand, shuffle, merge cardinality(숫자?)를 사용한다.
> E-ELAN은 computational block에서만 바뀌고, transition layer의 구조는 전혀 바뀌지 않는다. 우리는 group convolution을 사용해서 채널과 computational block의 수를 늘렸다. 우리는 동일한 group parameter과 channel multiplier를 computational layer의 모든 computational block에 적용한다.
> 각 computational block으로 계산된 feature map은 group parameter g 에 따라 g group에 섞이고, 연결된다. 각 feature map 그룹의 채널 수는 원래 구조의 채널수와 같다. 마지막으로 우리는 merge cardlinality를 위해 g group의 feature map을 더한다.
> 또한 E-ELAN은 더 다양한 feature를 학습하기 위해 다양한 computational block을 유도할 수 있다.
3-2. Model scaling for concatenation-based models
The main purpose of model scaling is to adjust some attributes of the model and generate models of different scales to meet the needs of different inference speeds. ...
We cannot analyze different scaling factors separately for a concatenation-based model but must be considered together. ...
Therefore, we must propose the corresponding compound model scaling method for a concatenation-based model. ...
Our proposed compound scaling method can maintain the properties that the model had at the initial design and maintains the optimal structure.
> model scaling의 주 목적은 모델의 몇몇 속성들을 조정하기 위함이고 모델의 다양한 inference 속도 요구 사항을 만나기 위함이다.
> 우리는 concatenation-based model에서는 scaling factor를 따로 분석할 수 없다.
> 그래서 우리는 cmpound model scaling method를 제안한다.
> 우리가 제안하는 방법은 모델의 초기 디자인에 가졌던 특성들과 최적의 구조를 유지해준다.
4. Trainable bag of freebies
4-1. Planned re-parameterized convolution
We use gradient flow propagation paths to analyze how re-parameterized convolution should be combined with different network. We also designed planned re-parameterized convolution accordingly.
RepConv actually combines 3x3 convolution, 1x1 convolution, and identity connection in one convolutional layer. ... We find that the identity connection in RepConv destroys the residual in ResNet and the concatenation in DenseNet, which provides more diversity of gradients for different feature maps. For the above reasons,
we use RepConv without identity connection(RepConvN) to design the architecture of planned re-parameterized convolution.
> 우리는 gradient flow propagation paths를 사용해서 어떻게 re-parameterized convolution이 다른 network와 합쳐져야 하는지 분석한다. 우리는 또한 planned re-parameterized convolution을 다음과 같이(위 사진) 디자인 했다.
> RepConv는 3x3 conv, 1x1 conv, 그리고 identity connection으로 이루어져있다.
> 우리는 RepConv의 identity connection이 더 다양한 feature map의 gradient를 제공해주는 ResNet의 residual connection과 DenseNet의 concatenation을 망친다는 것을 찾아냈다. 따라서 우리는 planned re-parameterized convolution을 디자인하기 위해 identity connections이 없는 RepConv를 사용한다.
4-2. Coarse for auxiliary and fine for lead loss
Deep supervision ... Its main concept is to add extra auxiliary head in the middle layers of the network, and the shallow network weights with assistant loss as the guide. ...
We call the head responsible for the final output as the lead head, and the head used to assist training is called auxiliary head.
> Deep supervision의 주된 concept은 extra auxiliary head를 assistant loss의 가이드와 함께 네트워크의 중간 layer와 얕은 네트워크 가중치에 추가하는 것이다.
> 우리는 최종 output에 원인이 되는 head를 lead head, 훈련을 돕는 데 도움이 되는 head를 auxiliary head라고 부른다.
Next we want to discuss the issue of label assignment. ...
Researchers often use the quality and distribution of prediction output by the network and then consider together with the ground truth to use some calculation and optimization methods to generate a reliable soft label. ...
We call the mechanism that considers the network prediction results together with the ground truth and then assigns soft labels as 'label assigner.' ...
We use lead head prediction as guidance to generate coarse-to-fine hierarchical labels, which we used for auxiliary head and lead head learning, respectively.
> 다음으로 label assignment에 대해 논하겠다.
> 연구자들은 믿을 수 있는 soft label을 생성하기 위해 네트워크가 출력한 예측결과의 quality와 분포를 사용하고, ground truth와 함께 고려하여 계산과 최적화 방법을 사용한다.
> 우리는 예측결과를 ground truth와 함께 고려하고 soft label을 assign하는 mechanism을 label assigner이라고 부른다.
> 우리는 lead head 예측 결과를 auxiliary head와 lead head learning에 쓴 coarse-to-fine hierarchical label의 가이드로 쓰기 위해 사용한다. (복잡하다..)
(d) Lead head guided label assigner is mainly calculated based on the prediction result of the lead head and the ground truth, and generate soft label through the optimization process. This set of soft labels will be used as the target training model for both auxiliary head and lead head.
The reason to do this is because lead head has a relatively strong learning capability, so the soft label generated from it should be more representative of the distribution and correlation between the source data and the target ...
By letting the shallower auxiliary head directly learn the information that lead head has learned, lead head will be more able to focus on learning residual information that has not yet been learned.
> Lead head guided label assigner은 주로 lead head의 예측 결과와 ground truth로부터 계산되고, 최적화 과정을 통해 soft label을 생성한다. 이 soft label들은 auxiliary head와 lead head의 target target training model로 사용된다.
> 왜냐하면 lead head는 상대적으로 강한 학습 능력이 있기 때문에, 그것이 생성해낸 soft label은 source data와 target 사이의 상관관계를 더 잘 표현할 것이기 때문이다.
> 더 얕은 auxiliary head가 lead head가 배운 것을 직접 배움으로써 lead head는 아직 배우지 않은 residual 정보를 배우는 데 집중할 수 있을 것이다.
(e) Coarse-to-fine lead head guided label assigner also used the predicted result of the lead head and the ground truth to generate soft label. However, in the process we generate two different set of soft label, ie., coarse label and fine label, where fine label is the same as the soft label generated by lead head guided label assigner, and coarse label is generated by allowing more grids to be treated as positive target by relaxing the constraints of the positive sample assignment process.
The reasons for this is that the learning ability of an auxiliary head is not as strong as that of a lead head, and in order to avoid losing the information that needs to be learned, we will focus on optimizing the recall of auxiliary head in the object detection task. As for the output of lead head, we can filter the high precision results from the high recall results as the final output.
> Coarse-to-find lead head guided label assigner 또한 lead head의 예측 결과와 ground truth를 사용하여 soft label을 생성한다. 하지만, 그 과정에서 우리는 두 개의 soft label을 만드는데, 바로 coarse label과 fine label이다. fine label은 lead head guided label assigner가 생성한 soft label과 같고, coarse label은 positive sample assignment 과정의 제한을 풀면서 더 많은 그리드들을 positive target으로 간주하면서 생성된 것들이다.
> 이는 auxiliary head의 학습 능력이 lead head보다 강하지 않고, 학습되어야 하는 정보를 잃지 않기 위함이고, auxiliary head의 object detection task에서의 recall을 최적화하는 데 집중하기 위함이다. lead head의 결과는, 높은 recall 결과로부터 높은 precision 결과를 최종 결과로 필터링할 수 있다.
4-3. Other trainable bag of freebies
(1) Batch normalization in conv-bn-activation topology: This part mainly connects batch normalization layer directly to convolutional layer. The purpose of this is to integrate the mean and variance of batch normalization into the bias and weight of convolutional layer at the inference stage.
(2) Implicit knowledge in YOLOR combined with convolution feature map in addition and multiplication manner: Implicit knolwedge in YOLOR can be simplified to a vector by pre-computing at the inference stage. This vector can be combined with the bias and weight of the previous or subsequent convolutional layer.
(3) EMA model: in our system we use EMA model purely as the final inference model.
> conv-bn-activation에서의 batch normalization: 이는 bn layer를 conv layer에 직접 연결한다. 이것의 목적은 inference 단계에서 bn의 평균과 분산을 conv layer의 bias와 가중치와 통합시키는 것이다.
> conv feature map과 YOLOR의 implicit knowledge가 덧셈과 곱셈의 방식으로 결합된 것: YOLOR의 implicit knolwedge는 inference 단계에서 pre-computing 함으로써 벡터로 단순화할 수 있다. 이 벡터는 이전 혹은 그 다음의 conv layer의 bias와 가중치와 결합될 수 있다.
> EMA 모델: 우리의 시스템에서는 최종 inference model로 EMA 모델을 사용한다.
5. Experiments
~대충 잘됐다는 내용~