發表文章

Run Yolov10 on Jetson AGX Orin with TensorRT

Create a virtual environment using anaconda $ conda create -n yolov10 python=3.8 ( not python3.9 ) $ conda activate yolov10 $ pip install -r requirements.txt ( without torch, torchvision, onnxruntime-gpu ) Do not do this $ pip install -e . Which will install torch, torchvision again... Install pre-built PyTorch pip wheel  Download one of the PyTorch binaries for your version of JetPack[2]. I downloaded  torch-2.1.0a0+41361538.nv23.06-cp38-cp38-linux_aarch64.whl since my JetPack version is 5.1.2 (L4T R35.4.1) $ sudo apt-get -y update $ sudo apt-get install python3-pip libopenblas-base libopenmpi-dev libomp-dev $ pip3 install 'Cython<3' $ export TORCH_INSTALL=~/Downloads/torch-2.1.0a0+41361538.nv23.06-cp38-cp38-linux_aarch64.whl  $ pip3 install numpy $ pip3 install --no-cache $TORCH_INSTALL Install corresponding torchvision $ pip uninstall torchvision ultralytics (Optional) $ sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libopenblas-dev libavcodec-dev libavformat

ssh to another laptop with linux system while its lid is closing

Method1: $ sudoedit /etc/systemd/logind.conf modify: HandleLidSwitch= ignore HandleLidSwitchExternalPower= ignore HandleLidSwitchDocked= ignore $ reboot Method2: $ sudoedit /etc/UPower/UPower.conf modify: IgnoreLid= true $ service upower restart [Optional] $ reboot Finally, ssh to the desired laptop, then you can close the lid !!!  Reference 1.  https://askubuntu.com/questions/15520/how-can-i-tell-ubuntu-to-do-nothing-when-i-close-my-laptop-lid

[solved] ssh: connect to host XXX.XXX.XX.XX port 22: Connection refused

$ sudo apt install openssh-server $  sudo service ssh restart

Useful commands for writing a Dockerfile and docker image management

Start the docker service $ sudo service docker start Check available images $ docker images Check available container $ docker ps Execute existing image $ docker exec -it [image ID] /bin/bash Delete all the images List $ docker images -a Delete $ docker stop $(docker ps -a -q) $ docker rmi [Image ID] [Image ID] $ docker rmi -f $(docker images -aq) Stop and remove all containers List $ docker ps -a Delete $ docker stop $(docker ps -a -q) $ docker rm [ID_or_Name] [ID_or_Name] $ docker rm $(docker ps -a -q) Save and load  $ docker save -o XXX.tar container $ docker load < XXX.tar Reference: [1]  nvidia/cuda docker images [2]  opencv-cuda-docker [3]  ros-kinetic-nvidia-docker [4]  opencv-cuda-ros-docker [5] pytorch-cuda-docker [6] https://ithelp.ithome.com.tw/articles/10238415 [7] https://www.runoob.com/docker/docker-command-manual.html [8] https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes

Rebuild my OpenCV4.3 for the use of Python3 CUDA

圖片
Command for building OpenCV from source: $ cd opencv4.3 $ cd build $ cmake -DCMAKE_C_COMPILER=$(which gcc-8) \ -D CMAKE_CXX_COMPILER=$(which g++-8) \ -D CMAKE_BUILD_TYPE=RELEASE \ -D INSTALL_C_EXAMPLES=ON \  -D INSTALL_PYTHON_EXAMPLES=ON \  -D OPENCV_EXTRA_MODULES_PATH=~/opencv_build_4.3/opencv_contrib/modules \ -D BUILD_EXAMPLES=ON -D BUILD_opencv_python2=OFF \  -D BUILD_opencv_python3=ON \  -D WITH_FFMPEG=ON \ -D WITH_LIBV4L=ON \  -D WITH_GTK=ON \  -D WITH_OPENGL=ON \  -D WITH_ZLIB=ON \  -D BUILD_PNG=ON \  -D BUILD_JPEG=ON \ -D BUILD_TIFF=ON \ -D WITH_CUDA=ON \ -D WITH_OPENCL=ON \ -D ENABLE_FAST_MATH=1 \ -D CUDA_FAST_MATH=1 \ -D WITH_CUBLAS=1 \ -D WITH_LAPACK=OFF \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D PYTHON3_EXECUTABLE=$(which python3) -DPYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \ -D PYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_pyt

How to use pip3 without sudo privileges

圖片
In my case, there are several python3.x version installed in my system before, and I had to type python3.x and sudo pip3 for developing the code every time, which disturbed me.  Here are the methods I tried to solve this problem. Now I am able to type only the python3 command for the newest python3.8 use and pip3 for installing modules without root privileges. python3.x ... -> python3 ... sudo pip3.x install ... -> pip3 install / python3 -m pip install ...  1. Install pip3 locally under /home/$USER/.local/bin/. $ wget https://bootstrap.pypa.io/get-pip.py $ python3 get-pip.py --user 2. Edit ~/.bashrc $ export PATH=$PATH:~/.local/bin $ export PYTHONPATH=$PYTHONPATH:/usr/lib/python3.8/dist-packages $ source ~/.bashrc 3. Delete redundant pip path or error: ModuleNotFoundError: No module named 'pip._vendor.retrying' will be reported. $ sudo rm -r /usr/lib/python3/dist-packages/pip Check: $ python3 --version * Difference between /usr/local and /usr/.local /usr/local is a place

Installing TensorRT on Ubuntu20.04

圖片
1. Install CUDA, cuDNN CUDA: (1) Remove old version sudo apt-get purge nvidia* sudo apt-get autoremove sudo apt-get autoclean sudo rm -rf /usr/local/cuda* (2) Download and install CUDA toolkit 11.3 [1] $ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin $ sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 $ wget https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda-repo-ubuntu2004-11-3-local_11.3.0-465.19.01-1_amd64.deb $ sudo dpkg -i cuda-repo-ubuntu2004-11-3-local_11.3.0-465.19.01-1_amd64.deb $ sudo apt-key add /var/cuda-repo-ubuntu2004-11-3-local/7fa2af80.pub $ sudo apt-get update $ sudo apt-get -y install cuda (3) Check $ cd /usr/local/cuda-11.3/samples/1_Utilities/deviceQuery $ sudo make $ ./deviceQuery ex: cuDNN: (1) Download cuDNN 8.2.1 [2]  (2) Install extract cudnn-11.3-linux-x64-v8.2.1.32.tgz $ cd cuda $ sudo cp cuda/include/cudnn.h /usr/local/cuda-11.3/include/  $ sudo cp cu