This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
projects:farmrobot:nvidia-jetson-tx1 [2021/01/03 20:13] jason |
projects:farmrobot:nvidia-jetson-tx1 [2021/01/10 02:12] jason |
||
---|---|---|---|
Line 6: | Line 6: | ||
| '' | | '' | ||
- | ===== Stats ===== | + | ===== Running YOLOv5 with on-board camera |
+ | |||
+ | Arguments for NVIDIA' | ||
+ | |||
+ | To start YOLOv5' | ||
+ | |||
+ | <file shell> | ||
+ | python3.8 detect.py --source " | ||
+ | </ | ||
+ | |||
+ | ===== Current data ===== | ||
+ | |||
+ | ==== On-board camera ==== | ||
+ | |||
+ | <file shell> | ||
+ | sudo apt install -y v4l-utils | ||
+ | </ | ||
+ | |||
+ | <file shell> | ||
+ | v4l2-ctl -d /dev/video0 --list-formats-ext | ||
+ | |||
+ | ioctl: VIDIOC_ENUM_FMT | ||
+ | Index : 0 | ||
+ | Type : Video Capture | ||
+ | Pixel Format: ' | ||
+ | Name : 10-bit Bayer BGBG/GRGR | ||
+ | Size: Discrete 2592x1944 | ||
+ | Interval: Discrete 0.033s (30.000 fps) | ||
+ | Size: Discrete 2592x1458 | ||
+ | Interval: Discrete 0.033s (30.000 fps) | ||
+ | Size: Discrete 1280x720 | ||
+ | Interval: Discrete 0.008s (120.000 fps) | ||
+ | </ | ||
+ | |||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | |||
+ | ==== Measurements | ||
YOLOv5 (street.mp4): | YOLOv5 (street.mp4): | ||
+ | |||
+ | {{: | ||
===== Setup ===== | ===== Setup ===== | ||
Line 55: | Line 97: | ||
After the installation finished, disconnect the Jetson TX1 from the host machine. | After the installation finished, disconnect the Jetson TX1 from the host machine. | ||
+ | |||
+ | ==== Mounting external storage to /home ==== | ||
+ | |||
+ | Mount the partition on the SD-card to ''/ | ||
+ | |||
+ | <file shell> | ||
+ | sudo mount / | ||
+ | </ | ||
+ | |||
+ | Change into the ''/ | ||
+ | |||
+ | <file shell> | ||
+ | cd /home | ||
+ | cp -adpR * /mnt | ||
+ | </ | ||
+ | |||
+ | Unmount the partition from ''/ | ||
+ | |||
+ | <file shell> | ||
+ | sudo umount /mnt | ||
+ | </ | ||
+ | |||
+ | Then open the disk utility and go to the mounting settings of the partition on the SD-card. | ||
+ | Set it to automatically mount on ''/ | ||
==== Updating apt packages ==== | ==== Updating apt packages ==== | ||
Line 123: | Line 189: | ||
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 215: | Line 369: | ||
</ | </ | ||
- | 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> |