Skip to content

Instantly share code, notes, and snippets.

View cyrusbehr's full-sized avatar

cyrusbehr

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
git clone https://github.com/apache/incubator-mxnet ./mxnet
cd mxnet
git checkout tags/1.8.0
git submodule update --init --recursive
mkdir build_aarch64_cuda
cd build_aarch64_cuda
# Need to delete line 15 from cpp-package/CMakeLists.txt
# download opencv 4.1.1
curl -o opencv.zip -L https://github.com/opencv/opencv/archive/4.1.1.zip
unzip opencv
# download contrib package
curl -o ./opencv_extra_4.1.1.zip https://codeload.github.com/opencv/opencv_contrib/zip/4.1.1
unzip opencv_extra_4.1.1.zip
cd opencv-4.1.1
# Install aarch64 cross depedencies based on Jetpack 4.4
# Dependencies require cuda-toolkit-10.2 which isn't installed in nvidia docker container
# It contains cuda-compat instead. However deb files currently depend on cuda-toolkit alone.
# Hence force dpkg configure
RUN wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-cross-aarch64-10-2_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-cross-aarch64_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-cudart-cross-aarch64-10-2_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-cufft-cross-aarch64-10-2_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-cupti-cross-aarch64-10-2_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-curand-cross-aarch64-10-2_10.2.89-1_all.deb && \
RUN git clone --recursive -b v0.3.12 https://github.com/xianyi/OpenBLAS.git && \
cd /usr/local/OpenBLAS && \
make NOFORTRAN=1 CC=aarch64-linux-gnu-gcc && \
make PREFIX=/usr/aarch64-linux-gnu install && \
cd /usr/local && \
rm -rf OpenBLAS
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR "aarch64")
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
set(CMAKE_CUDA_COMPILER nvcc)
set(CMAKE_CUDA_HOST_COMPILER aarch64-linux-gnu-gcc)
set(CMAKE_FIND_ROOT_PATH "/usr/aarch64-linux-gnu")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
ninja-build \
git \
wget \
zip \
unzip \
python3 \
python3-pip \
awscli \
FROM nvidia/cuda:10.2-cudnn7-devel-ubuntu18.04
ENV ARCH=aarch64 \
HOSTCC=gcc \
TARGET=ARMV8
WORKDIR /usr/local
@cyrusbehr
cyrusbehr / sample.py
Last active November 23, 2020 22:38
Sample using synchronization
@ app.route('/identify', methods=['POST'])
def identify():
# Generate the template first
# Call create_load_collection after generating template so mutex is locked for shortest amount of time
res = sdk.set_image(image_path)
res, v1 = sdk.get_largest_face_feature_vector()
# Now that we have generated the template, lock the mutex
mutex.lock()
res = sdk.create_load_collection(collection_id + '_' + namespace)
@cyrusbehr
cyrusbehr / view_snapshot.py
Created November 6, 2020 00:11
view the snapshot
import websocket
import json
import cv2
import numpy as np
import base64
try:
import thread
except ImportError:
import _thread as thread