Skip to content

Commit

Permalink
Merge pull request #311 from vcozzolino/feature-reid
Browse files Browse the repository at this point in the history
ReID to Search for an Infected COVID-19 Carrier in Pandemic Scenarios
  • Loading branch information
kubeedge-bot authored Jun 2, 2022
2 parents c7fa931 + 2e3cef9 commit c2cfc6f
Show file tree
Hide file tree
Showing 138 changed files with 34,691 additions and 24 deletions.
6,917 changes: 6,917 additions & 0 deletions build/crds/sedna.io_featureextractionservices.yaml

Large diffs are not rendered by default.

6,909 changes: 6,909 additions & 0 deletions build/crds/sedna.io_reidjobs.yaml

Large diffs are not rendered by default.

6,919 changes: 6,919 additions & 0 deletions build/crds/sedna.io_videoanalyticsjobs.yaml

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions build/gm/rbac/gm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ rules:
- datasets
- models
- jointinferenceservices
- featureextractionservices
- federatedlearningjobs
- incrementallearningjobs
- lifelonglearningjobs
- objectsearchservices
- objecttrackingservices
- reidjobs
- videoanalyticsjobs
verbs:
- get
- list
Expand All @@ -30,24 +33,30 @@ rules:
- models/status
- jointinferenceservices/status
- federatedlearningjobs/status
- featureextractionservices/status
- incrementallearningjobs/status
- lifelonglearningjobs/status
- objectsearchservices/status
- objecttrackingservices/status
- reidjobs/status
- videoanalyticsjobs/status
verbs:
- get
- update

# current we implement ai features by k8s pods, services, deployments
- apiGroups:
- ""
- "apps"
resources:
- deployments
- pods
verbs:
- create
- get
- list
- watch
- update
- delete
- apiGroups:
- "apps"
Expand Down Expand Up @@ -78,13 +87,17 @@ rules:
- nodes
verbs:
- get
- list

- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
- watch
- delete
- list
- get
---
Expand Down
6 changes: 5 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Sedna-examples
A directory to share Sedna examples and tutorials to demonstrate Sedna can implement across edge-cloud collaborative training
A directory to share Sedna examples and tutorials to demonstrate how Sedna can implement cross edge-cloud collaborative training
and collaborative inference capabilities.

This repository is home to the following features of examples:
* [Joint Inference](#joint-inference)
* [Incremental Learning](#incremental-learning)
* [Federated Learning](#federated-learning)
* [Lifelong Learning](#lifelong-learning)
* [Multi-Edge Inference](#multi-edge-inference)
* [Shared Storage](#shared-storage)

### Joint Inference
Expand All @@ -21,6 +22,9 @@ Example: [Using Federated Learning Job in Surface Defect Detection Scenario](./f
### Lifelong Learning
Example: [Using Lifelong Learning Job in Thermal Comfort Prediction Scenario](./lifelong_learning/atcii/README.md)

### Multi-Edge Inference
Example: [Using ReID to Track an Infected COVID-19 Carrier in Pandemic Scenario](./multiedgeinference/pedestrian_tracking/README.md)

### Shared Storage
| Support Protocols |Support Features| Examples |Release|
| :-------------: | :-------------: |:-------------: | :-------------: |
Expand Down
13 changes: 11 additions & 2 deletions examples/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,17 @@ fi

cd "$(dirname "${BASH_SOURCE[0]}")"

IMAGE_TAG=${IMAGE_TAG:-v0.4.0}
IMAGE_TAG=${IMAGE_TAG:-v0.5.0}
EXAMPLE_REPO_PREFIX=${IMAGE_REPO}/sedna-example-

dockerfiles_multiedgeinference=(
multi-edge-inference-feature-extraction.Dockerfile
# multi-edge-inference-gpu-feature-extraction.Dockerfile
# multi-edge-inference-gpu-videoanalytics.Dockerfile
multi-edge-inference-reid.Dockerfile
multi-edge-inference-videoanalytics.Dockerfile
)

dockerfiles_federated_learning=(
federated-learning-mistnet-yolo-aggregator.Dockerfile
federated-learning-mistnet-yolo-client.Dockerfile
Expand All @@ -83,7 +91,8 @@ incremental-learning-helmet-detection.Dockerfile
# Iterate over the input folders and build them sequentially.
for tp in ${type[@]}; do
if [[ "$tp" == "all" ]]; then
dockerfiles+=(
dockerfiles+=(
"${dockerfiles_multiedgeinference[@]}"
"${dockerfiles_federated_learning[@]}"
"${dockerfiles_joint_inference[@]}"
"${dockerfiles_lifelong_learning[@]}"
Expand Down
41 changes: 41 additions & 0 deletions examples/multi-edge-inference-feature-extraction.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM python:3.8
#FROM python:3.7-slim-bullseye

WORKDIR /home

## Install git
RUN apt update

# Required by OpenCV
RUN apt install libgl1-mesa-glx -y

# RUN apt install -y git
RUN apt install -y gfortran libopenblas-dev liblapack-dev

## Install base dependencies
RUN pip install torch torchvision tqdm opencv-python pillow pytorch-ignite

## Add Kafka Python library
RUN pip install kafka-python

# ONNX
RUN pip install onnx protobuf==3.16.0

## SEDNA SECTION ##

COPY ./lib/requirements.txt /home
RUN pip install -r /home/requirements.txt

ENV PYTHONPATH "${PYTHONPATH}:/home/lib"

WORKDIR /home/work
COPY ./lib /home/lib

# Add M3L imports
COPY examples/multiedgeinference/pedestrian_tracking/feature_extraction /home/work

ENV PYTHONPATH "${PYTHONPATH}:/home/work"
ENV LOG_LEVEL="INFO"

ENTRYPOINT ["python"]
CMD ["worker.py"]
47 changes: 47 additions & 0 deletions examples/multi-edge-inference-gpu-feature-extraction.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM pytorch/pytorch:1.8.1-cuda10.2-cudnn7-devel

WORKDIR /home

## Install git
RUN apt update -o Acquire::https::developer.download.nvidia.com::Verify-Peer=false

# Required by OpenCV
RUN apt install libglib2.0-0 libgl1 libglx-mesa0 libgl1-mesa-glx -y

# RUN apt install -y git
RUN apt install -y gfortran libopenblas-dev liblapack-dev

# Update Python
RUN apt install python3.8 python3.8-distutils python3-venv curl -y
RUN python3.8 --version
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
RUN python3.8 get-pip.py

## Install base dependencies
RUN python3.8 -m pip install torch torchvision tqdm opencv-python pillow pytorch-ignite --trusted-host=developer.download.nvidia.com

## Add Kafka Python library
RUN python3.8 -m pip install kafka-python --trusted-host=developer.download.nvidia.com

# ONNX
RUN pip install onnx protobuf==3.16.0

## SEDNA SECTION ##

COPY ./lib/requirements.txt /home
RUN python3.8 -m pip install -r /home/requirements.txt --trusted-host=developer.download.nvidia.com

# This instructions should make Sedna reachable from the dertorch code part
ENV PYTHONPATH "${PYTHONPATH}:/home/lib"

WORKDIR /home/work
COPY ./lib /home/lib

# Add M3L imports
COPY examples/multiedgeinference/pedestrian_tracking/feature_extraction /home/work

ENV PYTHONPATH "${PYTHONPATH}:/home/work"
ENV LOG_LEVEL="INFO"

ENTRYPOINT ["python3.8"]
CMD ["worker.py"]
106 changes: 106 additions & 0 deletions examples/multi-edge-inference-gpu-videoanalytics.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
FROM pytorch/pytorch:1.8.1-cuda10.2-cudnn7-devel
WORKDIR /home

RUN apt update -o Acquire::https::developer.download.nvidia.com::Verify-Peer=false

# Required by OpenCV
RUN apt install libgl1 libglx-mesa0 libgl1-mesa-glx -y
RUN apt install -y gfortran libopenblas-dev liblapack-dev

# Update Python
RUN apt install python3.8 python3.8-distutils python3-venv curl -y
RUN python3.8 --version
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
RUN python3.8 get-pip.py

######################################################
# Install OpenCV manually with gstreamer support #
######################################################

ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/London"
RUN apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools \
gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 \
gstreamer1.0-pulseaudio -y

RUN apt install ubuntu-restricted-extras wget ca-certificates -y

RUN wget -k --no-check-certificate https://github.com/opencv/opencv/archive/4.5.5.zip -O opencv.zip
RUN apt install unzip cmake -y

RUN wget -k --no-check-certificate https://github.com/opencv/opencv_contrib/archive/4.5.5.zip -O opencv_contrib.zip

RUN unzip opencv.zip
RUN unzip opencv_contrib.zip

RUN ls -la
RUN pwd

WORKDIR opencv-4.5.5
RUN mkdir build

WORKDIR build

RUN cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D INSTALL_C_EXAMPLES=OFF \
-D PYTHON_EXECUTABLE=$(which python3) \
-D BUILD_opencv_python2=OFF \
-D OPENCV_EXTRA_MODULES_PATH=/home/opencv_contrib-4.5.5/modules \
-D WITH_CUDA=ON \
-D WITH_CUDNN=OFF\
-D OPENCV_DNN_CUDA=ON\
-D ENABLE_FAST_MATH=1\
-D CUDA_FAST_MATH=1\
-D CUDA_ARCH_BIN=6.0\
-D WITH_CUBLAS=1 \
-D CMAKE_INSTALL_PREFIX=$(python3 -c "import sys; print(sys.prefix)") \
-D PYTHON3_EXECUTABLE=$(which python3) \
-D PYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-D PYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
-D WITH_GSTREAMER=ON \
-D BUILD_TIFF=ON \
-D BUILD_JPEG=ON \
-D WITH_JPEG=ON \
-D BUILD_EXAMPLES=OFF ..

RUN make -j6
RUN make install
RUN ldconfig

## Install applications dependencies
RUN pip install tqdm pillow pytorch-ignite asyncio --trusted-host=developer.download.nvidia.com

## Add Kafka Python library
RUN pip install kafka-python --trusted-host=developer.download.nvidia.com

## Add tracking dependencies
RUN pip install lap scipy Cython --trusted-host=developer.download.nvidia.com
RUN pip install cython_bbox --trusted-host=developer.download.nvidia.com

## SEDNA SECTION ##

COPY ./lib/requirements.txt /home
RUN pip install -r /home/requirements.txt --trusted-host=developer.download.nvidia.com

ENV PYTHONPATH "${PYTHONPATH}:/home/lib"

# OpenCV
RUN apt install libglib2.0-0 -y

## Install S3 library
RUN pip install boto3

# ONNX
RUN pip install onnx protobuf==3.16.0

WORKDIR /home/work
COPY ./lib /home/lib

COPY examples/multiedgeinference/pedestrian_tracking/detection/ /home/work/

ENV LOG_LEVEL="INFO"

ENTRYPOINT ["python"]
CMD ["worker.py"]
36 changes: 36 additions & 0 deletions examples/multi-edge-inference-reid.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM python:3.8

WORKDIR /home

## Install git
RUN apt update

# Required by OpenCV
RUN apt install libgl1-mesa-glx -y

RUN apt install -y gfortran libopenblas-dev liblapack-dev

## Install application dependencies
RUN pip install torch tqdm pillow opencv-python pytorch-ignite

## Add Kafka Python library
RUN pip install kafka-python

## Install S3 library
RUN pip install boto3

## SEDNA SECTION ##
COPY ./lib/requirements.txt /home
RUN pip install -r /home/requirements.txt

ENV PYTHONPATH "${PYTHONPATH}:/home/lib"

WORKDIR /home/work
COPY ./lib /home/lib

COPY examples/multiedgeinference/pedestrian_tracking/reid /home/work/

ENV LOG_LEVEL="INFO"

ENTRYPOINT ["python"]
CMD ["worker.py"]
44 changes: 44 additions & 0 deletions examples/multi-edge-inference-videoanalytics.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
FROM python:3.8

WORKDIR /home

RUN apt update

# Required by OpenCV
RUN apt install libgl1-mesa-glx -y
RUN apt install -y gfortran libopenblas-dev liblapack-dev

## Install applications dependencies
RUN pip install torch torchvision tqdm pillow opencv-python pytorch-ignite asyncio

## Install Kafka Python library
RUN pip install kafka-python

## Add tracking dependencies
RUN pip install lap scipy Cython
RUN pip install cython_bbox

## Install S3 library
RUN pip install boto3

# ONNX
RUN pip install onnx protobuf==3.16.0

WORKDIR /home

## SEDNA SECTION ##

COPY ./lib/requirements.txt /home
RUN pip install -r /home/requirements.txt

ENV PYTHONPATH "${PYTHONPATH}:/home/lib"

WORKDIR /home/work
COPY ./lib /home/lib

COPY examples/multiedgeinference/pedestrian_tracking/detection /home/work/

ENV LOG_LEVEL="DEBUG"

ENTRYPOINT ["python"]
CMD ["worker.py"]
Loading

0 comments on commit c2cfc6f

Please sign in to comment.