Skip to content

Instantly share code, notes, and snippets.

View fengyuentau's full-sized avatar
💥
Rock it!

Yuantao Feng fengyuentau

💥
Rock it!
  • Shenzhen, Guangdong, China
  • 23:25 (UTC +08:00)
View GitHub Profile
@fengyuentau
fengyuentau / readme.md
Last active March 13, 2024 08:15
Enable X11 forward for ssh to load images from remote server on MacOS Mojave

Enable X11 forward to load images from remote server on MacOS Mojave

Steps

  1. Install Xquartz to get X11 support on MacOS. You can google Xquartz and download it from its official site, or install using HomeBrew.

    brew cask install xquartz
  2. Launch Xquartz. Go to Preference -> Security, click the box Allow connections from clients. NOTE: You have to lauch Xquartz with Allow connections from clients enable everytime you want to ssh to remote server with X11 forwarding support.

@fengyuentau
fengyuentau / checksum.sh
Last active November 8, 2023 12:58
Multiprocessing downloading with `wget` and `xargs` in bash
#!/bin/bash
# global vars
IND_START=100
IND_END=499
TAR_PATH="../tars"
CHECK_PASS=0
CHECK_FAIL=0
CHECK_FAIL_LIST=""
@fengyuentau
fengyuentau / readme.md
Created February 4, 2020 21:47
Failed to write any content to multiple files using the multiprocessing module from python3.4

Environment:

  • uname -a to check OS: Linux NAME 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u1 (2019-09-20) x86_64 GNU/Linux
  • Python version: Python 3.4.1 |Anaconda 2.1.0 (64-bit)| (default, Sep 10 2014, 17:10:18) (a 3rd party module requires py3.4)

Behaviour:

  • When trying to write logs in each process, e.g. one log file for each process, files can be created but no content is written.

Debug:

  • No expected errors in worker function
  • Failed to write even in single-processing or just call the function without multiprocessing module
@fengyuentau
fengyuentau / readme.md
Created February 7, 2020 21:20
Word table cell across pages

This seems to be an easy problem to solve, but yet took me almost an afternoon to google and finally figure out the solution myself.

Behaviour:

  1. A table with large cells
  2. The cell would not split across pages, even if one follows the solutions from microsoft support (check on OrchardSix's answer)
  3. The option of Allow row to break across pages is not available

Solution:

  1. Check if you change the Text Direction of the cell or its neighbour cells from originally horizontal to vertical, for example, | XXX | multiple lines with a lot of content | change the Text Direction | X | multiple lines |
@fengyuentau
fengyuentau / Makefile.config
Last active February 21, 2020 21:47
Compile caffe-ssh in docker container
## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!
USE_INDEX_64 := 1
# cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := 1
# CPU-only switch (uncomment to build without GPU support).
# CPU_ONLY := 1
@fengyuentau
fengyuentau / opencv_cmake.sh
Last active December 23, 2020 07:30
CMake command to compile OpenCV(>=4.0) with conda python interface
# Following is an example compiling OpenCV with conda python in MacOS.
# To compile opencv with python2, change options related to python3 accordingly.
# Option PYTHON3_LIBRARY is the location to libpythonx.x.dylib or libpythonx.x.so.
# Option PYTHON3_INCLUDE_DIR is the location to a directory with `Python.h` etc. Run `python -c 'import distutils.sysconfig as s; print(s.get_python_inc())'` to get the path.
# Option PYTHON3_EXECUTABLE is the location to pythonx.x executable. Run `which python` to get the directory.
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/Users/fengyuentau/Documents/opencv \
-D PYTHON3_LIBRARY=/usr/local/Caskroom/miniconda/base/lib \
-D PYTHON3_INCLUDE_DIR=/usr/local/Caskroom/miniconda/base/include/python3.8 \
-D PYTHON3_EXECUTABLE=/usr/local/Caskroom/miniconda/base/bin/python \
@fengyuentau
fengyuentau / insightface_eval.md
Created June 9, 2020 12:14
Guide to prepare data for the evaluation to the awesome face recognition algorithm from https://github.com/deepinsight/insightface.

Guide for insightface evaluation

The insightface face recognition algorithm is awesome, though there is no details about neither how to perform the evaluation on the algorithm nor how to prepare data for evaluation/training. Of course, one can find some details from issues, but it will take a lot of time to do that. Here, all the related details are collected for the sake of saving your time.

Preparing data

File you need for evaluation:

  • your_dataset.bin

NOTE: If you just want to perform the evaluation with the LFW dataset, just head to the Dataset-zoo from insightface to download on of the provided dataset, which contains lfw.bin for evaluation.

In case you want to create your own .bin file from your own dataset, following section is an example creating lfw.bin from LFW.

@fengyuentau
fengyuentau / build_with_cuda.sh
Last active June 5, 2024 13:19
Compiling and installing OpenCV DNN with CUDA (With Python Interface)
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/home/tau/software/opencv-4.5.1 \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=ON \
-D PYTHON3_LIBRARY=/home/tau/anaconda3/envs/opencv_dnn_cuda/lib \
-D PYTHON3_INCLUDE_DIR=/home/tau/anaconda3/envs/opencv_dnn_cuda/include/python3.8 \
-D PYTHON3_EXECUTABLE=/home/tau/anaconda3/envs/opencv_dnn_cuda/bin/python3.8 \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D INSTALL_C_EXAMPLES=OFF \
-D BUILD_EXAMPLES=OFF \
@fengyuentau
fengyuentau / CMakeLists.txt
Created November 18, 2021 10:16
Run OpenCV Zoo (demo and benchmarks) on Allwinner D1 (RISC-V-based)
cmake_minimum_required(VERSION 2.8.12)
project(libfacedetection_opencvdnn)
# OpenCV
find_package(OpenCV 4.5.4 REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(detect detect.cpp)
target_link_libraries(detect ${OpenCV_LIBS})
@fengyuentau
fengyuentau / OpenCV_with_TimVX.md
Last active September 29, 2022 02:33 — forked from zihaomu/OpenCV_with_TimVX.md
Compiling OpenCV with TIM-VX

Compiling OpenCV with TIM-VX Backend

We are thrilled to introduce you the TIM-VX backend integrated in OpenCV DNN, which allows OpenCV DNN runs quantized DL models in neural processing units (NPU) on edge devices, such as Khadas VIM3 etc. It achives up to 2X faster than ARM CPU backend for running face detection and recognition model from OpenCV Zoo. More details can be found in OpenCV Zoo Benchmarks.

TIM-VX is provided with x86_64 simulator. So you can try OpenCV with TIM-VX backend on your x86_64 machine following steps below, or if you happen to have a physical board equiped with the A311D chip (like the Khadas VIM3 mentioned above). In this guide, we provide two ways compiling OpenCV with TIM-VX backend:

  • (Recommanded) Compile OpenCV together with TIM-VX.
  • Compile OpenCV with TIM-VX library installed previously.

Requirem