Dockerfile 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # #==========================================================================
  15. FROM tensorflow/tensorflow
  16. # Define environment variable
  17. ENV WORKPATH /tensorflow
  18. WORKDIR $WORKPATH
  19. COPY . $WORKPATH/
  20. EXPOSE 8888 6006
  21. RUN apt-get update
  22. RUN apt-get upgrade -y
  23. RUN apt-get install -y git
  24. # Get the tensorflow models research directory, and move it into tensorflow
  25. # source folder to match recommendation of installation
  26. RUN git clone --depth 1 https://github.com/tensorflow/models.git
  27. RUN mv object_detection_wildfire.ipynb /tensorflow/models/research/object_detection/ && \
  28. mv create_tf_record.py /tensorflow/models/research/object_detection/
  29. # Install the Tensorflow Object Detection API from here
  30. # https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md
  31. # Install object detection api dependencies
  32. RUN apt-get install -y protobuf-compiler python-pil python-lxml python-tk && \
  33. pip install Cython && \
  34. pip install contextlib2 && \
  35. pip install jupyter && \
  36. pip install matplotlib
  37. # Install pycocoapi
  38. RUN git clone --depth 1 https://github.com/cocodataset/cocoapi.git && \
  39. cd cocoapi/PythonAPI && \
  40. make -j8 && \
  41. cp -r pycocotools /tensorflow/models/research && \
  42. cd ../../ && \
  43. rm -rf cocoapi
  44. # Get protoc 3.0.0, rather than the old version already in the container
  45. RUN curl -OL "https://github.com/google/protobuf/releases/download/v3.0.0/protoc-3.0.0-linux-x86_64.zip" && \
  46. unzip protoc-3.0.0-linux-x86_64.zip -d proto3 && \
  47. mv proto3/bin/* /usr/local/bin && \
  48. mv proto3/include/* /usr/local/include && \
  49. rm -rf proto3 protoc-3.0.0-linux-x86_64.zip
  50. # Run protoc on the object detection repo
  51. RUN cd /tensorflow/models/research && \
  52. protoc object_detection/protos/*.proto --python_out=.
  53. # Set the PYTHONPATH to finish installing the API
  54. ENV PYTHONPATH $PYTHONPATH:/tensorflow/models/research:/tensorflow/models/research/slim
  55. # Install wget (to make life easier below) and editors (to allow people to edit
  56. # the files inside the container)
  57. RUN apt-get install -y wget vim emacs nano
  58. # Grab various data files which are used throughout the demo: dataset,
  59. # pretrained model.
  60. # Pretrained model
  61. RUN curl -O "http://download.tensorflow.org/models/object_detection/faster_rcnn_resnet101_coco_11_06_2017.tar.gz" && \
  62. mkdir train && \
  63. tar xzf faster_rcnn_resnet101_coco_11_06_2017.tar.gz && \
  64. rm faster_rcnn_resnet101_coco_11_06_2017.tar.gz && \
  65. mv faster_rcnn_resnet101_coco_11_06_2017 train/ && \
  66. mv faster_rcnn_resnet101.config train/
  67. ENTRYPOINT ["/bin/bash"]