Abstract

In object detection, reducing computational cost is as important as improving accuracy for most practical usages. This paper proposes a novel network structure, which is an order of magnitude lighter than other state-of-the-art networks while maintaining the accuracy. Based on the basic principle of more layers with less channels, this new deep neural network minimizes its redundancy by adopting recent innovations including C.ReLU and Inception structure. We also show that this network can be trained efficiently to achieve solid results on well-known object detection benchmarks: 84.9% and 84.2%mAP on VOC2007 and VOC2012 while the required compute is less than 10% of the recent ResNet-101.


객체 탐지에서 계산 비용을 감소시키는 것은 실용적인 측면에서 정확도를 높이는 것만큼 중요하다.

이 논문은 최신 성능을 유지하면서도 더 가벼운 특징을 가지는 신경망 구조를 제안한다.

적은 채널수와 많은 층을 쌓는 기본적인 원리에 기반해서, 인셉션 구조와 C.ReLU를 포함한 가장 최근의 혁신적인 구조의 중복을 최소화한 깊은 신경망이다.

또한, 다음과 같이 각종 데이터셋에서 효율적인 결과를 얻었다. 최근 각광받고 있는 ResNet-101보다 더 가벼운 모델로 VOC2007, VOC2012에서 각각 84.9%, 84.2% mAP를 얻었다.


요약

  • 이 논문은 Faster R-CNN의 형태를 개선한 논문이다.
  • 네트워크는 깊게 구성하면서도 채널 수는 줄여보자는 취지이다.
  • C.ReLU는 기존 방식과 다르게 Scale/Bias를 추가하여 Modified C.ReLU의 형태로 사용하였다.
  • Inception 모듈은 그 당시에 객체 탐지에서 잘 사용하지 않았는데, 사용한 이유는 다양한 receptive field를 얻을 수 있을 거라고 생각했기 때문이고, 실제로 사용해보았더니 잘되었다고 한다. 

  • 또한, skip connection과 구조가 동일한 Hyper-feature Concatenation을 사용하였다. 이때, Upscale할 때는 단순하게 Bilinear interpolation을 사용하였다. 

  • 이 논문은 RPN시에 최종 출력의 모든 feature를 사용하지 않고 128개의 채널만 떼서 사용한다. 기본적으로 RPN은 객체의 유무만 판단하는 단순한 연산이기 떄문이다. 반대로 분류하는 부분은 모든 채널을 전부 사용한다.

 

Reference

Hong, S., Roh, B., Kim, K. H., Cheon, Y., & Park, M. (2016). Pvanet: Lightweight deep neural networks for real-time object detection. arXiv preprint arXiv:1611.08588.

Abstract

We present a model that generates natural language descriptions of images and their regions. Our approach leverages datasets of images and their sentence descriptions to learn about the inter-modal correspondences between language and visual data. Our alignment model is based on a novel combination of Convolutional Neural Networks over image regions, bidirectional Recurrent Neural Networks over sentences, and a structured objective that aligns the two modalities through a multimodal embedding. We then describe a Multimodal Recurrent Neural Network architecture that uses the inferred alignments to learn to generate novel descriptions of image regions. We demonstrate that our alignment model produces state of the art results in retrieval experiments on Flickr8K, Flickr30K and MSCOCO datasets. We then show that the generated descriptions significantly outperform retrieval baselines on both full images and on a new dataset of region-level annotations.


이 논문은 각 region과 이미지에 해당하는 캡션을 생성하는 모델을 소개한다.

우리가 제안하는 방법은 이미지 데이터셋과 문장 설명을 활용하여 그 사이의 상호 대응 방식을 학습하는 것이다.

우리의 모델은 이미지 영역에서의 CNN, 문장을 다루는 Bidirectional RNN의 조합에 기반하고, 이를 결합하는 구조화된 목표를 가지고 있다. (multimodal이란 시각 + 언어, 소리 + 언어를 주로 가르키는 것 같음.)

또한, 이미지 영역에 대한 설명을 생성하도록 학습하여 추론된 문장을 사용할 수 있는 Multimodal RNN을 설명한다. 

우리는 각종 플리커 데이터셋과 MSCOCO에서의 실험을 통해 최고의 성능을 생성할 수 있음을 증명한다. 

더하여서, 새로운 데이터셋의 완전한 이미지를 주었을 때, 이를 설명하는 성능은 매우 우수하다. 


요약

  • 이미지에 대해 설명을 추가하려는 시도를 하는 첫 번째 논문이다.
  • CNN을 사용하여 이미지를 벡터로 임베딩하고, RNN을 통해 단어들을 임베딩한다. 그리고 두 벡터를 통해 연산을 하고 점수를 매긴다.
  • Bidirectional RNN을 사용한 이유는 문장 전체의 정보를 사용하기 위함이다. 

  • 결과는 위와 같이 만들어지게 되는데, 각 상자에서 검은색은 가장 확률이 낮은것이고 흰색은 그 반대이다. 이를 통해 점수를 계산한다.

  • loss function은 위와 같이 구성되어 있는데, ground_truth(여기서 s_kk)를 뺏을 때의 값을 기준으로 이를 minimize하는 방식이다. max를 이용하여 s_kl이나 s_lk와의 거리를 최대한 좁히려는 것이다.
  • 이 함수를 RNN, CNN을 학습시킬 때 사용하였다.
  • 에너지 function을 사용하여 이미지와 단어와의 관계가 찢어지는 현상을 해결하려고 했다. 
  • 마지막으로는 RNN을 사용하여 문장을 생성하려고 했다. 이때, 첫 번째 hidden state에는 가중치를 더해준다.
  • 논문에서 R@5, R@10과 같은 수치로 평가하는데, 이는 5번 돌려서 정답이 있을 확률, 10번 돌려서 정답이 있을 확률을 의미한다.

 

Reference

Karpathy, A., & Fei-Fei, L. (2015). Deep visual-semantic alignments for generating image descriptions. In Proceedings of the IEEE conference on computer vision and pattern recognition (pp. 3128-3137).

두 가지 방법으로 정의하여 사용할 수 있습니다.

예시로는 이 글이 작성된 2019/10/27일을 기준으로 가장 최신의 활성화 함수라고 말할 수 있는 Mish Activation을 사용하였습니다.

[해당 논문]: https://arxiv.org/abs/1908.08681


케라스의 Activation 함수에 그대로 넣어서 사용하기

import tensorflow as tf
import tensorflow.keras.backend as K

from tensorflow.keras.datasets import mnist
from tensorflow.keras.layers import Input, Dense, Flatten, Activation
from tensorflow.keras.models import Model

(x_train, y_train), (x_test, y_test) = mnist.load_data()

def mish(x):
    return x * K.tanh(K.softplus(x))

inputs = Input(shape = (28, 28))
x = Flatten()(inputs)
x = Dense(50)(x)
x = Activation(mish)(x)
x = Dense(30)(x)
x = Activation(mish)(x)
x = Dense(10, activation = 'softmax')(x)

model = Model(inputs = inputs, outputs = x)
model.compile(optimizer = 'adam',
             loss = 'sparse_categorical_crossentropy')

model.fit(x_train, y_train)

위의 코드와 같이 직접 activation 함수에 쓰일 연산을 정의하여 인자로 넘겨줄 수 있습니다.


함수를 등록하여 케라스의 특징인 문자열 형태로 제공하여 쓰기

import tensorflow as tf
import tensorflow.keras.backend as K

from tensorflow.keras.datasets import mnist
from tensorflow.keras.layers import Input, Dense, Flatten, Activation
from tensorflow.keras.models import Model

from tensorflow.keras.utils import get_custom_objects

(x_train, y_train), (x_test, y_test) = mnist.load_data()

class Mish(Activation):
    def __init__(self, activation, **kwargs):
        super(Mish, self).__init__(activation, **kwargs)
        self.__name__ = 'Mish'

def mish(x):
    return x * K.tanh(K.softplus(x))

get_custom_objects().update({'mish': Mish(mish)})

inputs = Input(shape = (28, 28))
x = Flatten()(inputs)
x = Dense(50)(x)
x = Activation('mish')(x)
x = Dense(30)(x)
x = Activation('mish')(x)
x = Dense(10, activation = 'softmax')(x)

model = Model(inputs = inputs, outputs = x)
model.compile(optimizer = 'adam',
             loss = 'sparse_categorical_crossentropy')

model.fit(x_train, y_train)

위와 같이 클래스로 정의한 뒤, get_custom_objects를 사용해 등록하여 사용할 수 있습니다.

경우에 따라 1번과 2번 중에 편리한 것이 있을 수 있으니 선택하여 사용하시면 될 것 같네요.

Abstract

The move from hand-designed features to learned features in machine learning has been wildly successful. In spite of this, optimization algorithms are still designed by hand. In this paper we show how the design of an optimization algorithm can be cast as a learning problem, allowing the algorithm to learn to exploit structure in the problems of interest in an automatic way. Our learned algorithms, implemented by LSTMs, outperform generic, hand-designed competitors on the tasks for which they are trained, and also generalize well to new tasks with similar structure. We demonstrate this on a number of tasks, including simple convex problems, training neural networks, and styling images with neural art.


머신러닝으로 학습된 특징을 사용하는 작업은 매우 성공적이었다.

이와 같은 성공에도 불구하고 최적화 알고리즘은 여전히 직접 설계되어지고 있다.

이 논문은 최적화 알고리즘의 설계를 학습 문제로 정의하여 이를 문제에 맞게 자동으로 설계하게끔 하는 방법을 소개한다.

LSTM으로 구현된 이 알고리즘은 일반적인 최적화 알고리즘의 성능을 뛰어넘으며, 여러 문제에도 일반화될 수 있음을 보여주었다. 

우리는 neural art, 신경망 학습, 간단한 convex 문제를 포함한 여러 문제에 이 알고리즘을 적용하였다.


요약

  • Learning to learn은 Meta Learning이라고도 한다. 
  • 일반적으로 밑의 첫번째 그림과 같은 업데이트 방식을 사용하여 학습을 진행하는데, 이는 모든 문제에 일반화기 애매한 수식이다. 따라서 이 논문은 좀 더 일반화할 수 있는 최적화 알고리즘을 얻길 원한다.
  • loss function은 매우 간단하게 구성되어 있으며, 이에 존재하는 f를 optimizee라고 부른다.
  • 컴퓨팅 비용을 고려하여 RNN 대신 LSTM을 택하였다. 
  • 3번째 그림의 dashed line은 f_t의 second order derivative를 구하지 않으려고 한 부분이다.
  • 히든 레이어의 유닛 수를 늘린다던가, 레이어의 수를 늘렸을 떄는 좋은 성능을 보였지만, activation function을 바꾸면 학습이 잘 되지 않는다. 

 

Reference

Andrychowicz, M., Denil, M., Gomez, S., Hoffman, M. W., Pfau, D., Schaul, T., ... & De Freitas, N. (2016). Learning to learn by gradient descent by gradient descent. In Advances in neural information processing systems (pp. 3981-3989).

간혹가다 nvidia driver만 삭제되는 경우가 발생한다. 

나의 경우는 cuda, cuDnn 은 살아있어도, 계속 nvidia가 날려져서 다시 깔고 있었는데, 알고보니 내부적으로 충돌로 인해 이를 삭제하는 것이라고 한다.

따라서 nouveau를 비활성화해주면 이런 경우가 없어진다고 한다.


1. 다음 파일을 찾아간다.

/etc/modprobe.d/blacklist-nouveau.conf

2. 다음 내용을 추가합니다.

blacklist nouveau
options nouveau modeset=0

3. 커널에 입력시켜줍니다.

sudo update-initramfs -u

4. 재부팅합니다.

sudo reboot