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
  • 03:19 (UTC +08:00)
View GitHub Profile
@fengyuentau
fengyuentau / CMakeLists.txt
Created February 6, 2024 11:16
ONNXRuntime C++ inference example
cmake_minimum_required(VERSION 3.5)
project(tests)
set(ORT_ROOT_DIR "/path/to/onnxruntime")
set(ORT_INCLUDE_DIR "${ORT_ROOT_DIR}/include")
set(ORT_BUILD_DIR "${ORT_ROOT_DIR}/build/MacOS/RelWithDebInfo")
#set(OCV_ROOT_DIR "/path/to/opencv")
#set(OCV_BUILD_DIR "${OCV_ROOT_DIR}/build/install")
@fengyuentau
fengyuentau / CMakeLists.txt
Last active January 15, 2024 03:15
OpenCL Benchmark C++
cmake_minimum_required(VERSION 3.13)
project("CLBlast performance test")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_package(OpenCL)
find_package(CLBlast HINTS "/home/opencv-cn/Workspace/others/CLBlast/build/install")
message(STATUS "CLBlast_FOUND=${CLBlast_FOUND}, CLBlast_INCLUDE_DIRS=${CLBlast_INCLUDE_DIRS}, CLBlast_LIBS=${CLBlast_LIBS}")
@fengyuentau
fengyuentau / make_table.py
Created December 21, 2023 09:45
Make markdown table from opencv perf test results. It is used in https://github.com/opencv/opencv/pull/24694 and https://github.com/opencv/opencv/pull/23897.
'''
| Configuration | Gemm | InnerProduct |
| - | - | - |
| A=, B=, C=, transA=, transB=| - | - |
'''
import argparse
@fengyuentau
fengyuentau / ocv_ov_readme.md
Last active December 15, 2023 09:58
Quick setup for opencv+openvino dev environment
# Installation
wget -q https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.2/linux/l_openvino_toolkit_ubuntu22_2023.2.0.13089.cfd42bd2cb0_x86_64.tgz -O openvino.tgz
sudo mkdir -p /opt/intel/openvino
sudo tar -xf openvino.tgz -C /opt/intel/openvino --strip-components=1
sudo apt-get install -y libtbb2 libpugixml1v5

# Install dependencies
cd /opt/intel/openvino/install_dependencies
sudo -E ./install_openvino_dependencies.sh
FROM ubuntu:18.04
WORKDIR /root
RUN cp -a /etc/apt/sources.list /etc/apt/sources.list.bak \
&& sed -i "s@http://.*security.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list \
&& sed -i "s@https://.*security.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list \
&& sed -i "s@http://.*archive.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list \
&& sed -i "s@https://.*archive.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list \
&& apt-get -y update \
&& DEBIAN_FRONTEND=noninteractive apt install -y tzdata \
@fengyuentau
fengyuentau / A_ocv_cann.md
Last active December 19, 2022 03:23
OpenCV DNN: CANN backend manual

CANN (Compute Architecture of Neural Networks), developped by Huawei, is a heterogeneous computing architecture for AI. With CANN backend in OpenCV DNN, you can run your AI models on the Ascend NPU. Learn more about Ascend NPU and the CANN library from en_doc, cn_doc. Please note that OpenCV DNN supports CANN backend on Ascend 310 for now.

To use OpenCV DNN with CANN backend, read the following sections:

  1. Install dependencies,
  2. Install CANN,
  3. Compile OpenCV with CANN,
  4. Python and C++ samples
  5. OpenCV Zoo benchmark
@fengyuentau
fengyuentau / CMakeLists.txt
Created July 28, 2022 02:45
Single operator inference with Ascend and OpenCV for input and output
cmake_minimum_required(VERSION 3.16.3)
project(ascend-conv2d)
# Find OpenCV
find_package(OpenCV 4.5.4 REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
@fengyuentau
fengyuentau / Dockerfile
Last active November 22, 2023 07:52
Dockerfiles for cross-compiling/native-compiling and testing TIM-VX backend on x86_64 Ubuntu 20.04
FROM yuentau/ocv_ubuntu:20.04
WORKDIR /opt
RUN git clone https://github.com/opencv/opencv
RUN cmake -B opencv-build -D WITH_TIMVX=ON opencv
RUN cmake --build opencv-build -j 8
# unit tests
# 1. setup env var
# 2. run tests
@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

@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})