0

我们正在尝试在 GCP 上托管 tensorflow 对象检测模型。我们在运行“ gcloud app deploy ”之前维护了以下目录结构。为方便起见,我附上了问题的配置文件。我们正在收到下面提到的部署错误。请提出解决方案。

  • +根
    • +object_detection/
    • +苗条/
    • +环境
    • +app.yaml
    • +Dockerfile
    • +requirement.txt
    • +index.html
    • +test.py

Dockerfile



    FROM gcr.io/google-appengine/python
    LABEL python_version=python2.7
    RUN virtualenv --no-download /env -p python2.7

    # Set virtualenv environment variables. This is equivalent to running
    # source /env/bin/activate
    ENV VIRTUAL_ENV /env
    ENV PATH /env/bin:$PATH

    # Various Python and C/build deps
    RUN apt-get update && apt-get install -y \ 
        wget \
        build-essential \ 
        cmake \ 
        git \
        unzip \ 
        pkg-config \
        python-dev \ 
        python-opencv \ 
        libopencv-dev \ 
        libav-tools  \ 
        libjpeg-dev \ 
        libpng-dev \ 
        libtiff-dev \ 
        libjasper-dev \ 
        libgtk2.0-dev \ 
        python-numpy \ 
        python-pycurl \ 
        libatlas-base-dev \
        gfortran \
        webp \ 
        python-opencv \ 
        qt5-default \
        libvtk6-dev \ 
        zlib1g-dev \
        protobuf-compiler \
        python-pil python-lxml \
        python-tk


    # Install Open CV - Warning, this takes absolutely forever

    ADD requirements.txt /app/
    RUN pip install -r requirements.txt
    ADD . /app/
    RUN protoc /app/object_detection/protos/*.proto --python_out=/app/.
    RUN export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/app/slim
    CMD exec gunicorn -b :$PORT UploadTest:app


需求.txt



    Flask==0.12.2
    gunicorn==19.7.1
    numpy==1.13.1
    requests==0.11.1
    bs4==0.0.1
    nltk==3.2.1
    pymysql==0.7.2
    xlsxwriter==0.8.5
    Pillow==4.2.1
    pytesseract==0.1
    opencv-python>=3.0
    matplotlib==2.0.2
    tensorflow==1.3.0
    lxml==4.0.0


应用程序.yaml



    runtime: custom
    env: flex
    entrypoint: gunicorn -b :$PORT UploadTest:app
    threadsafe: true
    runtime_config:
      python_version: 2


毕竟,我正在使用gcloud init建立谷歌云环境, 然后启动命令gcloud app deploy

部署解决方案时出现以下错误。

错误:



    Step 10/12 : RUN protoc /app/object_detection/protos/*.proto    --python_out=/app/.
    ---> Running in 9b3ec9c43c2d
    /app/object_detection/protos/anchor_generator.proto: File does not reside  within any path specified using --proto_path (or -I).  You must specify a   --proto_path which encompasses this file.  Note that the proto_path must be an exact prefix of the .proto file names -- protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it's harder than you think).
    The command '/bin/sh -c protoc /app/object_detection/protos/*.proto --python_out=/app/.' returned a non-zero code: 1
    ERROR
    ERROR: build step "gcr.io/cloud-builders/docker@sha256:a4a83be9b2fb61452e864ecf1bcfca99d1845499ef9500ae2905cea0ea593769" failed: exit status 1

    ----------------------------------------------------------------------------------------------------------------------------------------------

    ERROR: (gcloud.app.deploy) Cloud build failed. Check logs at https://console.cloud.google.com/gcr/builds/4dba3217-b7d6-4341-b28e-09a9dad45c18?

有一个目录“object_detection/protos”,所有必要的文件都在那里。仍然收到部署错误。请建议在 dockerfile 中更改何处以成功部署它。

我的假设: GCP 无法找出 protc 文件的路径。可能我必须更改 Docketfile 中的某些内容。但无法弄清楚解决方案。请回答。

注意:此设置在本地机器上运行良好。但不能在 GCP 中工作

4

0 回答 0