Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
TensorFlow로
얼굴을	인식해	보자.
공개 소프트웨어 개발자 센터
(KOSS	Lab. 2기)
Mario	Cho	(조만석)
hephaex@gmail.com
Who am I ?
Development Experience
◆ Image Recognition using Neural Network
◆ Bio-Medical Data Processing
◆ Human Brain Map...
Contents
• 우리가 본다!
• 기초부터 MNIST
• CIF영상인식
• 학습 데이터 만들기
• Tensorflow에 적용
• 그리고 전설로.
Human Intelligence
Human Brain
Source: https://www.ll.mit.edu/publications/journal/pdf/vol 04_no2/4.2.5.neuralnetwork.pdf
Neural network vs Learning
network
Neural Network Deep Learning Network
Human Neural network vs. Machine Learning network
Traditional learning vs Deep Machine Learning
Eiffel Tower
Eiffel Tower
RAW data
RAW data
Deep
Learning
Network
Feature
Ex...
Caffe
U.C. Berkley 개발
C++, Python, MATLAB
대표적인 기계학습을 위한 공개 소프트웨어
* Source: http://caffe.berkeleyvision.org
TensorFlow
* Source: https://www.tensorflow.org/
Hierarchical Representation of Deep Learning
* Source: : Honglak Lee and colleagues (2011) as published in “Unsupervised L...
Hello World on TensorFlow
Image recognition in Google Map
* Source: Oriol Vinyals – Research Scientistat Google Brain
Hello World == MNIST
Data Sets data_sets.train 55000 images & labels
data_sets.validation 5000 images & labels
data_sets.t...
MNIST (predict number of image)
MNIST beginner code
Face recognition?
CIFAR-10
• CIFAR-10
– 32x32 크기로 컬러 영상
– 10종류로 구분됨.
– TensorFlow 예제: tensorflow/models/image/cifar10/
CIFAR-10 Model
Data Sets data_sets.train 50000 images & labels
data_sets.validation 1000 images & labels
data_sets.test 10...
CIFAR-10 data
• Image Data의 특징
– 10종류로 32x32로 된 인식 + 이미지로 구성
– 학습 데이터(Training data)
– data_batch_1.bin, data_batch_2.bin,...
CIFAR-10 learning network
Layer Name Description
conv1 convolution and rectified linear activation.
pool1 max pooling.
nor...
Source data: 얼굴 인식에 사용할 사진을 모으자!
Prepare: 사진에서 얼굴만 추출하자.
OpenCV
Face Detection using Haar Cascades
Source: http://opencv-python-tutroals.r eadthedocs.io/en/latest/py_tutorials/py_objdete...
Open CV: face dectec code
CIFAR-10 data
• TFRecode file
– TensorFlow 에 TFRcords를 이용하여 binary 데이터를 연속된 데이터로 변형.
– 연속된 데이터를 Reader,Writer를 이용해서 읽고 쓸 수...
CIFAR-10 data sets 형식으로 바꾸자.
CIFAR-10 에서 대상을 얼굴 추출 자료로 바꾸자.
TensorFlow Training
– 학습이 잘 된 것처럼 보이나되어서 평가를 해보면
CNN layer를 바꿔가며 자신만의 방법을…
• X2 conv layers
96 x 96 x 3
48 x 48 x 32
24 x 24 x 64
12 x 12 x 128
6 x 6 x 256
(6 x 6 x 256) *...
CNN 2x code
소결!
• CIFAR-10을 응용하여 얼굴 인식을 해보자.
• 이쁜 언니들 얼굴 자료를 모으고
• 전체 사진에서 Open CV를 이용해서 CIFAR-10에
맞게 얼굴만을 데이터를 수정해서
• CIFAR-10 형식으로 데...
뭐
가
문
제
냐
?
face extraction
#1. No. of Face data
# 2. Face extraction method
#3. advanced face detect
#4 View side effect
Source: http://socialsciences.uow.edu.au/psychology/research/pcl/members/UOW040587.html
#5 Emphasis?
#6. Eigen faces
Source: http://jbhuang0604.blogspot.kr/2013/04/miss-korea-2013-contestants-face.html
#6. Converging on the same face
Source: http://jbhuang0604.blogspot.kr/2013/04/miss-korea-2013-contestants-face.html
Make Her Beautiful?
Source: http://www.estherhonig.com
Thanks you!
Q&A
Upcoming SlideShare
Loading in …5
×

Tfk 6618 tensor_flow로얼굴인식구현_r10_mariocho

11,213 views

Published on

TensorFlow를 이용해서 얼굴을 인식하는 프로그램을 만들어보자.

Published in: Software
  • Be the first to comment

Tfk 6618 tensor_flow로얼굴인식구현_r10_mariocho

  1. 1. TensorFlow로 얼굴을 인식해 보자. 공개 소프트웨어 개발자 센터 (KOSS Lab. 2기) Mario Cho (조만석) hephaex@gmail.com
  2. 2. Who am I ? Development Experience ◆ Image Recognition using Neural Network ◆ Bio-Medical Data Processing ◆ Human Brain Mapping on High Performance Computing ◆ Medical Image Reconstruction (Computer Tomography) ◆ Enterprise System ◆ Open Source Software Developer Open Source Software Developer ◆ Linux Kernel & LLVM ◆ OPNFV (NFV&SDN) & OpenStack ◆ Machine Learning (TensorFlow) Book ◆ Unix V6 Kernel Korea Open Source Software Lab. Mario Cho hephaex@gmail.com
  3. 3. Contents • 우리가 본다! • 기초부터 MNIST • CIF영상인식 • 학습 데이터 만들기 • Tensorflow에 적용 • 그리고 전설로.
  4. 4. Human Intelligence
  5. 5. Human Brain Source: https://www.ll.mit.edu/publications/journal/pdf/vol 04_no2/4.2.5.neuralnetwork.pdf
  6. 6. Neural network vs Learning network Neural Network Deep Learning Network Human Neural network vs. Machine Learning network
  7. 7. Traditional learning vs Deep Machine Learning Eiffel Tower Eiffel Tower RAW data RAW data Deep Learning Network Feature Extraction Vectored Classification Traditional Learning Deep Learning
  8. 8. Caffe U.C. Berkley 개발 C++, Python, MATLAB 대표적인 기계학습을 위한 공개 소프트웨어 * Source: http://caffe.berkeleyvision.org
  9. 9. TensorFlow * Source: https://www.tensorflow.org/
  10. 10. Hierarchical Representation of Deep Learning * Source: : Honglak Lee and colleagues (2011) as published in “Unsupervised Learning of Hierarchical Representations with Convolutional Deep Belief Networks”.
  11. 11. Hello World on TensorFlow
  12. 12. Image recognition in Google Map * Source: Oriol Vinyals – Research Scientistat Google Brain
  13. 13. Hello World == MNIST Data Sets data_sets.train 55000 images & labels data_sets.validation 5000 images & labels data_sets.test 10000 images & labels
  14. 14. MNIST (predict number of image)
  15. 15. MNIST beginner code
  16. 16. Face recognition?
  17. 17. CIFAR-10 • CIFAR-10 – 32x32 크기로 컬러 영상 – 10종류로 구분됨. – TensorFlow 예제: tensorflow/models/image/cifar10/
  18. 18. CIFAR-10 Model Data Sets data_sets.train 50000 images & labels data_sets.validation 1000 images & labels data_sets.test 10000 images & labels Source: http://www.cs.toronto.edu/~kriz/cifar.html
  19. 19. CIFAR-10 data • Image Data의 특징 – 10종류로 32x32로 된 인식 + 이미지로 구성 – 학습 데이터(Training data) – data_batch_1.bin, data_batch_2.bin, … , data_batch_5.bin – 테스트 데이터(Test data) – test_batch.bin • 1개의 이미지 파일(image file) – 32(가로) x 32(세로) x 3(RGB) = 3072 byte – 3 tensor image (RGB) • *참조: 텐서 플로우의 이미지 형식 tf.image_summary(tag, tensor, max_images=3, collections = None, Name=None) – [0, 255].unint8 – 1 tensor: Grayscale – 3 tensor: RGB – 4 tensor: RGBA
  20. 20. CIFAR-10 learning network Layer Name Description conv1 convolution and rectified linear activation. pool1 max pooling. norm1 local response normalization. conv2 convolution and rectified linear activation. norm2 local response normalization. pool2 max pooling. local3 fully connected layer with rectified linear activation. local4 fully connected layer with rectified linear activation. softmax_linear Linear transformation to produce logits
  21. 21. Source data: 얼굴 인식에 사용할 사진을 모으자!
  22. 22. Prepare: 사진에서 얼굴만 추출하자.
  23. 23. OpenCV
  24. 24. Face Detection using Haar Cascades Source: http://opencv-python-tutroals.r eadthedocs.io/en/latest/py_tutorials/py_objdetect/pya_face_detection/py_face_detection.html#face-detection
  25. 25. Open CV: face dectec code
  26. 26. CIFAR-10 data • TFRecode file – TensorFlow 에 TFRcords를 이용하여 binary 데이터를 연속된 데이터로 변형. – 연속된 데이터를 Reader,Writer를 이용해서 읽고 쓸 수 있다. – 고정 길이가 아닌 구조형 데이터도 읽고 쓰는 처리 가능 – 1 image file 은 – 32(가로) x 32(세로) x 3(RGB) = 3072 byte – 1 label + 1 file image file 은 – < 1 x label > < 3072 x pixel> – 1000 label + 1000 image file – 32 * 32 * 3 * 1000 = 3 072 000 (3MB) – Filenames, shuffling – [“files0”, “file1”], – (“file%d” % i) for I in range(2) • tf.train.input_producer(input_tensor, element_shape=None,num_epochs=None,shuffle=True, seed=None,capacity=32, shared_name=None,summary_name=None,name=None) – input_tensor: 1차 열로 구성 – element_shape: (Optional.) 입력 텐서의 형태 – num_epochs: (Optional.) – shuffle: (Optional.):데이터를 임으로 섞어 놓을지? – seed: (Optional.):데이터의 씨앗을 사용? – capacity: (Optional.): 버퍼를 사용한 입력. – name: (Optional.) 큐의 이름
  27. 27. CIFAR-10 data sets 형식으로 바꾸자.
  28. 28. CIFAR-10 에서 대상을 얼굴 추출 자료로 바꾸자.
  29. 29. TensorFlow Training – 학습이 잘 된 것처럼 보이나되어서 평가를 해보면
  30. 30. CNN layer를 바꿔가며 자신만의 방법을… • X2 conv layers 96 x 96 x 3 48 x 48 x 32 24 x 24 x 64 12 x 12 x 128 6 x 6 x 256 (6 x 6 x 256) * 1024 1024 x 256 256 x 5 Cf. weight compare - cifar10: - (5 x 5 x 3 x 64) + (5 x 5 x 64 x 64) + (4096 * 384) + (384 * 192) + (192 * 6) = 1754944 - X2 conv: - (3 x 3 x 3 x 32) + (3 x 3x 32 x 64) + (3 x 3 x 64 x 128) + (3 x 3 x 128 x 256) + (9216 x 1024) + (1024 x 256) + (256 x 5) = 10088544 (5.7x cifar10 )
  31. 31. CNN 2x code
  32. 32. 소결! • CIFAR-10을 응용하여 얼굴 인식을 해보자. • 이쁜 언니들 얼굴 자료를 모으고 • 전체 사진에서 Open CV를 이용해서 CIFAR-10에 맞게 얼굴만을 데이터를 수정해서 • CIFAR-10 형식으로 데이터 변환했다. • 그리고 python cifar-10을 실행하니 • 학습까지 잘되었다? 진짜!?!
  33. 33. 뭐 가 문 제 냐 ?
  34. 34. face extraction
  35. 35. #1. No. of Face data
  36. 36. # 2. Face extraction method
  37. 37. #3. advanced face detect
  38. 38. #4 View side effect Source: http://socialsciences.uow.edu.au/psychology/research/pcl/members/UOW040587.html
  39. 39. #5 Emphasis?
  40. 40. #6. Eigen faces Source: http://jbhuang0604.blogspot.kr/2013/04/miss-korea-2013-contestants-face.html
  41. 41. #6. Converging on the same face Source: http://jbhuang0604.blogspot.kr/2013/04/miss-korea-2013-contestants-face.html
  42. 42. Make Her Beautiful? Source: http://www.estherhonig.com
  43. 43. Thanks you! Q&A

×