Skip to content

Commit 371916e

Browse files
committed
added vision_edge_ai branch (#373)
1 parent d8cdfa5 commit 371916e

34 files changed

+4781
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ Based on the platform you are using, select the following to get started:
3131
5. [LLM Finetuning Benchmark](usecases/ai/finetuning-benchmark/README.md)
3232
6. [LLM RAG Toolkit](usecases/ai/rag-toolkit/README.md)
3333
7. [AI Video Analytics](usecases/ai/ai-video-analytics/README.md)
34-
7. [Digital Avatar](usecases/ai/digital-avatar/README.md)
35-
34+
8. [Digital Avatar](usecases/ai/digital-avatar/README.md)
35+
9. [Vision Edge AI](usecases/ai/vision-edge-ai/README.md)
3636
## Disclaimer
3737
GStreamer* is an open source framework licensed under LGPL. See https://gstreamer.freedesktop.org/documentation/frequently-asked-questions/licensing.html. You are solely responsible for determining if your use of GStreamer requires any additional licenses. Intel is not responsible for obtaining any such licenses, nor liable for any licensing fees due, in connection with your use of GStreamer.
3838

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
FROM ubuntu:24.10
5+
6+
ARG DEBIAN_FRONTEND=noninteractive
7+
USER root
8+
9+
#--------------------------------------------------------------------------------------------------------------------------
10+
# Essential Tools
11+
#--------------------------------------------------------------------------------------------------------------------------
12+
13+
RUN apt update -y && apt install -y \
14+
software-properties-common \
15+
build-essential \
16+
wget \
17+
gpg \
18+
curl \
19+
pciutils \
20+
git \
21+
cmake \
22+
libopencv-dev \
23+
v4l-utils \
24+
libusb-1.0-0-dev \
25+
libssl-dev \
26+
libgtk-3-dev \
27+
pkg-config \
28+
udev \
29+
libudev-dev \
30+
libglfw3-dev \
31+
libgl1-mesa-dev \
32+
libglu1-mesa-dev \
33+
python3-pip \
34+
python3-dev \
35+
python3-setuptools \
36+
python3-opencv
37+
38+
#--------------------------------------------------------------------------------------------------------------------------
39+
# Graphic & NPU drivers and tools
40+
#--------------------------------------------------------------------------------------------------------------------------
41+
42+
# Install Intel GPU Drivers
43+
RUN wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | \
44+
gpg --dearmor --output /usr/share/keyrings/intel-graphics.gpg && \
45+
echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] \
46+
https://repositories.intel.com/gpu/ubuntu noble client" \
47+
> /etc/apt/sources.list.d/intel-gpu-noble.list && \
48+
apt update -y && apt install -y libze1 intel-level-zero-gpu intel-opencl-icd clinfo
49+
50+
# Install Intel NPU Drivers
51+
WORKDIR /tmp
52+
RUN apt install -y libtbb12
53+
RUN wget https://github.com/intel/linux-npu-driver/releases/download/v1.10.0/intel-driver-compiler-npu_1.10.0.20241107-11729849322_ubuntu24.04_amd64.deb \
54+
https://github.com/intel/linux-npu-driver/releases/download/v1.10.0/intel-fw-npu_1.10.0.20241107-11729849322_ubuntu24.04_amd64.deb \
55+
https://github.com/intel/linux-npu-driver/releases/download/v1.10.0/intel-level-zero-npu_1.10.0.20241107-11729849322_ubuntu24.04_amd64.deb && \
56+
dpkg -i *.deb && rm -f *.deb
57+
58+
# Install Intel PCM Tool
59+
RUN git clone --recursive https://github.com/intel/pcm && \
60+
cd pcm && mkdir build && cd build && \
61+
cmake .. && cmake --build . --parallel && make install && \
62+
rm -rf /tmp/pcm
63+
64+
#--------------------------------------------------------------------------------------------------------------------------
65+
# OpenVINO
66+
#--------------------------------------------------------------------------------------------------------------------------
67+
68+
WORKDIR /opt/intel
69+
# Install OpenVINO
70+
RUN curl -L https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.5/linux/l_openvino_toolkit_ubuntu24_2024.5.0.17288.7975fa5da0c_x86_64.tgz \
71+
--output openvino.tgz
72+
RUN tar -xf openvino.tgz
73+
RUN mv l_openvino_toolkit_ubuntu24_2024.5.0.17288.7975fa5da0c_x86_64 openvino
74+
RUN cd openvino && sed -i 's/24\.04/24\.10/g' ./install_dependencies/install_openvino_dependencies.sh && \
75+
bash ./install_dependencies/install_openvino_dependencies.sh -y
76+
ENV OPENVINO_DIR=/opt/intel/openvino
77+
RUN pip install --pre -U openvino openvino-dev --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly --break-system-packages
78+
79+
#--------------------------------------------------------------------------------------------------------------------------
80+
# librealsense
81+
#--------------------------------------------------------------------------------------------------------------------------
82+
83+
WORKDIR /tmp
84+
RUN git clone https://github.com/IntelRealSense/librealsense
85+
86+
RUN cd librealsense && mkdir build && cd build && \
87+
cmake .. -DBUILD_PYTHON_BINDINGS=ON -DPYTHON_EXECUTABLE=$(which python3) && \
88+
make -j$(nproc) && \
89+
make install && \
90+
ldconfig
91+
92+
#python3 -m pip install --no-cache-dir pyrealsense2 --break-system-packages
93+
94+
ENV PYTHONPATH=/usr/local/lib/python3.12/dist-packages
95+
96+
#--------------------------------------------------------------------------------------------------------------------------
97+
# Required Python Packages
98+
#--------------------------------------------------------------------------------------------------------------------------
99+
100+
RUN pip3 install --break-system-packages \
101+
fire \
102+
distro \
103+
zeroconf \
104+
psutil \
105+
cython \
106+
prometheus-client \
107+
zeroconf
108+
109+
RUN pip3 install --break-system-packages \
110+
yt-dlp \
111+
youtube_dl \
112+
pafy
113+
114+
RUN apt remove -y python3-blinker || true
115+
RUN pip3 install --break-system-packages \
116+
flask \
117+
flask_bootstrap
118+
119+
RUN pip3 install --break-system-packages \
120+
nncf \
121+
ultralytics
122+
123+
#--------------------------------------------------------------------------------------------------------------------------
124+
# Video Steams Download
125+
#--------------------------------------------------------------------------------------------------------------------------
126+
127+
WORKDIR /opt/videos
128+
129+
RUN wget -O streat.mp4 https://videos.pexels.com/video-files/3759216/3759216-sd_640_360_30fps.mp4
130+
#RUN wget -O animals.mp4 https://videos.pexels.com/video-files/4938060/4938060-uhd_2732_1440_30fps.mp4
131+
132+
#--------------------------------------------------------------------------------------------------------------------------
133+
# Models Preparation
134+
#--------------------------------------------------------------------------------------------------------------------------
135+
136+
WORKDIR /opt/models
137+
138+
COPY ./utils/models.sh /tmp/
139+
RUN /tmp/models.sh
140+
141+
142+
143+
RUN rm -rf /tmp/*
144+
145+
WORKDIR /workspace
146+
147+
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
#----------------------------------------------------------------------------------------------------------------------
5+
# Flags
6+
#----------------------------------------------------------------------------------------------------------------------
7+
SHELL := /bin/bash
8+
CURRENT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
9+
10+
DOCKER_IMAGE_NAME = vision_edge_ai
11+
SERVICE_NAME = vision_edge_ai
12+
13+
# Proxy settings (default to empty if not set)
14+
PORT ?= 80
15+
export PORT
16+
17+
HOST_ADDRESS="0.0.0.0"
18+
export HOST_ADDRESS
19+
20+
#----------------------------------------------------------------------------------------------------------------------
21+
# Docker Settings
22+
#----------------------------------------------------------------------------------------------------------------------
23+
export DOCKER_BUILDKIT=1
24+
25+
DOCKER_COMPOSE_ENV = \
26+
DOCKER_IMAGE_NAME=$(DOCKER_IMAGE_NAME) \
27+
HTTP_PROXY=$(HTTP_PROXY) \
28+
HTTPS_PROXY=$(HTTPS_PROXY) \
29+
NO_PROXY=$(NO_PROXY) \
30+
MKL_THREADING_LAYER=gnu \
31+
CURRENT_DIR=$(CURRENT_DIR) \
32+
PORT=${PORT} \
33+
HOST_ADDRESS=$(HOST_ADDRESS)
34+
35+
#----------------------------------------------------------------------------------------------------------------------
36+
# Targets
37+
#----------------------------------------------------------------------------------------------------------------------
38+
default: run
39+
40+
.PHONY: build app run bash
41+
42+
build:
43+
@$(call msg, Building Docker image ${DOCKER_IMAGE_NAME} ...)
44+
@$(DOCKER_COMPOSE_ENV) docker-compose build
45+
@docker-compose run --rm $(SERVICE_NAME) bash -c \
46+
'cd ./utils/ && python3 setup.py build_ext --quiet --inplace'
47+
48+
run: stop
49+
@$(call msg, Running the Vision Edge AI application ...)
50+
@docker-compose up -d
51+
52+
stop: build
53+
@$(call msg, Stopping the Vision Edge AI application ...)
54+
@docker-compose down --remove-orphans # Ensure old orphaned containers are removed
55+
56+
install_prerequisites:
57+
@$(call msg, Installing Prerequisites ...)
58+
@cd ./tools && bash ./install.sh
59+
60+
61+
bash:
62+
@$(call msg, Opening a bash session in the container ...)
63+
@docker-compose run --rm $(SERVICE_NAME) bash
64+
65+
#----------------------------------------------------------------------------------------------------------------------
66+
# Helper Functions
67+
#----------------------------------------------------------------------------------------------------------------------
68+
define msg
69+
tput setaf 2 && \
70+
for i in $(shell seq 1 120 ); do echo -n "-"; done; echo "" && \
71+
echo " "$1 && \
72+
for i in $(shell seq 1 120 ); do echo -n "-"; done; echo "" && \
73+
tput sgr0
74+
endef
75+
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
2+
# VisionEdgeAI
3+
4+
VisionEdgeAI is a Flask web application designed for real-time AI-based vision processing. It enables users to process and analyze video streams efficiently using AI models, all through a simple and interactive web interface. The application is Docker-based and Intel hardware agnostic, ensuring compatibility across various Intel platforms.
5+
6+
<p align="center">
7+
<img src="static/images/screenshot_1.png" alt="VisionEdgeAI Screenshot">
8+
</p>
9+
10+
---
11+
12+
## Features:
13+
- **Web-based UI** for easy interaction.
14+
- **Real-time AI inference** for vision tasks.
15+
- **Supports multiple AI models**.
16+
- **Optimized for CPU, GPU, and NPU acceleration**.
17+
18+
## Supported Distributions
19+
This application currently supports the following Ubuntu versions:
20+
- **Ubuntu 22.04**
21+
- **Ubuntu 24.04**
22+
- **Ubuntu 24.10**
23+
24+
## Installation Instructions
25+
26+
1. **Clone or Extract the Repository**
27+
If you haven't already, clone or unzip the VisionEdgeAI project.
28+
29+
2. **Navigate to the Project Directory**
30+
```bash
31+
cd vision-edge-ai
32+
```
33+
34+
3. **Install Dependencies**
35+
Run the following command to install prerequisites (kernel, GPU & NPU drivers, Docker):
36+
```bash
37+
make install_prerequisites
38+
```
39+
For detailed instructions on setting up dependencies, refer to the [tools/README.md](tools/README.md) file.
40+
41+
4. **Start the Application**
42+
To start the application, run:
43+
```bash
44+
make
45+
```
46+
47+
By default, the application binds to 0.0.0.0, allowing it to be accessible from other machines. To restrict access to the local machine only, you can set the HOST_ADDRESS environment variable. To do this, run
48+
```bash
49+
export HOST_ADDRESS="127.0.0.1"
50+
```
51+
52+
5. **Stop the Application**
53+
To stop the application, run:
54+
```bash
55+
make stop
56+
```
57+
58+
## Usage Instructions
59+
60+
1. **Open a Web Browser**
61+
Once the Flask application starts, access it by opening the following URL in your browser:
62+
```
63+
http://<server-ip-address>
64+
```
65+
Replace `<server-ip-address>` with the IP address of the machine running the application.

0 commit comments

Comments
 (0)