Skip to content

Instantly share code, notes, and snippets.

Avatar

Hoang Hai haipnh

View GitHub Profile
@haipnh
haipnh / intel-nvidia-offload-rendering.md
Last active Sep 20, 2022
Intel for display, NVIDIA for computing and offload rendering
View intel-nvidia-offload-rendering.md

Purposes

  1. iGPU will be used for main display and rendering daily-use softwares in default
  2. Dedicated GPUs will be used for computing or offload rendering
  3. Reduce the used VRAM of Dedicated GPU, which is mostly used for X11 server rendering

Tested Hardware Configuration

OS: Ubuntu 18.04.4 LTS
Mainboads
├── iGPU
@haipnh
haipnh / pynq_python_console.sh
Created Jun 27, 2022
Instruction to run HW-accelerated Python scripts on PYNQ
View pynq_python_console.sh
sudo -s
echo "source /etc/profile.d/pynq_venv.sh" >> ~/.bashrc
echo "export XILINX_XRT=/usr" >> ~/.bashrc
source ~/.bashrc
python some_script.py
@haipnh
haipnh / cv2-video-ipython-jupyter.py
Created Jun 22, 2022
This is an example how to play video on Jupyter using OpenCV and IPythone
View cv2-video-ipython-jupyter.py
import numpy as np
import cv2
from IPython.display import display, Image
import time
video_path = "./HowDeepIsYourLove.mp4"
video = cv2.VideoCapture(video_path)
display_handle=display(None, display_id=True)
kernel = np.ones((5,5),np.float32)/25
@haipnh
haipnh / NeuronBot_Install_OpenCV_Ubuntu16.04.sh
Created Jun 15, 2022
Instruction to install OpenCV on Ubuntu 16.04 | NeuronBot
View NeuronBot_Install_OpenCV_Ubuntu16.04.sh
# Summary: We will create a virtual environment of Python-3.9 and install OpenCV-Python to it.
# 1. Add 3rd-party OpenCV-3.9 repository
sudo apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
# 2. Install packages
sudo apt-get install -y software-properties-common python3-pip python3.9 python3.9-dev python3.9-venv
@haipnh
haipnh / verify-cuda-system-for-ml-dl-framework.sh
Last active Jun 1, 2022
Verify CUDA-enabled system for ML/DL framework
View verify-cuda-system-for-ml-dl-framework.sh
#!/bin/bash
# This gist provides several test cases to verify a host machine using NVIDIA graphics card if it's ready for tensorflow and pytorch.
### TC#1: Verify hardware information
# Expectation: The OS shows hardware bare information
lspci | grep -i nvidia
sudo lshw -C display
### TC#2: Verify nvidia-driver-X
View opencv.pc
libdir = /opt/opencv-4.0.0/lib
includedir = /opt/opencv-4.0.0/include/opencv4
Name: OpenCV
Description: OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library.
Version: 4.0.0
Libs: -L${libdir} -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_calib3d -lopencv_ccalib -lopencv_core -lopencv_datasets -lopencv_dnn_objdetect -lopencv_dnn -lopencv_dpm -lopencv_face -lopencv_features2d -lopencv_flann -lopencv_freetype -lopencv_fuzzy -lopencv_gapi -lopencv_hfs -lopencv_highgui -lopencv_imgcodecs -lopencv_img_hash -lopencv_imgproc -lopencv_line_descriptor -lopencv_ml -lopencv_objdetect -lopencv_optflow -lopencv_phase_unwrapping -lopencv_photo -lopencv_plot -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_shape -lopencv_stereo -lopencv_stitching -lopencv_structured_light -lopencv_superres -lopencv_surface_matching -lopencv_text -lopencv_tracking -lopencv_videoio -lopencv_video -lopencv_videostab -lopencv_xfeatures2d -lopencv_ximgproc -lopenc
@haipnh
haipnh / build_opencv_ARM_cross
Created Jun 15, 2019 — forked from manashmandal/build_opencv_ARM_cross
Cross compile opencv3.3.0 for your raspberry pi and similar ARM devices with python support
View build_opencv_ARM_cross
This is a note on how to cross compile opencv for pretty much any ARM device(HardFP supported in this case) and deploy. Native
compiling in ARM devices can be painfully slow and they seem to hang often during build(mine got stuck at 43%). So if you happen
to have a desktop/laptop/server running ubuntu or similar linux distro, u can build opencv in fractionth of the time taken for
native compiling without any issues.
Building opencv3 with TBB and NEON and VFP support can boost opencv performance. Thanks to Adrian at pyimagesearch for pointing that out.
Both my PC and target machine aka orange pi zero are running ubuntu 16.04 with python2.7 and python 3.5.
1.Run the following commands in both machines to install the necessary libraries etc.(mine worked with them,so they should be enough
hopefully)
sudo apt-get update && sudo apt-get upgrade