Dockerfile 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. FROM ubuntu:16.04
  2. # Install system packages
  3. RUN apt-get -qq update && apt-get -qq install --no-install-recommends -y python3 \
  4. python3-dev \
  5. python-pil \
  6. python-lxml \
  7. python-tk \
  8. build-essential \
  9. cmake \
  10. git \
  11. libgtk2.0-dev \
  12. pkg-config \
  13. libavcodec-dev \
  14. libavformat-dev \
  15. libswscale-dev \
  16. libtbb2 \
  17. libtbb-dev \
  18. libjpeg-dev \
  19. libpng-dev \
  20. libtiff-dev \
  21. libjasper-dev \
  22. libdc1394-22-dev \
  23. x11-apps \
  24. wget \
  25. vim \
  26. ffmpeg \
  27. unzip \
  28. && rm -rf /var/lib/apt/lists/*
  29. # Install core packages
  30. RUN wget -q -O /tmp/get-pip.py --no-check-certificate https://bootstrap.pypa.io/get-pip.py && python3 /tmp/get-pip.py
  31. RUN pip install -U pip \
  32. numpy \
  33. matplotlib \
  34. notebook \
  35. jupyter \
  36. pandas \
  37. moviepy \
  38. tensorflow \
  39. keras \
  40. autovizwidget \
  41. Flask
  42. # Install tensorflow models object detection
  43. RUN GIT_SSL_NO_VERIFY=true git clone -q https://github.com/tensorflow/models /usr/local/lib/python3.5/dist-packages/tensorflow/models
  44. RUN wget -q -P /usr/local/src/ --no-check-certificate https://github.com/google/protobuf/releases/download/v3.5.1/protobuf-python-3.5.1.tar.gz
  45. # Download & build protobuf-python
  46. RUN cd /usr/local/src/ \
  47. && tar xf protobuf-python-3.5.1.tar.gz \
  48. && rm protobuf-python-3.5.1.tar.gz \
  49. && cd /usr/local/src/protobuf-3.5.1/ \
  50. && ./configure \
  51. && make \
  52. && make install \
  53. && ldconfig \
  54. && rm -rf /usr/local/src/protobuf-3.5.1/
  55. # Add dataframe display widget
  56. RUN jupyter nbextension enable --py --sys-prefix widgetsnbextension
  57. # Download & build OpenCV
  58. RUN wget -q -P /usr/local/src/ --no-check-certificate https://github.com/opencv/opencv/archive/3.4.1.zip
  59. RUN cd /usr/local/src/ \
  60. && unzip 3.4.1.zip \
  61. && rm 3.4.1.zip \
  62. && cd /usr/local/src/opencv-3.4.1/ \
  63. && mkdir build \
  64. && cd /usr/local/src/opencv-3.4.1/build \
  65. && cmake -D CMAKE_INSTALL_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local/ .. \
  66. && make -j4 \
  67. && make install \
  68. && rm -rf /usr/local/src/opencv-3.4.1
  69. # Minimize image size
  70. RUN (apt-get autoremove -y; \
  71. apt-get autoclean -y)
  72. # Set TF object detection available
  73. ENV PYTHONPATH "$PYTHONPATH:/usr/local/lib/python3.5/dist-packages/tensorflow/models/research:/usr/local/lib/python3.5/dist-packages/tensorflow/models/research/slim"
  74. RUN cd /usr/local/lib/python3.5/dist-packages/tensorflow/models/research && protoc object_detection/protos/*.proto --python_out=.
  75. COPY detect_objects.py .
  76. CMD ["python3", "-u", "detect_objects.py"]