먼저 단일 변수에 대한 기본 비용함수는 m을 없앤 식을 생각하면 됩니다. 


이 비용함수는 binary classification에서 탁월한 성능을 보여줍니다. 


2가지로 구분하여 비용함수를 책정하게 되는데


1. if y = 0 :

이 때는 -log(1-y_hat)이 남게 됩니다. 결국 우리의 목표는 cost를 낮추는 것이기 때문에 y_hat이 작아지는 쪽으로 update를 하게 될 것입니다.


2. if y = 1 :

이 경우는 -log(y_hat)이 남게 됩니다. 위와 같이 cost를 낮추려면 y_hat을 1과 비슷하게 만들어야 겠죠? log1은 곧 0이니까요. 


이와 여러개의 변수에 관해서 구하고 싶다면 m으로 나눠주어 평균으로 비용함수를 책정하게 됩니다. 


직관적인 이해는 아래 그림을 참고하세요! ( 구글 검색 그림 )





'# Machine Learning > 글 공부' 카테고리의 다른 글

deconvolution(conv2Dtranspose) vs upsampling  (0) 2018.12.10
1x1 convolution이란,  (16) 2018.12.10
basic gradient(+backprop) with numpy  (0) 2018.12.09
Multi Class vs Multi Label  (0) 2018.12.06
fine tuning 시 상위층과 하위층  (0) 2018.11.25

1. 이미지 읽기

cv2.imread(path)

 

2. 이미지 쓰기

cv2.imwrite(path, omg)

 

3. 이미지 사이즈 변경하기

cv2.resize(img, (shape))

 

4. 이미지 사이즈 변경하기 2

cv2.pyrUp or cv2.pyrDown(img) 

  • 1/4 크기로 줄임
  • 결과 확인했을 때 interpolation이 좀 더 잘됨 -> 경험적으로 개인이 판단해야할 부분

 

(+) 

from keras.preprocessing import image

image.img_to_array : img를 numpy_array로 변경하기

 

 

과일이 주제가 되는 이미지에 사과, 배, 오렌지가 있다고 합시다.

Multi-Class는 이 과일 주제의 이미지에서 딱하나의 과일만 찾고 싶습니다.

하나를 찾기 위해선 당연히 다른 과일도 판단할 수 있어야겠지요. 반면에, Multi-Label은 사과도 찾고 싶고, 배도 찾고 싶은겁니다.

 

 

keras에서 각 상황에 맞는 loss function은 다음과 같습니다.

1. Multi-Class : categorical_crossentropy

2.Multi-Label : binary_crossentropy

 

Abstract

Deep Convolutional Neural Networks (DCNNs) have recently shown state of the art performance in high level vision tasks, such as image classification and ob- ject detection. This work brings together methods from DCNNs and probabilistic graphical models for addressing the task of pixel-level classification (also called ”semantic image segmentation”). We show that responses at the final layer of DCNNs are not sufficiently localized for accurate object segmentation. This is due to the very invariance properties that make DCNNs good for high level tasks. We overcome this poor localization property of deep networks by combining the responses at the final DCNN layer with a fully connected Conditional Random Field (CRF). Qualitatively, our “DeepLab” system is able to localize segment boundaries at a level of accuracy which is beyond previous methods. Quantita- tively, our method sets the new state-of-art at the PASCAL VOC-2012 semantic image segmentation task, reaching 71.6% IOU accuracy in the test set. We show how these results can be obtained efficiently: Careful network re-purposing and a novel application of the ’hole’ algorithm from the wavelet community allow dense computation of neural net responses at 8 frames per second on a modern GPU.


DCNN은 이미지 분류나 객체인식에서 고성능을 보여주었다.

이 논문은 DCNN의 방법을 가져옴과 동시에 "semantic image segmentation" 이라고 불리우는 픽셀단위의 작업을 하는 확률적 그래픽 모델을 사용한다. 

DCNN은 객체 구분에 있어서 주요한 지역화의 성능이 떨어지는 것을 볼 수 있다. 

DCNN의 고수준의 작업에서만 잘되기 떄문이다. ( 눈은 잘 구별할 수 있지만, 위치는 고려하지 않는 문제 -> CapsNet? )

DCNN과 CRF를 합쳐 낮은 수준의 지역화를 극복하려 한다.

우리의 "DeepLab" 시스템은 이전 방법에 비해 훨씬 더 정확한 수준의 구분 경계를 지역화할 수 있다.

또한 PASCAL VOC-2012에 적용하여 71.6% IOU accuracy를 도달하였다.

네트워크의 재사용과 'hole' 알고리즘을 통해 최신 GPU에서 초당 8프레임의 반응을 얻음으로서 우리의 방법이 얼마나 효율적인지를 보여줄 수 있다.

 

 

Reference

Chen, L. C., Papandreou, G., Kokkinos, I., Murphy, K., & Yuille, A. L. (2014). Semantic image segmentation with deep convolutional nets and fully connected crfs. arXiv preprint arXiv:1412.7062.

 


1. 런타임 유형변경 클릭


2. 하드웨어 가속기 변경


- keras backend에서 지피유를 사용할 수 있는지 확인하는 방법.


구글 드라이브 마운트 하는 법 -> key 넣어주고 엔터하면 파일목록에 drive 생김



'# 기타 공부한 것들 > etc' 카테고리의 다른 글

Jupiter notebook에서 ipynb파일 import하기  (0) 2018.12.22
ML 공부용 사이트들  (0) 2018.12.17
Java Queue 간단 예제  (0) 2018.11.05
JAVA String reverse하기  (0) 2018.11.05
Jupiter notebook 단축키(MAC)  (0) 2018.07.25