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
  • 22:52 (UTC +08:00)
View GitHub Profile
@fengyuentau
fengyuentau / README.md
Last active August 30, 2024 09:33
Guide to build and install OpenCV 5

Dependencies

  • OS: Ubuntu / macOS
  • CMake >= 3.20
  • gcc
  • g++
  • Python >= 3.6

Build OpenCV 5

git clone --branch 5.x https://github.com/opencv/opencv
@fengyuentau
fengyuentau / perf_topk.py
Last active August 20, 2024 03:56
ONNXRuntime performance tests
import onnxscript as ost
from onnxscript import opset19 as op
import numpy as np
import onnx
import onnxruntime as ort
import time
@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