This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
projects:farmrobot:nvidia-jetson-tx1 [2021/01/07 16:27] jason |
projects:farmrobot:nvidia-jetson-tx1 [2021/01/10 19:28] jason |
||
---|---|---|---|
Line 5: | Line 5: | ||
^ User ^ Password | ^ User ^ Password | ||
| '' | | '' | ||
+ | |||
+ | ===== Running YOLOv5 with on-board CSI camera or external USB camera (Motion JPEG) ===== | ||
+ | |||
+ | Arguments for NVIDIA' | ||
+ | |||
+ | To start YOLOv5' | ||
+ | |||
+ | <file shell> | ||
+ | # On-board CSI camera | ||
+ | python3.8 detect.py --source " | ||
+ | |||
+ | # External USB camera (Motion JPEG) | ||
+ | python3.8 detect.py --source " | ||
+ | </ | ||
+ | |||
+ | <WRAP important> | ||
+ | In the example above, the on-board CSI camera is represented by ''/ | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | See this [[https:// | ||
+ | </ | ||
===== Current data ===== | ===== Current data ===== | ||
Line 34: | Line 56: | ||
{{: | {{: | ||
{{: | {{: | ||
+ | {{: | ||
==== Measurements ==== | ==== Measurements ==== | ||
Line 178: | Line 201: | ||
sudo swapon ~/swapfile | sudo swapon ~/swapfile | ||
+ | </ | ||
+ | |||
+ | ==== Building OpenCV from source (with GStreamer support) ==== | ||
+ | |||
+ | Because [[https:// | ||
+ | |||
+ | <WRAP info> | ||
+ | [[https:// | ||
+ | </ | ||
+ | |||
+ | To get started, install the packages that OpenCV with GStreamer support depends on: | ||
+ | |||
+ | <file shell> | ||
+ | sudo apt install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev | ||
+ | </ | ||
+ | |||
+ | Then, install [[https:// | ||
+ | |||
+ | <file shell> | ||
+ | python3.8 -m pip install --user numpy | ||
+ | </ | ||
+ | |||
+ | After all dependencies are installed, go ahead and clone the [[https:// | ||
+ | |||
+ | <file shell> | ||
+ | git clone https:// | ||
+ | |||
+ | cd opencv | ||
+ | |||
+ | # General | ||
+ | git checkout < | ||
+ | |||
+ | # OpenCV 4.5.0 | ||
+ | git checkout 4.5.0 | ||
+ | </ | ||
+ | |||
+ | Before you can start building OpenCV, create a ''/ | ||
+ | |||
+ | <file shell> | ||
+ | mkdir build | ||
+ | |||
+ | cd build | ||
+ | </ | ||
+ | |||
+ | Then, use '' | ||
+ | |||
+ | <file shell> | ||
+ | cmake -D CMAKE_BUILD_TYPE=RELEASE \ | ||
+ | -D INSTALL_PYTHON_EXAMPLES=ON \ | ||
+ | -D INSTALL_C_EXAMPLES=OFF \ | ||
+ | -D PYTHON_EXECUTABLE=$(which python3.8) \ | ||
+ | -D BUILD_opencv_python2=OFF \ | ||
+ | -D CMAKE_INSTALL_PREFIX=$(python3.8 -c “import sys; print(sys.prefix)”) \ | ||
+ | -D PYTHON3_EXECUTABLE=$(which python3.8) \ | ||
+ | -D PYTHON3_INCLUDE_DIR=$(python3.8 -c “from distutils.sysconfig import get_python_inc; | ||
+ | -D PYTHON3_PACKAGES_PATH=$(python3.8 -c “from site import getsitepackages; | ||
+ | -D WITH_GSTREAMER=ON \ | ||
+ | -D BUILD_EXAMPLES=ON .. | ||
+ | </ | ||
+ | |||
+ | It is important to check the resulting output. Check if the output contains the following important bits: | ||
+ | |||
+ | <file shell> | ||
+ | ... | ||
+ | |||
+ | GStreamer: | ||
+ | |||
+ | ... | ||
+ | |||
+ | Python3: | ||
+ | Interpreter: | ||
+ | Libraries: | ||
+ | numpy: | ||
+ | install path: < | ||
+ | |||
+ | ... | ||
+ | </ | ||
+ | |||
+ | If everything went well, you can go ahead and build it: | ||
+ | |||
+ | <file shell> | ||
+ | sudo make -j$(nproc) | ||
+ | </ | ||
+ | |||
+ | When the build is finished, install it: | ||
+ | |||
+ | <file shell> | ||
+ | sudo make install | ||
</ | </ | ||
Line 270: | Line 381: | ||
</ | </ | ||
- | Then change the directory into the local repository and clone the official [[https:// | + | Then change the directory into the local repository and clone the official [[https:// |
<file shell> | <file shell> |