Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
nrandell committed Dec 10, 2019
0 parents commit 62035ba
Show file tree
Hide file tree
Showing 377 changed files with 76,131 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Docker
.git
obj
bin
build
.vs
build*.ps1
build*.sh
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.vs
build/
bin/
obj/
*.lib
*.so
*.dll
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.0)
project(OpenCvSharpAutogen)
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "limited configs" FORCE)
SET (CMAKE_CXX_STANDARD 11)

add_subdirectory(OpenVinoOpenCvSharpExtern)
130 changes: 130 additions & 0 deletions Docker/debian-buster-arm32v7-opencv/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
FROM mcr.microsoft.com/dotnet/core/runtime:3.1.0-buster-slim-arm32v7 AS dotnet-runtime

ARG DOWNLOAD_LINK=https://download.01.org/opencv/2019/openvinotoolkit/R3/l_openvino_toolkit_runtime_raspbian_p_2019.3.334.tgz
ARG INSTALL_DIR=/opt/intel/openvino
ARG TEMP_DIR=/tmp/openvino_installer

RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
libgdiplus \
libgdk3.0-cil \
wget && \
rm -rf /var/lib/apt/lists/*


RUN mkdir -p $TEMP_DIR && \
mkdir -p $INSTALL_DIR && \
cd $TEMP_DIR && \
wget -c $DOWNLOAD_LINK && \
tar -xf l_openvino_toolkit_runtime_raspbian_p_*.tgz --strip 1 -C $INSTALL_DIR && \
rm -rf ${INSTALL_DIR}/opencv

FROM dotnet-runtime as opencv-build
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
unzip \
cmake && \
rm -rf /var/lib/apt/lists/*

ARG OPENCV_VERSION=4.1.2
WORKDIR /opencvbuild

RUN wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \
unzip ${OPENCV_VERSION}.zip && \
rm ${OPENCV_VERSION}.zip && \
mv opencv-${OPENCV_VERSION} opencv && \
wget https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \
unzip ${OPENCV_VERSION}.zip && \
rm ${OPENCV_VERSION}.zip && \
mv opencv_contrib-${OPENCV_VERSION} opencv_contrib

# Build OpenCV
WORKDIR /opencvbuild/build
RUN cmake \
-D OPENCV_EXTRA_MODULES_PATH=/opencvbuild/opencv_contrib/modules \
-D InferenceEngine_DIR=/opt/intel/openvino/deployment_tools/inference_engine/share \
-D CMAKE_INSTALL_PREFIX=/opencv/install \
-D CMAKE_BUILD_TYPE=RELEASE \
-D ENABLE_NEON=ON \
-D ENABLE_VFPV3=ON \
-D WITH_OPENMP=ON \
-D WITH_TBB=ON \
-D BUILD_TBB=ON \
-D WITH_VTK=OFF \
-D WITH_INF_ENGINE=ON \
-D BUILD_EXAMPLES=OFF \
-D BUILD_DOCS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D BUILD_TESTS=OFF \
-D BUILD_JAVA=OFF \
-D BUILD_opencv_app=OFF \
-D BUILD_opencv_java=OFF \
-D BUILD_opencv_python=OFF \
-D BUILD_opencv_ts=OFF \
-D BUILD_opencv_js=OFF \
-D WITH_GSTREAMER=OFF \
-D OPENCV_ENABLE_NONFREE=ON \
../opencv

RUN make && \
make install


# Build OpenVinoOpenCvSharp
WORKDIR /OpenVinoOpenCvSharp
COPY CMakeLists.txt .
COPY OpenVinoOpenCvSharpExtern/ OpenVinoOpenCvSharpExtern/

WORKDIR /OpenVinoOpenCvSharp/build/
RUN cmake \
-D OpenCV_DIR=/opencvbuild/install/cmake \
-D InferenceEngine_DIR=/opt/intel/openvino/deployment_tools/inference_engine/share \
-D CMAKE_INSTALL_PREFIX=../install \
..

RUN make -j4 && \
make install


FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/core/sdk:3.1.100-buster AS build
WORKDIR /build

COPY OpenVinoOpenCvSharp/OpenVinoOpenCvSharp.csproj OpenVinoOpenCvSharp/
COPY PeopleDetectionOpenCV/PeopleDetectionOpenCV.csproj PeopleDetectionOpenCV/
COPY Shared/Shared.csproj Shared/
COPY FaceDetectionOpenVino/FaceDetectionOpenVino.csproj FaceDetectionOpenVino/

RUN dotnet restore PeopleDetectionOpenCV/PeopleDetectionOpenCV.csproj
RUN dotnet restore FaceDetectionOpenVino/FaceDetectionOpenVino.csproj

COPY OpenVinoOpenCvSharp/ OpenVinoOpenCvSharp/
COPY PeopleDetectionOpenCV/ PeopleDetectionOpenCV/
COPY Shared/ Shared/
COPY FaceDetectionOpenVino/ FaceDetectionOpenVino/

WORKDIR /build/PeopleDetectionOpenCV
RUN dotnet build -c Release

WORKDIR /build/FaceDetectionOpenVino
RUN dotnet build -c Release

FROM build AS publish
WORKDIR /build/PeopleDetectionOpenCV
RUN dotnet publish --no-build -c Release -o /app/PeopleDetectionOpenCV/publish

WORKDIR /build/FaceDetectionOpenVino
RUN dotnet publish --no-build -c Release -o /app/FaceDetectionOpenVino/publish

FROM dotnet-runtime as final
WORKDIR /app
COPY --from=opencv-build /opencvsharp/install/ /opt/opencv/
COPY --from=opencv-build /OpenVinoOpenCvSharp/install/lib/libOpenVinoOpenCvSharpExtern.so /opt/

ENV LD_LIBRARY_PATH=/opt:/opt/opencv/lib:/opt/intel/openvino/deployment_tools/inference_engine/lib/armv7l

COPY --from=publish /app/ .

# COPY PeopleDetectionOpenCV/run.sh .
# RUN chmod a+x run.sh

# ENTRYPOINT [ "./run.sh" ]
5 changes: 5 additions & 0 deletions Docker/debian-buster-arm32v7-opencv/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$VERSION="1.0.0"

docker buildx build --platform linux/arm/v7 -t "nrandell/arm-opencv-nick-builder:$VERSION" -f Dockerfile --push ../..


82 changes: 82 additions & 0 deletions Docker/debian-buster-arm32v7/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
FROM mcr.microsoft.com/dotnet/core/runtime:3.1.0-buster-slim-arm32v7 AS dotnet-runtime

ARG DOWNLOAD_LINK=https://download.01.org/opencv/2019/openvinotoolkit/R3/l_openvino_toolkit_runtime_raspbian_p_2019.3.334.tgz
ARG INSTALL_DIR=/opt/intel/openvino
ARG TEMP_DIR=/tmp/openvino_installer

RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
libgdiplus \
libgdk3.0-cil \
wget && \
rm -rf /var/lib/apt/lists/*


RUN mkdir -p $TEMP_DIR && \
mkdir -p $INSTALL_DIR && \
cd $TEMP_DIR && \
wget -c $DOWNLOAD_LINK && \
tar -xf l_openvino_toolkit_runtime_raspbian_p_*.tgz --strip 1 -C $INSTALL_DIR


FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/core/sdk:3.1.100-buster AS build
WORKDIR /build

COPY OpenVinoOpenCvSharp/OpenVinoOpenCvSharp.csproj OpenVinoOpenCvSharp/
COPY PeopleDetectionOpenCV/PeopleDetectionOpenCV.csproj PeopleDetectionOpenCV/
COPY Shared/Shared.csproj Shared/
COPY FaceDetectionOpenVino/FaceDetectionOpenVino.csproj FaceDetectionOpenVino/

RUN dotnet restore PeopleDetectionOpenCV/PeopleDetectionOpenCV.csproj
RUN dotnet restore FaceDetectionOpenVino/FaceDetectionOpenVino.csproj

COPY OpenVinoOpenCvSharp/ OpenVinoOpenCvSharp/
COPY PeopleDetectionOpenCV/ PeopleDetectionOpenCV/
COPY Shared/ Shared/
COPY FaceDetectionOpenVino/ FaceDetectionOpenVino/

WORKDIR /build/PeopleDetectionOpenCV
RUN dotnet build -c Release

WORKDIR /build/FaceDetectionOpenVino
RUN dotnet build -c Release

FROM mcr.microsoft.com/dotnet/core/sdk:3.1.100-buster-arm32v7 as build-native-env

COPY --from=dotnet-runtime /opt/intel/ /opt/intel/

RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake && \
rm -rf /var/lib/apt/lists/*

WORKDIR /OpenVinoOpenCvSharp
COPY CMakeLists.txt .
COPY OpenVinoOpenCvSharpExtern/ OpenVinoOpenCvSharpExtern/

WORKDIR /OpenVinoOpenCvSharp/build/
RUN cmake \
-D OpenCV_DIR=/opt/intel/openvino/opencv/cmake \
-D CMAKE_INSTALL_PREFIX=../install \
..

RUN cmake --build . --target install --config Release


FROM build AS publish
WORKDIR /build/PeopleDetectionOpenCV
RUN dotnet publish --no-build -c Release -o /app/PeopleDetectionOpenCV/publish

WORKDIR /build/FaceDetectionOpenVino
RUN dotnet publish --no-build -c Release -o /app/FaceDetectionOpenVino/publish

FROM dotnet-runtime as final
WORKDIR /app
COPY --from=build-native-env /OpenVinoOpenCvSharp/install/lib/libOpenVinoOpenCvSharpExtern.so .

COPY --from=publish /app/ .

COPY PeopleDetectionOpenCV/run.sh .
RUN chmod a+x run.sh

ENTRYPOINT [ "./run.sh" ]
5 changes: 5 additions & 0 deletions Docker/debian-buster-arm32v7/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$VERSION="1.0.3"

docker buildx build --platform linux/arm/v7 -t "nrandell/arm-nick-builder:$VERSION" -f Dockerfile --push ../..


80 changes: 80 additions & 0 deletions Docker/ubuntu-18.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
FROM ubuntu:18.04 as build-native-env

ARG DOWNLOAD_LINK=http://registrationcenter-download.intel.com/akdlm/irc_nas/16057/l_openvino_toolkit_p_2019.3.376.tgz
ARG INSTALL_DIR=/opt/intel/openvino
ARG TEMP_DIR=/tmp/openvino_installer
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
cpio \
sudo \
lsb-release && \
rm -rf /var/lib/apt/lists/*
RUN mkdir -p $TEMP_DIR && cd $TEMP_DIR && \
wget -c $DOWNLOAD_LINK && \
tar xf l_openvino_toolkit*.tgz && \
cd l_openvino_toolkit*

RUN cd $TEMP_DIR && \
cd l_openvino_toolkit* && \
sed -i 's/decline/accept/g' silent.cfg && \
./install.sh -s silent.cfg && \
rm -rf $TEMP_DIR

RUN $INSTALL_DIR/install_dependencies/install_openvino_dependencies.sh

WORKDIR /OpenVinoOpenCvSharp
COPY CMakeLists.txt .
COPY OpenVinoOpenCvSharpExtern/ OpenVinoOpenCvSharpExtern/

WORKDIR /OpenVinoOpenCvSharp/build/
RUN cmake \
-D OpenCV_DIR=/opt/intel/openvino/opencv/cmake \
-D CMAKE_INSTALL_PREFIX=../install \
..

RUN cmake --build . --target install --config Release

FROM mcr.microsoft.com/dotnet/core/sdk:3.1.100-bionic AS build-dotnet-env
WORKDIR /build

COPY OpenVinoOpenCvSharp/OpenVinoOpenCvSharp.csproj OpenVinoOpenCvSharp/
COPY PeopleDetectionOpenCV/PeopleDetectionOpenCV.csproj PeopleDetectionOpenCV/
COPY Shared/Shared.csproj Shared/
RUN dotnet restore PeopleDetectionOpenCV/PeopleDetectionOpenCV.csproj

COPY OpenVinoOpenCvSharp/ OpenVinoOpenCvSharp/
COPY PeopleDetectionOpenCV/ PeopleDetectionOpenCV/
COPY Shared/ Shared/

WORKDIR /build/PeopleDetectionOpenCV
RUN dotnet build -c Release

FROM build-dotnet-env AS publish
RUN dotnet publish --no-build -c Release -o /app/publish

FROM mcr.microsoft.com/dotnet/core/runtime:3.1.0-bionic AS dotnet-runtime

RUN apt update
RUN apt install -y --no-install-recommends software-properties-common
RUN add-apt-repository -y ppa:jonathonf/ffmpeg-4
RUN apt update
RUN apt install -y --no-install-recommends ffmpeg

WORKDIR /app
COPY --from=build-native-env /opt/intel/ /opt/intel/
RUN /opt/intel/openvino/install_dependencies/install_openvino_dependencies.sh

RUN apt install -y --no-install-recommends libgdiplus
RUN echo "deb http://ppa.launchpad.net/intel-opencl/intel-opencl/ubuntu bionic main" >/etc/apt/sources.list.d/intel-opencl.list
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B9732172C4830B8F
RUN apt update
RUN apt install -y intel-opencl-icd clinfo
COPY --from=build-native-env /OpenVinoOpenCvSharp/install/lib/libOpenVinoOpenCvSharpExtern.so .


COPY --from=publish /app/publish .

COPY PeopleDetectionOpenCV/run.sh .
RUN chmod a+x run.sh

ENTRYPOINT [ "./run.sh" ]
6 changes: 6 additions & 0 deletions Docker/ubuntu-18.04/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$VERSION="1.0.4"

docker build -t "nrandell/nick-builder:$VERSION" -f Dockerfile ../..
docker push "nrandell/nick-builder:$VERSION"


15 changes: 15 additions & 0 deletions FaceDetectionOpenVino/FaceDetectionOpenVino.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Platforms>x64</Platforms>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\OpenVinoOpenCvSharp\OpenVinoOpenCvSharp.csproj" />
<ProjectReference Include="..\Shared\Shared.csproj" />
</ItemGroup>

</Project>
Loading

0 comments on commit 62035ba

Please sign in to comment.