RedisGears / AnimalRecognitionDemo

An example of using Redis Streams, RedisGears and RedisAI for Realtime Video Analytics (i.e. filtering cats)
https://redisgears.io
Apache License 2.0
42 stars 18 forks source link

Tested with MacOS? #14

Closed collabnix closed 4 years ago

collabnix commented 4 years ago

Hello, I tried the clone the repository and tried installing on my MacBook Pro.

docker-compose up -d
Starting animalrecognitiondemo_redis_1 ... done
Starting animalrecognitiondemo_app_1     ... done
Starting animalrecognitiondemo_weball_1  ... done
Starting animalrecognitiondemo_webcats_1 ... done
% docker-compose ps
         Name                   Command           State            Ports
--------------------------------------------------------------------------------
animalrecognitiondemo_   python3 init.py --url    Exit 0
app_1                    redi ...
animalrecognitiondemo_   redis-server             Up       0.0.0.0:6379->6379/tc
redis_1                  --loadmodule  ...                 p
animalrecognitiondemo_   docker-entrypoint.sh     Up       0.0.0.0:3000->3000/tc
weball_1                 node  ...                         p
animalrecognitiondemo_   docker-entrypoint.sh     Up       0.0.0.0:3001->3000/tc
webcats_1                node  ...                         p
ajeetraina@Ajeet-Rainas-Macbook-Pro redis %

Also, I created to build it:

% docker-compose up --force-recreate --build
Building redis
Step 1/8 : ARG OSNICK=buster
Step 2/8 : FROM redisfab/redisedgevision-${OSNICK}:0.1.0
 ---> cc102370a2bd
Step 3/8 : ENV LD_PRELOAD /usr/lib/aarch64-linux-gnu/libgomp.so.1
 ---> Using cache
 ---> 757512fca7aa
Step 4/8 : ENV LD_LIBRARY_PATH /usr/lib/redis/modules/
 ---> Using cache
 ---> 3351ab28ebcb
Step 5/8 : WORKDIR /data
 ---> Using cache
 ---> 4e6954b70da8
Step 6/8 : EXPOSE 6379
 ---> Using cache
 ---> b5365a284fc9
Step 7/8 : ENTRYPOINT ["redis-server"]
 ---> Using cache
 ---> 220bbb3bfc7e
Step 8/8 : CMD ["--loadmodule", "/usr/lib/redis/modules/redisai.so",     "--loadmodule", "/usr/lib/redis/modules/redisgears.so",     "PythonHomeDir", "/opt/redislabs/lib/modules/python3/"]
 ---> Using cache
 ---> 491e8bd4991b
Successfully built 491e8bd4991b
Successfully tagged animalrecognitiondemo_redis:latest
Building weball
Step 1/7 : FROM node:10-alpine
 ---> 29fc59abc5de
Step 2/7 : WORKDIR /usr/src/app
 ---> Using cache
 ---> 256c247377e9
Step 3/7 : COPY package*.json ./
 ---> Using cache
 ---> 84731091c457
Step 4/7 : COPY . .
 ---> Using cache
 ---> f2f82cc76c7d
Step 5/7 : RUN npm install
 ---> Using cache
 ---> 430f5536fa1c
Step 6/7 : EXPOSE 3000
 ---> Using cache
 ---> 0039a6dad0f7
Step 7/7 : CMD [ "node", "server.js" ]
 ---> Using cache
 ---> d779e13bac7a
Successfully built d779e13bac7a
Successfully tagged animalrecognitiondemo_weball:latest
Building webcats
Step 1/7 : FROM node:10-alpine
 ---> 29fc59abc5de
Step 2/7 : WORKDIR /usr/src/app
 ---> Using cache
 ---> 256c247377e9
Step 3/7 : COPY package*.json ./
 ---> Using cache
 ---> 84731091c457
Step 4/7 : COPY . .
 ---> Using cache
 ---> f2f82cc76c7d
Step 5/7 : RUN npm install
 ---> Using cache
 ---> 430f5536fa1c
Step 6/7 : EXPOSE 3000
 ---> Using cache
 ---> 0039a6dad0f7
Step 7/7 : CMD [ "node", "server.js" ]
 ---> Using cache
 ---> d779e13bac7a
Successfully built d779e13bac7a
Successfully tagged animalrecognitiondemo_webcats:latest
Building app
Step 1/9 : FROM debian:buster
 ---> 971452c94376
Step 2/9 : ENV DEBIAN_FRONTEND=noninteractive
 ---> Using cache
 ---> b055c2e3c25a
Step 3/9 : ENV RUNTIME_DEPS "python3 python3-setuptools ca-certificates curl python3-opencv"
 ---> Using cache
 ---> f34cdc8bd65c
Step 4/9 : RUN set -ex ;    apt-get -qq update ;    apt-get -q install -y --no-install-recommends $RUNTIME_DEPS
 ---> Using cache
 ---> d4b0acee57b5
Step 5/9 : RUN set -ex ;    curl -q -s https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py ;    python3 /tmp/get-pip.py
 ---> Using cache
 ---> 06020025d2c7
Step 6/9 : WORKDIR /app
 ---> Using cache
 ---> 605bde2d1235
Step 7/9 : ADD . /app
 ---> Using cache
 ---> 60b32923f66d
Step 8/9 : RUN pip3 install -r requirements.txt
 ---> Using cache
 ---> 69e8f7e0fda4
Step 9/9 : ENTRYPOINT [ "python3" ]
 ---> Using cache
 ---> 095f48405957
Successfully built 095f48405957
Successfully tagged animalrecognitiondemo_app:latest
Recreating animalrecognitiondemo_redis_1 ... done
Recreating animalrecognitiondemo_weball_1  ... done
Recreating animalrecognitiondemo_webcats_1 ... done
Recreating animalrecognitiondemo_app_1     ... done
Attaching to animalrecognitiondemo_redis_1, animalrecognitiondemo_webcats_1, animalrecognitiondemo_app_1, animalrecognitiondemo_weball_1
redis_1    | ERROR: ld.so: object '/usr/lib/aarch64-linux-gnu/libgomp.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
redis_1    | 1:C 09 Mar 2020 08:36:02.834 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis_1    | 1:C 09 Mar 2020 08:36:02.834 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=1, just started
redis_1    | 1:C 09 Mar 2020 08:36:02.834 # Configuration loaded
redis_1    | 1:M 09 Mar 2020 08:36:02.835 * Running mode=standalone, port=6379.
redis_1    | 1:M 09 Mar 2020 08:36:02.835 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1    | 1:M 09 Mar 2020 08:36:02.835 # Server initialized
redis_1    | 1:M 09 Mar 2020 08:36:02.836 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis_1    | 1:M 09 Mar 2020 08:36:02.836 * Module 'ai' loaded from /usr/lib/redis/modules/redisai.so
redis_1    | 1:M 09 Mar 2020 08:36:02.837 * <rg> RedisGears version 99.99.99, git_sha=
redis_1    | 1:M 09 Mar 2020 08:36:02.837 * <rg> PythonHomeDir:/opt/redislabs/lib/modules/python3/
redis_1    | 1:M 09 Mar 2020 08:36:02.837 * <rg> MaxExecutions:1000
redis_1    | 1:M 09 Mar 2020 08:36:02.837 * <rg> ProfileExecutions:0
redis_1    | 1:M 09 Mar 2020 08:36:02.837 * <rg> PythonAttemptTraceback:1
redis_1    | 1:M 09 Mar 2020 08:36:02.837 * <rg> RedisAI api loaded successfully.
redis_1    | could not initialize RediSearch_CheckApiVersionCompatibility
redis_1    | 1:M 09 Mar 2020 08:36:02.837 # <rg> could not initialize RediSearch api, running without Search support.
redis_1    | 1:M 09 Mar 2020 08:36:02.862 * <rg> Initializing Python environment with: exec(open('/opt/redislabs/lib/modules/python3/.venv/bin/activate_this.py').read(), {'__file__': '/opt/redislabs/lib/modules/python3/.venv/bin/activate_this.py'})
redis_1    | 1:M 09 Mar 2020 08:36:02.972 * Module 'rg' loaded from /usr/lib/redis/modules/redisgears.so
redis_1    | 1:M 09 Mar 2020 08:36:02.972 * Ready to accept connections
redis_1    | 1:M 09 Mar 2020 08:36:03.762 # <ai> Backend TF not loaded, will try loading default backend
redis_1    |
redis_1    | 1:M 09 Mar 2020 08:36:03.827 * <ai> TF backend loaded from /usr/lib/redis/modules/backends/redisai_tensorflow/redisai_tensorflow.so
webcats_1  | Redis Labs - app listening on port 3000!
redis_1    | 2020-03-09 08:36:03.867420: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
redis_1    | 2020-03-09 08:36:03.871652: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 1392000000 Hz
redis_1    | 2020-03-09 08:36:03.872677: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x556c5a146e90 executing computations on platform Host. Devices:
redis_1    | 2020-03-09 08:36:03.872946: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): <undefined>, <undefined>
weball_1   | Redis Labs - app listening on port 3000!
app_1      | Loading model - b'OK'
app_1      | Loading gear - b'OK'
app_1      | Flag initialization as done - True
animalrecognitiondemo_app_1 exited with code 0

I am unable to get http://localhost:3000 on MacBook. Is this script built for Mac which comes with inbuilt camera module.

collabnix commented 4 years ago

I was able to get it up and running.

gkorland commented 4 years ago

@collabnix what was the issue? did you fix anything?

collabnix commented 4 years ago

@gkorland It was bit slow but appeared after sometime. I am planning to leverage this on my NVIDIA Jetson Board which comes with GPGPU card.

lantiga commented 4 years ago

Hi @collabnix, you might be interested in a gist I wrote to make RedisAI run on a Jetson TX2 (https://gist.github.com/lantiga/315ab6e10f010e908d8e4eb4c63505d1).

SeekPoint commented 4 years ago

how can you run it on Mac:

Open a second terminal for the video capturing:

$ pip install -r camera/requirements.txt $ python camera/read_camera.py