CuDi: Curve Distillation for Efficient and Controllable Exposure Adjustment
Paper: https://arxiv.org/pdf/2207.14273.pdf
Github : None
CuDi 는 기존 Zero-DCE의 아이디어에 base를 두고 있는 Self-supervised model입니다. Zero-DCE에 대한 기본적인 내용은 ZeroDCE 을 참고해 주세요.
CuDi의 대표적인 특징은 다음과 같습니다.
- High-order curve를 distillation하여 성능은 비슷하게 유지하면서 더 가볍고, 빠른 model을 학습합니다. (0.5s on inference 4K image with CPU.)
- Image 와 함께 Input으로 들어가는 Exposure map 을 통해, Over / Under exposure 에 robust 한 결과를 낼 수 있습니다.
Distillation
Motivation
Curve Distillation은 기존의 Zero-DCE에서 얻은 High-order curve의 Output이 Linear한 Tangent line(접선) 으로 근사될 수 있다는 점에 근거하여 이루어집니다.
(또한 neighboring pixel의 High-order curve tangency에 대한 monotonicity relationship도 그대로 반영됩니다.)
큰 사이즈의 Teacher model 에서 High-order curve parameter를 학습하고, 작은 사이즈의 Student model에서 Curve Distillation을 통해 유사한 결과를 내는 Tangent line parameter를 학습하게 됩니다.
이를 통해 연산량에서 많은 부분을 차지고하고 있던 기존의 Curve iteration 이 단 한 번의 linear mapping 로 대체될 수 있습니다.
이러한 Curve Distillation은 High-order curve와 tangent line에서 나오는 결과의 관계성에 의해 제대로 진행될 수 있으며, Image를 바로 작은 사이즈의 모델에 학습할 시 학습이 올바르게 진행되지 않습니다.
(그렇다면 GT를 사용한 Supervised learning으로는 Student model을 direct하게 학습할 수 있을까?)
Curve Distillation
Tangent line
Curve Distillation은 High-order curve 와 그 접선 Tangent line 의 사이에서 이루어집니다.
기존과 Zero-DCE와 같이 또한 pixel wise parameter map의 형태로 Input에 pixel-wise 하게 적용됩니다.
Training Teacher Network
Teacher network의 학습에는 Input Image 와 Exposure map 가 model의 input으로 들어갑니다.
학습 시 사용되는 Exposure map 는 random value로 구성되며, 이에 대한 더 자세한 내용은 후술되어 있습니다.
기존의 Zero-DCE 모델과 달리, Teacher Network에서는 큰 사이즈의 Unet-like architecture를 가지고 있으며, feature scaling을 따로 하지 않습니다.
Training Student Network
Teacher network와 마찬가지로, Input Image 와 Exposure map 를 model input으로 사용하여 parameter map을 학습합니다.
동시에, 같은 Input을 학습이 끝난 (Fixed weights) Teacher network에 통과시켜 Output 을 획득하고, Student Network 에서 나온 Output 과 비교하여 Curve Distillation을 진행합니다.
Image: Parameter map , ,
마지막 Conv layer에서 나온 parameter map 를 x4 Upsampling 하여 Input image 에 를 적용합니다.
이 때, 는 low-frequency 에 대한 정보를 주로 가지고 있기 때문에, 이를 Upsampling 하는것은 최종 결과에 별다른 영향을 주지 않는다고 합니다.
Student network는 ~=3K개의 적은 parameter로 구성되어 있으며, Depthwise Conv2d (grouped conv) 와 4x Downsampling을 통해 매우 빠르고 가벼운 연산을 수행합니다.
Condition Exposure Map
CuDi와 기존 Zero-DCE의 가장 큰 차이점 중 하나는 Exposure control입니다.
기존의 Zero-DCE에서는 Exposure loss를 통해서 픽셀의 평균값을 0.6으로 맞추었기 때문에, 다양한 Exposure에 대해서 robust하지 못했습니다.
CuDi 에서는 output의 exposure level을 조절하기 위해서 Input image와 같은 크기의 1channel Exposure map 을 사용합니다.
Training
Image: Random exposure map (예상 )
Training에서는 0.2 ~ 0.8 사이의 random value를 가진 exposure map을 input으로 사용하며, exposure value가 다른 arbitrary region이 존재합니다.
후술할 Loss를 통해서 CuDi Model은 Input image가 주어진 exposure map의 exposure를 따라가도록 학습됩니다.
위의 학습 과정을 통해 Input exposure map의 exposure에 수렴이 되도록 학습이 되면, Inference에서는 임의의 값 혹은 Image를 통해 생성한 exposure map을 사용하여 global / local 하게 exposure를 control 할 수 있게 됩니다.
Inference
Inference 시에 guidance로 사용할 exposure map은 (underexposure), (overexposure) 와 같이 고정된 value를 사용하거나,
의 식을 통해 생성할 수 있습니다.
Image: Left: from paper / Right: implemented (generated from captured image)
=0.15, =0.55 (under exposure), 0.25 (over exposure) 등의 임의의 값을 사용할 수 있으며, 위의 식에서 나오는 (Luminace channel) 을 정확히 어떻게 구하는지는 나와있지 않습니다. (저는 RGB→YUV 변환 후 Y채널 사용하여 생성하였습니다.)
Exposure map을 사용하면 spatial variant 하게 exposure control 할 수 있다는 장점이 있지만,
- exposure map을 생성하는 연산을 따로 수행해야한다.
- 전체적인 Image의 밝기에 따라 값은 manually하게 설정해주어야 한다.
라는 한계가 있다고 생각합니다.
Loss
Teacher
teacher network의 loss는 대부분 Zero-DCE와 공통됩니다.
, (weights = 10, 1, 5, 200 respectively.)
기존의
1)Spatial Consistency Loss, ****
2)Color Constancy Loss,
3)Illumination Smoothness Loss (TVLoss) 와 더불어,
Output의 exposure mean을 0.6으로 맞추는 기존 Exposure Loss와 달리 Output 과 Input exposure map의 평균값을 맞추는
4)Self-Supervised Spatial Exposure Control Loss 를 사용하였습니다..
Student
student network에서는 Input에 tangent line을 적용한 결과와 teacher network에서 high-order curve를 적용한 결과에 대해서 를 사용하여 학습합니다.
Experiments
Implementation
CuDi model은 Paper에 나와있는 정보를 따라 구현하였습니다.
Teacher, Student network에 각각 0.0001, 0.0005의 learning rate를 사용하였고, ADAM optimizer의 default setting을 사용하였습니다.
또한 모든 Convolution layer는 normal distribution으로 weight init 해주었습니다. (paper에는 나와있지 않지만 mean=0, std=0.02로 init)
저의 경우에는 Student network를 위와 같이 구성하였는데, Paper대로라면 Student network의 Input layer의 channel이 가 되어야 하지 않나 생각합니다.
Results
Imge: Left: Teacher network, Right: Student network
충분한 iteration 후, Teacher network와 유사한 결과 (SSIM ≥ 0.9)를 도출하는 것을 확인할 수 있습니다.
더 많은 결과와 성능 지표는 Paper를 참고해주세요.