shortcut = tensorflow.keras.layers.Conv2D(filters, 1, strides=stride, use_bias=False, kernel_initializer='glorot_normal', name=name + '_0_conv')(x)
过滤器为64步长为2,名称为conv2_block1
这行在本地机器上工作得很好,但是在docker
中卡住了。下面是我的docker文件附件。
FROM python:3.7.9-buster
RUN apt-get update
&& apt-get install -y -qq
&& apt install cmake -y
&& apt-get install ffmpeg libsm6 libxext6 -y
&& apt-get clean
RUN pip3 install --upgrade pip
# Install libraries
COPY ./requirements.txt ./
RUN pip install -r requirements.txt &&
rm ./requirements.txt
RUN pip install fire
# Setup container directories
RUN mkdir /app
# Copy local code to the container
COPY . /app
# launch server with gunicorn
WORKDIR /app
EXPOSE 8080
ENV PORT 8080
ENV FLASK_CONF config.ProductionConfig
# CMD ["gunicorn", "main:app", "--timeout=60", "--preload",
# "--workers=1", "--threads=4", "--bind :$PORT"]
CMD exec gunicorn --bind :$PORT main:app --preload --workers 9 --threads 5 --timeout 120
这是我的requirements。txt
opencv-python
tensorflow==2.2.0
protobuf==3.20.*
cmake
dlib
numpy==1.16.*
卡住的问题是由于耗尽线程的资源,因此删除——preload参数完成了这项工作,因为模型将在运行时执行。