Skip to content

Instantly share code, notes, and snippets.

View cyrusbehr's full-sized avatar

Cyrus Behroozi cyrusbehr

View GitHub Profile
@cyrusbehr
cyrusbehr / xxd.sh
Last active April 13, 2021 22:22
Showcasing the XDD command
# xxd --> bash utility for generating hex dumps
xxd -i face_detector.param > face_detector_param.h
xxd -i face_detector.bin > face_detector_bin.h
@cyrusbehr
cyrusbehr / my_sdk.h
Created October 9, 2020 21:11
Our library API
#pragma once
#include <array>
#include <vector>
#include <memory>
namespace sdk {
enum class ErrorCode {
NO_ERROR,
FAILED
@cyrusbehr
cyrusbehr / build_ncnn.sh
Created October 9, 2020 20:54
Shell script for pulling ncnn source and compiling for several platforms
# Obtain release tag 20200916, set up build directories
test -e 20200916.zip || wget https://github.com/Tencent/ncnn/archive/20200916.zip
test -e ncnn-20200916 || unzip 20200916.zip
cd ncnn-20200916
test -e build_amd64 && rm -rf build_amd64
test -e build_arm32 && rm -rf build_arm32
test -e build_arm64 && rm -rf build_arm64
mkdir build_amd64
@cyrusbehr
cyrusbehr / identify.py
Last active June 19, 2020 18:37
Run 1 to N identification using the C++ SDK
import tfsdk
import cv2
import os
# Set the configuration options
options = tfsdk.ConfigurationOptions()
# Use the FULL model
options.fr_model = tfsdk.FACIALRECOGNITIONMODEL.FULL
# Enable vector compression
@cyrusbehr
cyrusbehr / create_collection.py
Last active June 16, 2020 23:31
Create and populate a collection using C++ SDK
import tfsdk
import os
# Set the configuration options
options = tfsdk.ConfigurationOptions()
# Use the FULL model
options.fr_model = tfsdk.FACIALRECOGNITIONMODEL.FULL
# Enable vector compression
options.fr_vector_compression = True
@cyrusbehr
cyrusbehr / CMakeLists.txt
Last active November 27, 2019 00:10
CMakeLists AArch64
cmake_minimum_required(VERSION 3.0)
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_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
SET ( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
SET ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
@cyrusbehr
cyrusbehr / CMakeLists.txt
Last active November 26, 2019 22:18
CMakeLists for AArch32
cmake_minimum_required(VERSION 3.0)
SET ( CMAKE_SYSTEM_NAME Linux )
SET ( CMAKE_SYSTEM_PROCESSOR arm )
SET ( CMAKE_C_COMPILER "arm-linux-gnueabihf-gcc" )
SET ( CMAKE_CXX_COMPILER "arm-linux-gnueabihf-g++" )
SET ( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
SET ( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
SET ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
@cyrusbehr
cyrusbehr / main.cpp
Last active November 26, 2019 21:17
Landmark Detection
#include <opencv2/opencv.hpp>
#include <memory>
#include <string>
#include <vector>
#include "mtcnn.h"
#include "net.h"
// Loads image, computes landmark locations, draws landmarks on image and save to disk
void detectLandmarks(const std::string& imgPath, const std::unique_ptr<MTCNN>& mtcnnPtr);
@cyrusbehr
cyrusbehr / build_ncnn.sh
Last active November 28, 2019 00:13
Cross compile NCNN for AArch32 and AArch64
####################
# build for aarch32
####################
mkdir build_aarch32
cd build_aarch32
cmake -D NCNN_BUILD_TOOLS=OFF -D NCNN_VULKAN=OFF -D CMAKE_BUILD_TYPE=Release -D NCNN_DISABLE_RTTI=OFF -D CMAKE_TOOLCHAIN_FILE=../toolchains/arm-linux-gnueabihf.toolchain.cmake ..
@cyrusbehr
cyrusbehr / build_opencv.sh
Last active November 28, 2019 00:14
OpenCV AArch32 and AArch64 CMake commands
####################
# build for aarch32
####################
mkdir build_aarch32
cd build_aarch32
cmake -DCMAKE_TOOLCHAIN_FILE="../platforms/linux/arm-gnueabi.toolchain.cmake" -D CMAKE_INSTALL_PREFIX="/usr/local" -D BUILD_SHARED_LIBS=OFF -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_DOCS=OFF -D BUILD_EXAMPLES=OFF -D BUILD_opencv_apps=OFF -D WITH_CAROTENE=OFF -D BUILD_opencv_python2=OFF -D BUILD_opencv_python3=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D FORCE_VTK=OFF -D WITH_FFMPEG=OFF -D WITH_GDAL=OFF -D WITH_IPP=OFF -D WITH_OPENEXR=OFF -D WITH_OPENGL=OFF -D WITH_QT=OFF -D WITH_TBB=OFF -D WITH_XINE=OFF -D BUILD_JPEG=ON -D BUILD_ZLIB=ON -D BUILD_PNG=ON -D BUILD_TIFF=OFF -D BUILD_BUILD_JASPER=OFF -D WITH_ITT=OFF -D WITH_LAPACK=OFF -D WITH_OPENCL=OFF -D WITH_TIFF=OFF -D WITH_PNG=ON -D WITH_OPENCLAMDFFT=OFF -D WITH_OPENCLAMDBLAS=OFF -D WITH_VA_INTEL=OFF -D WITH_WEBP=OFF -D WITH_JASPER=OFF ..
make -j$(nproc)