Upgrade to Pro — share decks privately, control downloads, hide ads and more …

機械学習インフラ入門 (Docker, AWS) /ml-docker-aws

機械学習インフラ入門 (Docker, AWS) /ml-docker-aws

第15回 Machine Learning 15minutes! 2017/10/28

Tweet

More Decks by Yuichiro Tachibana (Tsuchiya)

Other Decks in Technology

Transcript

  1. SSD: Single Shot MultiBox Detector Wei Liu1, Dragomir Anguelov2, Dumitru

    Erhan3, Christian Szegedy3, Scott Reed4, Cheng-Yang Fu1, Alexander C. Berg1 1UNC Chapel Hill 2Zoox Inc. 3Google Inc. 4University of Michigan, Ann-Arbor 1 [email protected], 2 [email protected], 3{ dumitru,szegedy } @google.com, 4 [email protected], 1{ cyfu,aberg } @cs.unc.edu Abstract. We present a method for detecting objects in images using a single deep neural network. Our approach, named SSD, discretizes the output space of bounding boxes into a set of default boxes over different aspect ratios and scales per feature map location. At prediction time, the network generates scores for the presence of each object category in each default box and produces adjustments to the box to better match the object shape. Additionally, the network combines pre- dictions from multiple feature maps with different resolutions to naturally handle objects of various sizes. SSD is simple relative to methods that require object proposals because it completely eliminates proposal generation and subsequent pixel or feature resampling stages and encapsulates all computation in a single network. This makes SSD easy to train and straightforward to integrate into sys- tems that require a detection component. Experimental results on the PASCAL VOC, COCO, and ILSVRC datasets confirm that SSD has competitive accuracy to methods that utilize an additional object proposal step and is much faster, while providing a unified framework for both training and inference. For 300 ⇥ 300 in- put, SSD achieves 74.3% mAP1 on VOC2007 test at 59 FPS on a Nvidia Titan X and for 512 ⇥ 512 input, SSD achieves 76.9% mAP, outperforming a compa- rable state-of-the-art Faster R-CNN model. Compared to other single stage meth- ods, SSD has much better accuracy even with a smaller input image size. Code is available at: https://github.com/weiliu89/caffe/tree/ssd . Keywords: Real-time Object Detection; Convolutional Neural Network 1 Introduction Current state-of-the-art object detection systems are variants of the following approach: hypothesize bounding boxes, resample pixels or features for each box, and apply a high- arXiv:1512.02325v5 [cs.CV] 29 Dec 2016 ࣮૷͕ެ։͞ΕͯΔʂ
  2. ؀ڥߏஙͷͭΒΈ • Caffe • OpenCV • pyenv? • tensorflow 0.x,

    1.x • keras 1.x, 2.x • chainer 1.x, 2.x, 3.x etc…
  3. $ docker run -it bvlc/caffe:cpu bash root@e276ba715d2f:/workspace# root@e276ba715d2f:/workspace# caffe --version

    caffe version 1.0.0 ެࣜDockerΠϝʔδ root@e276ba715d2f:/workspace# python -i Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> root@e276ba715d2f:/workspace# python -i Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import caffe >>> root@e276ba715d2f:/workspace# python -i Dockerίϯςφ಺Ͱ࣮ߦ
  4. u bash caffe --version python -i 2016, 06:48:10) dits" or

    . python -i 2016, 06:48:10) dits" or . python -i )PTU04 $POUBJOFS CPPTU QZUIPO CBTI #-"4 DB⒎F ʜ BOPUIFS DPOUBJOFS ʜ ʜ
  5. ίϯςφΠϝʔδͷ࡞Γํʢͬ͘͟Γʣ FROM ubuntu:16.04 RUN apt-get update\ && apt-get install python

    Dockerfile $ docker build -t ubuntu-python . ϕʔεΠϝʔδ Πϯετʔϧͱ͔ॾʑ (΄΅Կ΋Πϯετʔϧ͞Ε͍ͯͳ͍) ubuntu python =৽Πϝʔδ ubuntu-python
  6. $ docker run -it bvlc/caffe:cpu bash root@e276ba715d2f:/workspace# root@e276ba715d2f:/workspace# caffe --version

    caffe version 1.0.0 root@e276ba715d2f:/workspace# python -i Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> root@e276ba715d2f:/workspace# python -i Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import caffe >>> root@e276ba715d2f:/workspace# python -i Μʁ
  7. $ docker build -t ssd-caffe ./docker/gpu Ϗϧυʢ̍̌෼͘Β͍଴ͭʣ SSDͷREADMEͷͱ͓Γɺ ϞσϧϑΝΠϧΛDL͓ͯ͘͠ $

    nvidia-docker run \ -v `pwd`/models:/opt/caffe/models \ -w /opt/caffe \ ssd-caffe:gpu \ python examples/ssd/score_ssd_pascal.py
  8. $ nvidia-docker run --rm \ -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --device

    /dev/video0 -v `pwd`/models:/opt/caffe/models -w /opt/caffe ssd-caffe:gpu \ python examples/ssd/ssd_pascal_webcam.py ϗετϚγϯͷwebcamΛ dockerίϯςφʹͭͳ͙ઃఆ
  9. $ nvidia-docker run --rm \ -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v

    `pwd`/models:/opt/caffe/models -w /opt/caffe --device /dev/video0 ssd-caffe-lt:gpu \ python examples/ssd/ssd_pascal_webcam.py ίʔυΛDMPOF͔ͯ͠Β̍࣌ؒ΋͋Ε͹ಈ͔ͤΔΑʂ
  10. AWSɺ͔ͭͬͯ·͔͢ Amazon EC2 Amazon ECS AWS Batch AWS Lambda Amazon


    S3 Amazon
 RDS AWS 
 CodeBuild Amazon CloudWatch AWS
 CloudFormat
  11. ίϯςφΠϝʔδͷ࡞Γํʢͬ͘͟Γʣʢ࠶ܝʣ FROM ubuntu:16.04 RUN apt-get update\ && apt-get install python

    Dockerfile $ docker build -t ubuntu-python . ϕʔεΠϝʔδ Πϯετʔϧͱ͔ॾʑ (΄΅Կ΋Πϯετʔϧ͞Ε͍ͯͳ͍) ubuntu python =৽Πϝʔδ ubuntu-python
  12. σϓϩΠ༻ίϯςφΠϝʔδ ssd-caffe application code model file ։ൃ࣌ ssd-caffe Host OS

    application code model file mount mount $ docker build σϓϩΠ࣌ σϓϩΠ༻Πϝʔδ= Dockerfile
  13. AWS Batch ECR registry Execute Batch Job! AWS Batch •

    ֶश • ϋΠύʔύϥϝʔλαʔν