Changes between Version 11 and Version 12 of venice/npu


Ignore:
Timestamp:
08/13/2024 08:16:13 PM (4 months ago)
Author:
Tim Harvey
Comment:

added missing sudo to cmds and added bash formatting

Legend:

Unmodified
Added
Removed
Modified
  • venice/npu

    v11 v12  
    2424
    2525Then, use dd to flash this image onto your device byte-for-byte.
    26 {{{
     26{{{#!bash
    2727DEVICE=<your device, no trailing />
    2828wget https://dev.gateworks.com/buildroot/venice/minimal/rescue.img.gz
    29 zcat rescue.img.gz | dd of=${DEVICE} bs=1M oflag=sync
     29zcat rescue.img.gz | sudo dd of=${DEVICE} bs=1M oflag=sync
    3030}}}
    3131
    3232In 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.
    3333
    34 {{{
    35 parted ${DEVICE} "resizepart 1 -0" # resize the partition to fit the size of the drive
    36 resize2fs ${DEVICE}1 # resize ext fs on device partition 1
     34{{{#!bash
     35sudo parted ${DEVICE} "resizepart 1 -0" # resize the partition to fit the size of the drive
     36sudo resize2fs ${DEVICE}1 # resize ext fs on device partition 1
    3737}}}
    3838
     
    4242In this download you will find imx-image-full-imx8mpevk.wic, which is a Yocto-generated image with all of the ML libraries.
    4343Copy this image to our device.
    44 {{{
     44{{{#!bash
    4545sudo mount ${DEVICE}1 /mnt
    4646sudo cp imx-image-full-imx8mpevk.wic /mnt/
     
    5050Due 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.
    5151
    52 {{{
     52{{{#!bash
    5353git clone https://github.com/nxp-imx/linux-imx -b lf-6.6.y
    5454cd linux-imx
     
    6767Copy 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.
    6868
    69 {{{
     69{{{#!bash
    7070mkdir /mnt/nxp
    7171cp arch/arm64/boot/dts/freescale/*venice*.dtb /mnt/nxp/
     
    8787
    8888Sanity check: is the USB device properly detected?
    89 {{{
     89{{{#!bash
    9090usb start
    9191part list usb 0
     
    9393
    9494This command should have an expected output like below
    95 {{{
     95{{{#!bash
    9696Partition Map for USB device 0  --   Partition Type: DOS
    9797
     
    102102Override 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.
    103103
    104 {{{
     104{{{#!bash
    105105setenv boot_targets usb0
    106106run bootcmd_${boot_targets}
     
    115115
    116116Your 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
    118118DEVICE=<flash device, with no trailing />
    119119mkdir /mnt/src
     
    127127
    128128This 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
    130130cat <<\EOF > boot.scr.txt
    131131setenv bootargs 'root=/dev/mmcblk2p2'
     
    145145
    146146'Compile' the boot script txt and flash it onto the MMC
    147 {{{
     147{{{#!bash
    148148mkimage -A arm64 -T script -C none -d boot.scr.txt /mnt/dst/boot.scr
    149149umount /mnt/dst
     
    163163As 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.
    164164
    165 {{{
     165{{{#!bash
    166166$ cd /usr/bin/tensorflow-lite-2.15.0/examples
    167167$ python3 label_image.py
     
    170170
    171171Result from either label_image script:
    172 {{{
     172{{{#!bash
    1731730.878431: military uniform
    1741740.027451: Windsor tie
     
    199199
    200200On 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
    202202CAMERA= <your camera device, such as /dev/video2>
    203203HOST_IP= <desktop ip addr>