Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stream management HTTP api #180

Merged
merged 29 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b510335
Add baseline implementation for stream management API
PawelPeczek-Roboflow Dec 7, 2023
0696b8c
Fix issues with initial implementation of stream management API
PawelPeczek-Roboflow Dec 8, 2023
7e05a66
Provide basis for class ProcessesManagerClient
PawelPeczek-Roboflow Dec 8, 2023
87382a7
Add first working version of management HTTP API
PawelPeczek-Roboflow Dec 8, 2023
4bc1d63
Change typo in object-detection
PawelPeczek-Roboflow Dec 8, 2023
f9bd8eb
Change typo in object-detection
PawelPeczek-Roboflow Dec 8, 2023
91cbd21
Add changes to handle socket operation timeouts
PawelPeczek-Roboflow Dec 11, 2023
a63f632
Add dockerisation and introduce more verbose naming convention
PawelPeczek-Roboflow Dec 11, 2023
4fa47bb
Rename env variables related to stream manager
PawelPeczek-Roboflow Dec 11, 2023
f5b252c
Add suites of unit tests for stream manager
PawelPeczek-Roboflow Dec 11, 2023
dad67ed
Finish test suites for stream manager
PawelPeczek-Roboflow Dec 11, 2023
532ff10
Add tests for stream manager client
PawelPeczek-Roboflow Dec 12, 2023
a7ebcaa
Add tests for HTTP API app
PawelPeczek-Roboflow Dec 12, 2023
82e9439
Add dockerisation for GPU and jetson
PawelPeczek-Roboflow Dec 12, 2023
2d4fd9f
Add basic documentation
PawelPeczek-Roboflow Dec 12, 2023
b265222
Add test requirement
PawelPeczek-Roboflow Dec 12, 2023
2cbaff3
Add image diagram to assets
PawelPeczek-Roboflow Dec 12, 2023
994caf7
Add documentation
PawelPeczek-Roboflow Dec 12, 2023
4f69c86
Add test dependency
PawelPeczek-Roboflow Dec 12, 2023
48b8231
Add docker builds to CI
PawelPeczek-Roboflow Dec 12, 2023
4075daa
Add documenation about local deployment
PawelPeczek-Roboflow Dec 12, 2023
14672a8
Improve docker-compose:
PawelPeczek-Roboflow Dec 12, 2023
dc40dcc
Improve docker-compose:
PawelPeczek-Roboflow Dec 12, 2023
4ba166f
Downgrade GPU image to cuda 11.4
PawelPeczek-Roboflow Dec 12, 2023
68fc653
Modify jetson docker images
PawelPeczek-Roboflow Dec 12, 2023
d2efd64
Modify jetson docker images
PawelPeczek-Roboflow Dec 12, 2023
bdcb891
Add disclaimer about slow boot for jetson devices
PawelPeczek-Roboflow Dec 12, 2023
007a578
Add example use-case description
PawelPeczek-Roboflow Dec 12, 2023
4de74fa
Rename new GH workflows to avoid names clashes
PawelPeczek-Roboflow Dec 14, 2023
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
42 changes: 42 additions & 0 deletions .github/workflows/docker.stream_management_api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build and Push CPU Container
PawelPeczek-Roboflow marked this conversation as resolved.
Show resolved Hide resolved

on:
release:
types: [created]
workflow_dispatch:

env:
VERSION: '0.0.0' # Default version, will be overwritten

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: 🛎️ Checkout
uses: actions/checkout@v3
-
name: Read version from file
run: echo "VERSION=$(DISABLE_VERSION_CHECK=true python ./inference/core/version.py)" >> $GITHUB_ENV
-
name: Build and Push
uses: docker/build-push-action@v4
with:
push: true
tags: roboflow/roboflow-inference-stream-management-api:latest,roboflow/roboflow-inference-stream-management-api:${{env.VERSION}}
cache-from: type=registry,ref=roboflow/roboflow-inference-stream-management-api:cache
cache-to: type=registry,ref=roboflow/roboflow-inference-stream-management-api:cache,mode=max
platforms: linux/amd64,linux/arm64
file: ./docker/dockerfiles/Dockerfile.stream_management_api
42 changes: 42 additions & 0 deletions .github/workflows/docker.stream_manager.cpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build and Push CPU Container
PawelPeczek-Roboflow marked this conversation as resolved.
Show resolved Hide resolved

on:
release:
types: [created]
workflow_dispatch:

env:
VERSION: '0.0.0' # Default version, will be overwritten

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: 🛎️ Checkout
uses: actions/checkout@v3
-
name: Read version from file
run: echo "VERSION=$(DISABLE_VERSION_CHECK=true python ./inference/core/version.py)" >> $GITHUB_ENV
-
name: Build and Push
uses: docker/build-push-action@v4
with:
push: true
tags: roboflow/roboflow-inference-stream-manager-cpu:latest,roboflow/roboflow-inference-stream-manager-cpu:${{env.VERSION}}
cache-from: type=registry,ref=roboflow/roboflow-inference-stream-manager-cpu:cache
cache-to: type=registry,ref=roboflow/roboflow-inference-stream-manager-cpu:cache,mode=max
platforms: linux/amd64,linux/arm64
file: ./docker/dockerfiles/Dockerfile.onnx.cpu
46 changes: 46 additions & 0 deletions .github/workflows/docker.stream_manager.gpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build and Push GPU Container
PawelPeczek-Roboflow marked this conversation as resolved.
Show resolved Hide resolved

on:
release:
types: [created]
workflow_dispatch:

env:
VERSION: '0.0.0' # Default version, will be overwritten

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: 🛎️ Checkout
uses: actions/checkout@v3
-
name: Read version from file
run: echo "VERSION=$(DISABLE_VERSION_CHECK=true python ./inference/core/version.py)" >> $GITHUB_ENV
-
name: Build and Push
uses: docker/build-push-action@v4
with:
push: true
tags: roboflow/roboflow-inference-stream-manager-gpu:latest,roboflow/roboflow-inference-stream-manager-gpu:${{env.VERSION}}
cache-from: type=registry,ref=roboflow/roboflow-inference-stream-manager-gpu:cache
cache-to: type=registry,ref=roboflow/roboflow-inference-stream-manager-gpu,mode=max
platforms: linux/amd64
file: ./docker/dockerfiles/Dockerfile.onnx.gpu.stream_manager
46 changes: 46 additions & 0 deletions .github/workflows/docker.stream_manager.jetson.5.1.1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build and Push Jetson 5.X Container
PawelPeczek-Roboflow marked this conversation as resolved.
Show resolved Hide resolved

on:
release:
types: [created]
workflow_dispatch:

env:
VERSION: '0.0.0' # Default version, will be overwritten

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: 🛎️ Checkout
uses: actions/checkout@v3
-
name: Read version from file
run: echo "VERSION=$(DISABLE_VERSION_CHECK=true python ./inference/core/version.py)" >> $GITHUB_ENV
-
name: Build and Push
uses: docker/build-push-action@v4
with:
push: true
tags: roboflow/roboflow-inference-stream-manager-jetson-5.1.1:latest,roboflow/roboflow-inference-stream-manager-jetson-5.1.1:${{ env.VERSION}}
cache-from: type=registry,ref=roboflow/roboflow-inference-stream-manager-jetson-5.1.1:cache
cache-to: type=registry,ref=roboflow/roboflow-inference-stream-manager-jetson-5.1.1:cache,mode=max
platforms: linux/arm64
file: ./docker/dockerfiles/Dockerfile.onnx.jetson.5.1.1.stream_manager
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,5 @@ inference_cli/version.py
inference_sdk/version.py

**/.DS_Store
!tests/inference/unit_tests/core/interfaces/assets/*.mp4
!tests/inference/unit_tests/core/interfaces/assets/*.mp4
!inference/enterprise/stream_management/assets/*.jpg
3 changes: 2 additions & 1 deletion development/stream_interface/udp_receiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
import os
import socket

HOST = os.getenv("HOST", "127.0.0.1")
PORT = int(os.getenv("PORT", "9999"))
BUFFER_SIZE = 65535


def main() -> None:
udp_socket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
udp_socket.bind(("127.0.0.1", PORT))
udp_socket.bind((HOST, PORT))
try:
while True:
message, _ = udp_socket.recvfrom(BUFFER_SIZE)
Expand Down
37 changes: 37 additions & 0 deletions docker/dockerfiles/Dockerfile.onnx.cpu.stream_manager
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM python:3.9

WORKDIR /app

ARG DEBIAN_FRONTEND=noninteractive

RUN apt update -y && apt install -y \
ffmpeg \
libxext6 \
libopencv-dev \
uvicorn \
python3-pip \
git \
libgdal-dev \
cmake \
&& rm -rf /var/lib/apt/lists/*

COPY requirements/requirements.cpu.txt \
requirements/requirements.http.txt \
requirements/_requirements.txt \
./

RUN pip3 install --upgrade pip && pip3 install \
-r _requirements.txt \
-r requirements.cpu.txt \
-r requirements.http.txt \
--upgrade \
&& rm -rf ~/.cache/pip

COPY inference inference

ENV VERSION_CHECK_MODE=continuous
ENV PROJECT=roboflow-platform
ENV HOST=0.0.0.0
ENV PORT=7070

ENTRYPOINT ["python", "-m", "inference.enterprise.stream_management.manager.app"]
35 changes: 35 additions & 0 deletions docker/dockerfiles/Dockerfile.onnx.gpu.stream_manager
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM nvcr.io/nvidia/cuda:11.4.2-cudnn8-runtime-ubuntu20.04

WORKDIR /app

RUN rm -rf /var/lib/apt/lists/* && apt-get clean && apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install -y \
ffmpeg \
libxext6 \
libopencv-dev \
uvicorn \
python3-pip \
git \
libgdal-dev \
&& rm -rf /var/lib/apt/lists/*

COPY requirements/requirements.http.txt \
requirements/requirements.gpu.txt \
requirements/_requirements.txt \
./

RUN pip3 install --upgrade pip && pip3 install \
-r _requirements.txt \
-r requirements.http.txt \
-r requirements.gpu.txt \
--upgrade \
&& rm -rf ~/.cache/pip

WORKDIR /app/
COPY inference inference

ENV VERSION_CHECK_MODE=continuous
ENV PROJECT=roboflow-platform
ENV HOST=0.0.0.0
ENV PORT=7070

ENTRYPOINT ["python3", "-m", "inference.enterprise.stream_management.manager.app"]
56 changes: 56 additions & 0 deletions docker/dockerfiles/Dockerfile.onnx.jetson.5.1.1.stream_manager
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
FROM nvcr.io/nvidia/l4t-ml:r35.2.1-py3

ARG DEBIAN_FRONTEND=noninteractive
ENV LANG en_US.UTF-8

RUN apt-get update -y && apt-get install -y \
lshw \
git \
python3-pip \
python3-matplotlib \
gfortran \
build-essential \
libatlas-base-dev \
ffmpeg \
libsm6 \
libxext6 \
wget \
python3-shapely \
gdal-bin \
libgdal-dev \
&& rm -rf /var/lib/apt/lists/*

COPY requirements/requirements.clip.txt \
requirements/requirements.http.txt \
requirements/_requirements.txt \
./

RUN pip3 install --ignore-installed PyYAML && rm -rf ~/.cache/pip

RUN pip3 install --upgrade pip && pip3 install \
-r _requirements.txt \
-r requirements.clip.txt \
-r requirements.http.txt \
--upgrade \
&& rm -rf ~/.cache/pip

RUN pip3 uninstall --yes onnxruntime
RUN wget https://nvidia.box.com/shared/static/v59xkrnvederwewo2f1jtv6yurl92xso.whl -O onnxruntime_gpu-1.12.1-cp38-cp38-linux_aarch64.whl
RUN pip3 install onnxruntime_gpu-1.12.1-cp38-cp38-linux_aarch64.whl "opencv-python-headless<4.3" \
&& rm -rf ~/.cache/pip \
&& rm onnxruntime_gpu-1.12.1-cp38-cp38-linux_aarch64.whl

WORKDIR /app/
COPY inference inference

ENV ORT_TENSORRT_FP16_ENABLE=1
ENV ORT_TENSORRT_ENGINE_CACHE_ENABLE=1
ENV CORE_MODEL_SAM_ENABLED=False
ENV OPENBLAS_CORETYPE=ARMV8
ENV LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1:/usr/local/lib/python3.8/dist-packages/torch.libs/libgomp-d22c30c5.so.1.0.0
ENV VERSION_CHECK_MODE=continuous
ENV PROJECT=roboflow-platform
ENV HOST=0.0.0.0
ENV PORT=7070

ENTRYPOINT ["python3", "-m", "inference.enterprise.stream_management.manager.app"]
38 changes: 38 additions & 0 deletions docker/dockerfiles/Dockerfile.stream_management_api
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM python:3.9

WORKDIR /app

ARG DEBIAN_FRONTEND=noninteractive

RUN apt update -y && apt install -y \
ffmpeg \
libxext6 \
libopencv-dev \
uvicorn \
python3-pip \
git \
libgdal-dev \
cmake \
&& rm -rf /var/lib/apt/lists/*

COPY requirements/requirements.http.txt \
requirements/requirements.cpu.txt \
requirements/_requirements.txt \
./

RUN pip3 install --upgrade pip && pip3 install \
-r _requirements.txt \
-r requirements.cpu.txt \
-r requirements.http.txt \
--upgrade \
&& rm -rf ~/.cache/pip

COPY inference inference

ENV VERSION_CHECK_MODE=continuous
ENV STREAM_MANAGEMENT_API_HOST=0.0.0.0
ENV STREAM_MANAGEMENT_API_PORT=8080
ENV STREAM_MANAGER_HOST=127.0.0.1
ENV STREAM_MANAGER_PORT=7070

ENTRYPOINT ["python", "-m", "inference.enterprise.stream_management.api.app"]
Loading
Loading