Skip to content

Instantly share code, notes, and snippets.

@aino-gautam
Last active October 3, 2023 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aino-gautam/b657c2967563ac801c37cec3608e7b96 to your computer and use it in GitHub Desktop.
Save aino-gautam/b657c2967563ac801c37cec3608e7b96 to your computer and use it in GitHub Desktop.
tensorflow 2.13, opencv 4.8.1 python binding along with object detection module research tree installation
FROM tensorflow/tensorflow:2.13.0
RUN mkdir -p /var/lib/apt/lists/partial && \
apt-get update
RUN yes yes | apt-get install wget unzip git
RUN useradd -m -s /bin/bash -G sudo od
RUN usermod -aG sudo od
RUN chmod ug+rw /etc/ld.so.cache
RUN mkdir /tf-train
RUN chown od /tf-train
# Set the user as the default user for the container
USER od
WORKDIR /tf-train
# Lines below seem redundant for tf 2.14.0
RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-x86_64.zip
RUN mkdir protoc && unzip protoc-24.3-linux-x86_64.zip -d ./protoc
ENV PATH="/tf-train/protoc/bin:/home/od/.local/bin:$PATH"
RUN rm *.zip
RUN python3 -m pip install --upgrade pip
RUN pip3 install opencv-python-headless==4.8.1.78
RUN pip3 install pillow==10.0.0
RUN pip install -U -q "tensorflow==2.13.0" "tf-models-official==2.13.0"
#RUN wget https://github.com/tensorflow/models/archive/refs/heads/r2.13.0.zip
#RUN unzip r2.13.0.zip && mv models-r2.13.0 models && rm *.zip
#added for more consistency going forward. Master changed constantly and research folder might vanish soon
RUN git clone https://github.com/ainosoft/models.git
WORKDIR /tf-train/models/research/
#COPY protoc-gen.sh .
# This statement below doesn't run within docker due to weird constraints. So python proto files are built manually and committed.
ENV PATH_TO_TF_ROOT="/tf-train"
ENV PYTHONPATH="$PYTHONPATH:$PATH_TO_TF_ROOT/models:$PATH_TO_TF_ROOT/models/research"
RUN protoc object_detection/protos/*.proto --python_out=.
RUN cp object_detection/packages/tf2/setup.py .
RUN python -m pip install .
RUN python object_detection/builders/model_builder_tf2_test.py
WORKDIR /tf-train
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment