Skip to content

Instantly share code, notes, and snippets.

View WesleyCh3n's full-sized avatar
😺

WesleyCh3n WesleyCh3n

😺
View GitHub Profile
{
"embeddings": [
{
"tensorName": "Cow-embedding",
"tensorShape": [
1900,
128
],
"tensorPath": "https://gist.githubusercontent.com/WesleyCh3n/4825bb479d7cd7f329f69be35cde9a46/raw/5c9cf355ca63598dca629e15f21ff775a860db56/Tflite-vecs.tsv",
"metadataPath": "https://gist.githubusercontent.com/WesleyCh3n/4fb70cf0b34b0c1b6a6026985e54d282/raw/6e8fca7f808f1bb65a1c84b8376ecec1b940383f/Tflite-metas.tsv"
@WesleyCh3n
WesleyCh3n / opencv_to_tflite.cpp
Last active August 25, 2023 15:53
Tensorflow Lite using cv::Mat as input (MobileNetV2)- C++ & Python
/* tflite model:
* - input shape: (224,224,3)
* - output shape: (128)
* In C++, cv::Mat should be flatten as input. If input has 3 channel,
* then it should be RGBRGBRGB... */
#include <iostream>
#include <iomanip>
#include "tensorflow/lite/interpreter.h"
@WesleyCh3n
WesleyCh3n / opencv_yolov4_tflite.cc
Last active March 1, 2023 02:21
Tensorflow Lite using cv::Mat as input (Tiny Yolo v4) - C++
#include <iostream>
#include <chrono>
#include <iomanip>
#include <vector>
#include "tensorflow/lite/c/common.h"
#include "tensorflow/lite/interpreter.h"
#include "tensorflow/lite/kernels/register.h"
#include "tensorflow/lite/model.h"
@WesleyCh3n
WesleyCh3n / install_opencv_cuda.sh
Last active September 9, 2021 02:54
OpenCV Installation with CUDA in Ubuntu
sudo apt-get update
sudo apt-get upgrade
# Installation prerequisite libraries
## Compile tools
sudo apt-get install build-essential cmake pkg-config unzip git checkinstall
## Image I/O
sudo apt-get install libjpeg-dev libpng-dev libtiff-dev
## Video/Audio
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libxvidcore-dev libx264-dev
@WesleyCh3n
WesleyCh3n / cuda_install.sh
Last active September 9, 2021 03:10
CUDA 11.2.2 insallation in Ubuntu
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.2.2/local_installers/cuda-repo-ubuntu1804-11-2-local_11.2.2-460.32.03-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-11-2-local_11.2.2-460.32.03-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu1804-11-2-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
@WesleyCh3n
WesleyCh3n / cuda_env_var.sh
Created September 9, 2021 03:11
CUDA env variable in bashrc
export PATH=/usr/local/cuda-11.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.2/lib64\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/targets/x86_64-linux/lib
@WesleyCh3n
WesleyCh3n / cuDNN_install.sh
Created September 9, 2021 03:14
cuDNN 8.1.0 installation in Ubuntu
# Download package from https://developer.nvidia.com/rdp/cudnn-archive.
# Extract and move to right place
tar -xzvf cudnn-x.x-linux-x64-v8.x.x.x.tgz
sudo cp cuda/include/cudnn*.h /usr/local/cuda/include
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
@WesleyCh3n
WesleyCh3n / verify_cudnn_version.sh
Created September 9, 2021 03:15
Verify cuDNN version
cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR
@WesleyCh3n
WesleyCh3n / arm64-cross.Dockerfile
Last active September 12, 2021 15:07
Dockerfile of arm64/armv7 for rpi cross-compile base on `dockross`. Toolchain: https://sourceforge.net/projects/raspberry-pi-cross-compilers/files/
FROM dockcross/base:latest
ENV DEFAULT_DOCKCROSS_IMAGE arm64-cross
ENV CROSS_TRIPLE aarch64-linux-gnu
ENV XCC_PREFIX /usr/local
ENV CROSS_ROOT ${XCC_PREFIX}/${CROSS_TRIPLE}
ENV AS=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-as \
AR=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-gcc-ar \
CC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-gcc \

Can I do "make uninstall" with CMake?

By default, CMake does not provide the "make uninstall" target, so you cannot do this. We do not want "make uninstall" to remove useful files from the system. If you want an "uninstall" target in your project, then nobody prevents you from providing one. You need to delete the files listed in install_manifest.txt file. Here is how to do it. First create file cmake_uninstall.cmake.in in the top-level directory of the project:

if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")