-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.toradex.ml
More file actions
94 lines (74 loc) · 3.54 KB
/
Dockerfile.toradex.ml
File metadata and controls
94 lines (74 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
ARG BASE_NAME=debian
ARG IMAGE_ARCH=linux/arm64/v8
ARG IMAGE_TAG=2-bullseye
ARG DOCKER_REGISTRY=torizon
FROM --platform=$IMAGE_ARCH $DOCKER_REGISTRY/$BASE_NAME:$IMAGE_TAG AS tflite-build
## Build tools
RUN apt-get -y update && apt-get install -y \
cmake build-essential gcc g++ git wget unzip patchelf \
autoconf automake libtool curl gfortran zlib1g
RUN git config --global user.email "you@example.com" && \
git config --global user.name "Your Name"
## Prepare the build environment ##
ENV CPATH="/build/usr/include/:${CPATH}"
ENV LIBRARY_PATH="/build/usr/lib/:${LIBRARY_PATH}"
## Install Python and TFLITE dependencies ##
RUN apt-get -y update && apt-get install -y --no-install-recommends \
python3 python3-dev python3-setuptools \
python3-wheel python3-pip libopenblas-dev \
libjpeg-dev python3-pybind11
RUN pip3 install cython
## NumPy 1.22.3 requires Cython >= 0.29.24
## RUN wget http://http.us.debian.org/debian/pool/main/c/cython/cython3_0.29.30-1+b1_arm64.deb && apt-get install -y ./cython3_0.29.30-1+b1_arm64.deb && rm -rf ./cython3_0.29.30-1+b1_arm64.deb
WORKDIR /home/
COPY recipes /home/
## Install imx-gpu-viv , including OpenVX ##
RUN ./imx-gpu-viv_6.4.3.p1.4-aarch64.sh
## Install nn-imx ##
RUN ./nn-imx_1.3.0.sh
# Install Numpy ##
RUN ./python3-numpy_1.22.3.sh
# Workaround: After installing numpy whl, remove cpython*. More info: http://benno.id.au/blog/2013/01/15/python-determinism
RUN pip3 install /home/numpy-*.whl && \
rm /usr/local/lib/python*/dist-packages/numpy/typing/tests/data/pass/__pycache__/literal.cpython*
## Install tensorflow-protobuf ##
RUN ./tensorflow-protobuf_3.9.2.sh
## Install tim-vx ##
RUN ./tim-vx_1.1.39.sh
## Install tensorflow-lite ##
RUN ./tensorflow-lite_2.8.0.sh
## Install tensorflow-lite-vx-delegate ##
RUN ./tensorflow-lite-vx-delegate_2.8.0.sh
############################################################
################### Install Dependencies ###################
############################################################
FROM --platform=$IMAGE_ARCH $DOCKER_REGISTRY/$BASE_NAME:$IMAGE_TAG AS tflite-base
COPY --from=tflite-build /out /
RUN ldconfig
RUN apt-get -y update && apt-get install -y --no-install-recommends \
python3 python3-dev python3-setuptools \
cython3 libopenblas-dev python3-wheel python3-pip \
libjpeg-dev python3-pybind11
# Workaround: After installing numpy whl, remove cpython*. More info: http://benno.id.au/blog/2013/01/15/python-determinism
RUN pip3 install /home/numpy-*.whl && \
rm /usr/local/lib/python*/dist-packages/numpy/typing/tests/data/pass/__pycache__/literal.cpython*
RUN pip3 install /home/tflite_runtime-*.whl
RUN apt-get -y update && apt-get install -y --no-install-recommends \
python3-pil
#### Install OpenCV Dependencies ####
RUN apt-get -y update && apt-get install -y --fix-missing \
pkg-config libavcodec-dev libavformat-dev libswscale-dev \
libtbb2 libtbb-dev libjpeg-dev libpng-dev libdc1394-22-dev \
libdc1394-22-dev protobuf-compiler libgflags-dev libgoogle-glog-dev \
libblas-dev libhdf5-serial-dev liblmdb-dev libleveldb-dev liblapack-dev \
libsnappy-dev libprotobuf-dev libopenblas-dev libboost-dev \
libboost-all-dev libeigen3-dev libatlas-base-dev libne10-10 libne10-dev \
&& apt-get clean && apt-get autoremove
#### INSTALL OPENCV ####
RUN apt-get update && apt-get install -y python3-opencv
## Install GStreamer
RUN apt-get install -y libgstreamer1.0-0 gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly gstreamer1.0-tools
WORKDIR /home
# ENV USE_GPU_INFERENCE 1