Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 0 additions & 48 deletions GPU/dockerfile

This file was deleted.

5 changes: 0 additions & 5 deletions GPU/requirements.txt

This file was deleted.

20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This repository can be deployed using **docker**.

- Ubuntu 18.04 or 20.04 LTS
- Windows 10 pro with **hyper-v** enabled and **docker** desktop
- NVIDIA Drivers (410.x or higher)
- NVIDIA Drivers (418.x or higher)
- Docker CE latest stable release
- NVIDIA Docker 2
- Git lfs (large file storage) : [installation](https://github.com/git-lfs/git-lfs/wiki/Installation)
Expand Down Expand Up @@ -61,14 +61,19 @@ To build the docker environment, run the following command in the project's dire

- For GPU Build:

> **_NOTE:_** Follow this link to acquire nvcr private key:
> https://docs.nvidia.com/launchpad/ai/base-command-coe/latest/bc-coe-docker-basics-step-02.html


```sh
docker build -t gluoncv_segmentation_inference_api_gpu -f ./GPU/dockerfile .
docker login nvcr.io
docker build -t gluoncv_segmentation_inference_api_gpu -f ./docker/GPU/dockerfile .
```

- For CPU Build:

```
docker build -t gluoncv_segmentation_inference_api_cpu -f ./CPU/dockerfile .
docker build -t gluoncv_segmentation_inference_api_cpu -f ./docker/CPU/dockerfile .
```


Expand All @@ -77,14 +82,19 @@ docker build -t gluoncv_segmentation_inference_api_cpu -f ./CPU/dockerfile .

- For GPU Build:

> **_NOTE:_** Follow this link to acquire nvcr private key:
> https://docs.nvidia.com/launchpad/ai/base-command-coe/latest/bc-coe-docker-basics-step-02.html


```sh
docker build --build-arg http_proxy='' --build-arg https_proxy='' -t gluoncv_segmentation_inference_api_gpu -f ./GPU/dockerfile .
docker login nvcr.io
docker build --build-arg http_proxy='' --build-arg https_proxy='' -t gluoncv_segmentation_inference_api_gpu -f ./docker/GPU/dockerfile .
```

- For CPU Build:

```sh
docker build --build-arg http_proxy='' --build-arg https_proxy='' -t gluoncv_segmentation_inference_api_cpu -f ./CPU/dockerfile .
docker build --build-arg http_proxy='' --build-arg https_proxy='' -t gluoncv_segmentation_inference_api_cpu -f ./docker/CPU/dockerfile .
```


Expand Down
23 changes: 11 additions & 12 deletions CPU/dockerfile → docker/CPU/dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7
FROM python:3.8


RUN apt-get update && apt-get install --fix-missing -y \
Expand All @@ -12,24 +12,23 @@ RUN apt-get update && apt-get install --fix-missing -y \
libopencv-dev \
graphviz \
libssl-dev
RUN pip install --upgrade pip




RUN wget https://github.com/Kitware/CMake/releases/download/v3.16.5/cmake-3.16.5.tar.gz && tar -zxvf cmake-3.16.5.tar.gz && cd cmake-3.16.5 && ./bootstrap && make && make install
RUN git clone --recursive https://github.com/apache/incubator-mxnet.git -b v1.7.x
RUN cd incubator-mxnet && mkdir build && cd build && cmake -DUSE_CUDA=OFF -DUSE_MKL_IF_AVAILABLE=ON -DUSE_MKLDNN=ON -DUSE_OPENMP=ON -DUSE_OPENCV=ON .. && make -j $(nproc) && cd ../python && python setup.py install

RUN pip install Pillow \
pytest \
# fastapi dependencies
fastapi[all] \
# project dependencies
numpy \
gluoncv \
opencv-python

RUN pip install jsonschema
# copy package requirements
COPY docker/CPU/requirements.txt .
# install packages
RUN pip3 install --upgrade pip
RUN pip3 install -r requirements.txt

COPY /gluoncv /usr/local/lib/python3.8/site-packages/gluoncv/

COPY /gluoncv /usr/local/lib/python3.6/site-packages/gluoncv/

WORKDIR /main

Expand Down
8 changes: 8 additions & 0 deletions docker/CPU/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# all needed libraries with version
fastapi[all]==0.73.0
jsonschema==4.0.0
Pillow==8.4.0
pytest==7.0.0
numpy==1.22.2
opencv-python==4.5.5.62
gluoncv==0.10.4.post4
33 changes: 33 additions & 0 deletions docker/GPU/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM nvcr.io/nvidia/cuda:11.2.1-cudnn8-runtime-ubuntu18.04

LABEL maintainer "BMW InnovationLab"
ARG DEBIAN_FRONTEND=noninteractive


COPY src/main /main

RUN apt-get update && apt-get upgrade -y && apt-get install -y \
locales \
software-properties-common \
python3-pip \
python3-dev \
pkg-config \
ffmpeg

# copy package requirements
COPY docker/GPU/requirements.txt .

# install packages
RUN pip3 install --upgrade pip
RUN pip3 install -r requirements.txt

# configure uvicorn
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8

ENV LANG en_US.UTF-8

WORKDIR /main

CMD ["uvicorn", "start:app", "--host", "0.0.0.0", "--port", "4343"]
9 changes: 9 additions & 0 deletions docker/GPU/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# all needed libraries with version
fastapi[all]==0.73.0
jsonschema==4.0.0
Pillow==8.4.0
pytest==7.0.0
numpy==1.19.5
opencv-python==4.5.5.62
gluoncv==0.10.4.post4
mxnet-cu112==1.9.0