Changes between Version 11 and Version 12 of venice/npu
- Timestamp:
- 08/13/2024 08:16:13 PM (4 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
venice/npu
v11 v12 24 24 25 25 Then, use dd to flash this image onto your device byte-for-byte. 26 {{{ 26 {{{#!bash 27 27 DEVICE=<your device, no trailing /> 28 28 wget https://dev.gateworks.com/buildroot/venice/minimal/rescue.img.gz 29 zcat rescue.img.gz | dd of=${DEVICE} bs=1M oflag=sync29 zcat rescue.img.gz | sudo dd of=${DEVICE} bs=1M oflag=sync 30 30 }}} 31 31 32 32 In this guide, we will have the NXP image and our rescue image on the same drive, so we will resize the partition and file system to fit both. If you're using separate devices, this is not necessary. 33 33 34 {{{ 35 parted ${DEVICE} "resizepart 1 -0" # resize the partition to fit the size of the drive36 resize2fs ${DEVICE}1 # resize ext fs on device partition 134 {{{#!bash 35 sudo parted ${DEVICE} "resizepart 1 -0" # resize the partition to fit the size of the drive 36 sudo resize2fs ${DEVICE}1 # resize ext fs on device partition 1 37 37 }}} 38 38 … … 42 42 In this download you will find imx-image-full-imx8mpevk.wic, which is a Yocto-generated image with all of the ML libraries. 43 43 Copy this image to our device. 44 {{{ 44 {{{#!bash 45 45 sudo mount ${DEVICE}1 /mnt 46 46 sudo cp imx-image-full-imx8mpevk.wic /mnt/ … … 50 50 Due to small inconsistencies between the NXP and Gateworks devicetrees for bleeding-edge peripherals, a patch is required until mainline compatibility is reached. The below script gets the patches from the attachments at the bottom of this page. 51 51 52 {{{ 52 {{{#!bash 53 53 git clone https://github.com/nxp-imx/linux-imx -b lf-6.6.y 54 54 cd linux-imx … … 67 67 Copy these patched dtbs to a directory on your flash such as {{{/nxp/}}}, as to not overwrite the ones necessary for booting into the rescue image. 68 68 69 {{{ 69 {{{#!bash 70 70 mkdir /mnt/nxp 71 71 cp arch/arm64/boot/dts/freescale/*venice*.dtb /mnt/nxp/ … … 87 87 88 88 Sanity check: is the USB device properly detected? 89 {{{ 89 {{{#!bash 90 90 usb start 91 91 part list usb 0 … … 93 93 94 94 This command should have an expected output like below 95 {{{ 95 {{{#!bash 96 96 Partition Map for USB device 0 -- Partition Type: DOS 97 97 … … 102 102 Override the boot_targets variable temporarily to ensure booting into the Rescue Image, then boot into it. If you are not using usb0, run {{{print boot_targets}}} to see a list. 103 103 104 {{{ 104 {{{#!bash 105 105 setenv boot_targets usb0 106 106 run bootcmd_${boot_targets} … … 115 115 116 116 Your multimedia device will likely have a different device name than when it was connected to the host computer; in our case, it is now {{{/dev/sda}}} instead of {{{/dev/sdc}}}. This is expected. 117 {{{ 117 {{{#!bash 118 118 DEVICE=<flash device, with no trailing /> 119 119 mkdir /mnt/src … … 127 127 128 128 This flashes the prebuilt .wic image (both partitions, the kernel and fs) to our eMMC, then also brings over the old and new device trees. Next, we will create the boot script. If the below doesn't copy right, the file can be created/edited in a text editor like vi; just remove the EOF line. 129 {{{ 129 {{{#!bash 130 130 cat <<\EOF > boot.scr.txt 131 131 setenv bootargs 'root=/dev/mmcblk2p2' … … 145 145 146 146 'Compile' the boot script txt and flash it onto the MMC 147 {{{ 147 {{{#!bash 148 148 mkimage -A arm64 -T script -C none -d boot.scr.txt /mnt/dst/boot.scr 149 149 umount /mnt/dst … … 163 163 As per the [[https://www.nxp.com/docs/en/user-guide/IMX-MACHINE-LEARNING-UG.pdf | NXP Machine Learning User's Guide]], we will test a simple image labeling script on both the CPU and NPU. 164 164 165 {{{ 165 {{{#!bash 166 166 $ cd /usr/bin/tensorflow-lite-2.15.0/examples 167 167 $ python3 label_image.py … … 170 170 171 171 Result from either label_image script: 172 {{{ 172 {{{#!bash 173 173 0.878431: military uniform 174 174 0.027451: Windsor tie … … 199 199 200 200 On your board, execute the following to send a stream over UDP to the host port 5000. This script was derived from Section 8.1 of the Machine Learning Users Guide. The GStreamer command takes in a video input and overlays both bounding boxes and labels on it using !TensorFlow and NXP filters. 201 {{{ 201 {{{#!bash 202 202 CAMERA= <your camera device, such as /dev/video2> 203 203 HOST_IP= <desktop ip addr>