Dockerfile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. imutils
  43. # Install tensorflow models object detection
  44. RUN GIT_SSL_NO_VERIFY=true git clone -q https://github.com/tensorflow/models /usr/local/lib/python3.5/dist-packages/tensorflow/models
  45. 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
  46. # Download & build protobuf-python
  47. RUN cd /usr/local/src/ \
  48. && tar xf protobuf-python-3.5.1.tar.gz \
  49. && rm protobuf-python-3.5.1.tar.gz \
  50. && cd /usr/local/src/protobuf-3.5.1/ \
  51. && ./configure \
  52. && make \
  53. && make install \
  54. && ldconfig \
  55. && rm -rf /usr/local/src/protobuf-3.5.1/
  56. # Add dataframe display widget
  57. RUN jupyter nbextension enable --py --sys-prefix widgetsnbextension
  58. # Download & build OpenCV
  59. RUN wget -q -P /usr/local/src/ --no-check-certificate https://github.com/opencv/opencv/archive/4.0.1.zip
  60. RUN cd /usr/local/src/ \
  61. && unzip 4.0.1.zip \
  62. && rm 4.0.1.zip \
  63. && cd /usr/local/src/opencv-4.0.1/ \
  64. && mkdir build \
  65. && cd /usr/local/src/opencv-4.0.1/build \
  66. && cmake -D CMAKE_INSTALL_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local/ .. \
  67. && make -j4 \
  68. && make install \
  69. && rm -rf /usr/local/src/opencv-4.0.1
  70. # Minimize image size
  71. RUN (apt-get autoremove -y; \
  72. apt-get autoclean -y)
  73. # Set TF object detection available
  74. ENV PYTHONPATH "$PYTHONPATH:/usr/local/lib/python3.5/dist-packages/tensorflow/models/research:/usr/local/lib/python3.5/dist-packages/tensorflow/models/research/slim"
  75. RUN cd /usr/local/lib/python3.5/dist-packages/tensorflow/models/research && protoc object_detection/protos/*.proto --python_out=.
  76. COPY detect_objects.py .
  77. CMD ["python3", "-u", "detect_objects.py"]