Skip to content

Commit 65f1b10

Browse files
committed
Update Jetson Dockerfiles
1 parent 39fe29a commit 65f1b10

File tree

4 files changed

+24
-34
lines changed

4 files changed

+24
-34
lines changed

app/Dockerfile.jetson

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,15 @@ FROM redisfab/redisedgevision-${OSNICK}:0.2.0
1111
ENV LD_PRELOAD /usr/lib/aarch64-linux-gnu/libgomp.so.1
1212
ENV DEBIAN_FRONTEND=noninteractive
1313

14-
RUN apt-get -qq update
15-
16-
RUN set -ex ;\
17-
apt-get install -y wget python3-distutils patch ;\
18-
wget -q https://bootstrap.pypa.io/get-pip.py -O /tmp/get-pip.py ;\
19-
python3 /tmp/get-pip.py
14+
RUN apt-get -qq update && apt-get install -qqy wget python3-distutils patch
15+
RUN wget -q https://bootstrap.pypa.io/get-pip.py -O /tmp/get-pip.py && python3 /tmp/get-pip.py
2016

2117
WORKDIR /app
2218
ADD . /app
2319

2420
# patch init script for aarch64
25-
RUN patch init.py jetson.patch
21+
RUN patch init.py init.patch
22+
RUN patch gear.py gear.patch
2623

2724
RUN pip3 install -r requirements.txt
2825

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
diff --git a/app/gear.py b/app/gear.py
2-
index b602dfe..ab92667 100644
3-
--- a/app/gear.py
4-
+++ b/app/gear.py
5-
@@ -27,6 +27,7 @@ def toOneList(l):
1+
--- gear.py 2021-03-29 17:15:04.726216533 -0500
2+
+++ gear.py.updated 2021-03-29 17:14:34.195958815 -0500
3+
@@ -27,6 +27,7 @@
64
return res
75

86
def addToGraphRunner(x):
97
+ x = x['value']
108
try:
119
xlog('addToGraphRunner:', 'count=', x['count'])
1210

13-
@@ -54,7 +55,7 @@ def addToGraphRunner(x):
11+
@@ -54,7 +55,7 @@
1412
animal = index[str(res.index(res1[0]) - 1)][1]
1513
xlog('addToGraphRunner:', 'animal=', animal)
1614

@@ -19,7 +17,7 @@ index b602dfe..ab92667 100644
1917
except:
2018
xlog('addToGraphRunner: error:', sys.exc_info()[0])
2119

22-
@@ -62,21 +63,24 @@ def addToStream(x):
20+
@@ -62,21 +63,24 @@
2321
# save animal name into a new stream
2422
try:
2523
redisgears.executeCommand('xadd', 'cats', 'MAXLEN', '~', str(MAX_IMAGES), '*', 'image', 'data:image/jpeg;base64,' + base64.b64encode(x[1]).decode('utf8'))
@@ -46,23 +44,10 @@ index b602dfe..ab92667 100644
4644
except:
4745
xlog('passAll: error:', sys.exc_info()[0])
4846

49-
@@ -87,4 +91,5 @@ gearsCtx('StreamReader').\
47+
@@ -87,4 +91,5 @@
5048
map(addToGraphRunner).\
5149
filter(lambda x: 'cat' in x[0]).\
5250
foreach(addToStream).\
5351
- register('camera:0')
5452
+ register(prefix='camera:0')
5553
+
56-
diff --git a/app/init.py b/app/init.py
57-
index 09f77bc..64a1303 100644
58-
--- a/app/init.py
59-
+++ b/app/init.py
60-
@@ -27,7 +27,7 @@ if __name__ == '__main__':
61-
print('Loading model - ', end='')
62-
with open('models/mobilenet_v2_1.4_224_frozen.pb', 'rb') as f:
63-
model = f.read()
64-
- res = conn.execute_command('AI.MODELSET', 'mobilenet:model', 'TF', 'CPU', 'INPUTS', 'input', 'OUTPUTS', 'MobilenetV2/Predictions/Reshape_1', model)
65-
+ res = conn.execute_command('AI.MODELSET', 'mobilenet:model', 'TF', 'CPU', 'INPUTS', 'input', 'OUTPUTS', 'MobilenetV2/Predictions/Reshape_1', 'BLOB', model)
66-
print(res)
67-
68-
# Load the gear

app/init.patch

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- init.py 2021-03-29 17:14:57.525688056 -0500
2+
+++ init.py.updated 2021-03-29 17:14:27.563462225 -0500
3+
@@ -27,7 +27,7 @@
4+
print('Loading model - ', end='')
5+
with open('models/mobilenet_v2_1.4_224_frozen.pb', 'rb') as f:
6+
model = f.read()
7+
- res = conn.execute_command('AI.MODELSET', 'mobilenet:model', 'TF', 'CPU', 'INPUTS', 'input', 'OUTPUTS', 'MobilenetV2/Predictions/Reshape_1', model)
8+
+ res = conn.execute_command('AI.MODELSET', 'mobilenet:model', 'TF', 'CPU', 'INPUTS', 'input', 'OUTPUTS', 'MobilenetV2/Predictions/Reshape_1', 'BLOB', model)
9+
print(res)
10+
11+
# Load the gear

camera/Dockerfile.jetson

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM nvcr.io/nvidia/l4t-base:r32.5.0
22

33
# This is due on the following error on ARMv8:
4-
# /usr/lib/aarch64-linux-gnu/libgomp.so.1: cannot allocate memory in static TLS block
4+
# /usr/lib/aarch64-linux-gnu/libgomp.so.1: cannot allocate memory in static TLS block
55
# Something is exausting TLS, causing libgomp to fail. Preloading it as a workaround helps.
66
# ENV LD_PRELOAD /usr/lib/aarch64-linux-gnu/libgomp.so.1
77

@@ -10,11 +10,8 @@ ENV LD_LIBRARY_PATH=/usr/lib/aarch64-linux-gnu:$LD_LIBRARY_PATH
1010
ENV LD_PRELOAD /usr/lib/aarch64-linux-gnu/libgomp.so.1
1111

1212
RUN apt-get -qq update && apt-get upgrade -y
13-
14-
RUN set -x; \
15-
apt-get install -y curl patch; \
16-
curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py ;\
17-
python3 /tmp/get-pip.py
13+
RUN apt-get install -qqy curl patch
14+
RUN curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py && python3 /tmp/get-pip.py
1815

1916
RUN pip install redis==3.2.1
2017

0 commit comments

Comments
 (0)