Skip to content

Ambarella

CVEDIA-RT supports CVFlow (CV2x) in the following chipsets: cv2, cv22, cv25, cv28, cv5 and cv52.

Older chipsets, such as s3l and s5l are also supported but due deployment complexity we don't supply a public release, if you want to test in this platforms, contact us.

Requirements checklist

  • CV2x EVK device flashed with SDK 3.0.x with the following features enabled:
    • Arm Neon (enabled by default)
    • Cavalry (enabled by default)
    • EazyAI (enabled by default)
    • OpenCV 3
    • FFMPEG
  • ~100mb disk space

CVEDIA-RT is compiled against GCC 10.2 using linaro-aarch64-2020.09-gcc10.2 toolchain. This is the default for Ambarela's SDK 3.0.x.

Preflight checks

Enabling Cavalry Kernel module

Before running CVEDIA-RT you must make sure that cavalry module is loaded. You can confirm this if you have a /dev/cavalry.

If you don't have it, you can enable it by running:

modprobe cavalry
cavalry_load -f /lib/firmware/cavalry.bin -r

/lib/firmware/cavalry.bin

If the file /lib/firmware/cavalry.bin is missing your buildroot / kernel wasn't configured with CVFlow support, please refer to Ambarella's SDK documentation to know how to enable it.

To confirm modules been loaded you can:

lsmod | grep cavalry

/dev/cavalry

Make sure that /dev/cavalry exists, if it doesn't you should reboot and try to load the kernel module again.

Reboots

If you reboot the device you need to do this process again, it's recommended to create a startup script at /etc/init.d/S99 to do it automatically.

Wake up encoder

You may need to set wake up the encoder, otherwise image acquisition won't work:

test_tunning -a &

Finally, you should run HDMI preview:

test_encode -i 0 -V 480p -f 30 --hdmi

WARNING: This last section highly depends on what camera sensor you're using, please refer to your Ambarella's EVK Getting Started Guide for mode information.

Enable USB host

CVEDIA-RT requires around 100MB of space to run, if you don't have enough temporary storage, you may want to enable usb so you can plugin a storage device for persistent storage.

To do that, please refer to Ambarella's EVK Getting Started Guide for mode information. You will need to switch jumpers on your board to enable usb storage, it will only work with usb 2.0.

You will also need to load some kernel modules, here's a basic startup / mount sequence:

echo host > /proc/ambarella/usbphy0
cat /proc/ambarella/usbphy0
modprobe usbcore
modprobe ehci-hcd
modprobe ehci_ambarella

mount -t ext2 /dev/sda1 /storage/sda1

Running CVEDIA-RT

CVEDIA-RT has .so dependencies that need to be in the LD path, we don't recommend copying them to the system path as it may interfere with other processes.

To call our binaries we recommend prepending to LD_LIBRARY_PATH, assuming you extracted cvedia-rt to /opt/cvedia-rt, you would call our binaries like this:

LD_LIBRARY_PATH=/opt/cvedia-rt:$LD_LIBRARY_PATH ./rtcmd --help

It's also important to note that you must configure a persistent license path at the rtconfig.json, by default this it's set to /opt/cvedia-rt/licenses:

...
    "licensing": {
        "home_dir": "/opt/cvedia-rt/licenses"
    }
...

Binaries

  • rtcmd provides serveral inspection and debugging tools
  • rtservice is the main service you should be running to create and manage instances; It will automatically expose the API.

Examples

Testing cavalry model execution

LD_LIBRARY_PATH=/opt/cvedia-rt:$LD_LIBRARY_PATH ./rtcmd inference benchmark -u cavalry://pva_det/rgb/medium_y6_mosaic_rot90_224x224/240326 -n 1000 -i 1

Running RTSERVICE

LD_LIBRARY_PATH=/opt/cvedia-rt:$LD_LIBRARY_PATH ./rtservice

You can control RTSERVICE using our REST API that will be listening on port 3546