Giter Club home page Giter Club logo

jetson-nano-development-kit-install-opencv-cuda's Introduction

Guide how to install OpenCV 4.5 with Cuda on Jetson Nano with Jetson Pack 4.6.4 and Cuda 10.2 CuDNN 8.2

Installing Jetpack

  1. You need a host machine have Ubuntu 18.04 and go there to download and install Nvidia SDK Manager Install
  2. After install, you can open sdkmanager with command sdkmanager

Boot OS

  1. Connect a jumper between GND and FC REC The FC REC and GND jumper on the back of the jetson
  2. Connect a micro USB to the Jetson Nano and the host machine.
  3. Then you need select a right version of your Jetson.
  4. Uncheck the DeepStream cuz we don’t need it.
  5. SDK Manager Version will auto set to 4.6.4, if it not then you need to re-select it to the version 4.6.4.
  6. We only need flash a OS so uncheck the Jetson SDK Components.
  7. Click continue, set the username/password, and start the install (takes around 10 minutes if you already flash it before cuz the OS image is downloaded).
  8. When flash done, you will need to remove the micro USB and the jumper. Then Connect the power supply to the Jetson Nano.

Install Open CV 4.5.0 with Cuda

  1. After the first time setup up done, open terminal and using command df -h and you will see the OS take 4.9GB/16GB. Don’t worry, it still enough for build Open CV, let run another command

sudo apt update sudo apt install nvidia-jetpack (This will takes aroud 15 min to download and install all the Cuda CuDNN,…)

  1. Let install jtop to check if cuda is detect or not.

sudo apt install python3-pip sudo pip3 install jetson-stats Then run sudo jtop and press number 7 to check all information about ur OS. You will see we have OpenCV already but it not with CUDA, that why we need re-build OpenCV with cmake to let it work with CUDA.

  1. After nvidia-jetpack installed, let clone this script to install OpenCV-4-5-0.sh
  2. Let run this script with commmand sudo ./OpenCV-4-5-0.sh (This will takes around 5-6 hours to complete :)))) ).
  3. After this build done, now you can check with sudo jtop and yes, we have OpenCV with CUDA now.

Now your lib cv2 is locate at /usr/lib/python3/dist-packages/. You can go there and copy the folder cv2 to backup it to another venv later.

In my case, at this point we have cv2 with CUDA. Now im insert a SD Card to Jetson Nano and create a python venv on SD Card. sudo pip3 install python3-venv python3 -m venv my-venv

Then go to the locate of cv2 above and copy it, paste it to my-venv/lib/dist-packages/. And now your new venv in SD Card already have cv2 with CUDA. You can test it by run source my-venv/bin/activate python3 Then import cv2. In my case this work perfectly!

Optional (In my case i got error while install on venv in SD Card but it install complete in Emmc. I recommend you also need install this lib first before copy all OS to SD Card)

  1. Let also install Onnx for this Jetson Nano.

We need some space to install some package before we copy all OS to the SD Card. Let run command sudo apt clean Then install another package sudo apt-get install protobuf-compiler libprotoc-dev pip3 install onnx==1.4.1

And now you have onnx. Notes: Lib Onnx is locate at /usr/local/lib/python3.6/dist-package/onnx. So now you also can copy this onnx lib to my-venv like above.

  • This guide takes me around a week to complete setup OpenCV with CUDA on this Jetson lol, im struggling with alot of error while build cmake for OpenCV.

Credit

jetson-nano-development-kit-install-opencv-cuda's People

Contributors

tanaha2002 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.