How can i using rockpis in AI

Who can provide some useful AI application or example code to me?
I need some ideas to develop my rockpis.

thanks
:grinning::grinning::grinning::grinning::grinning::grinning::grinning::grinning::grinning::grinning::grinning:

has anyone go the tflite delegator to work? I’m using rock pi 4c and rock 3a.

https://www.tensorflow.org/lite/performance/delegates

I think the delegates can be hit and miss as been trying the ArmNN delegate for Mali and just seem to get segmentation faults and sort of slightly bemused.
I thought the way the delegates worked if layers exist that your delegate is capable it will run and throw back any not capable to the the cpu based tflite libs.
So this makes delegates super easy to use than specific tools with limited layer funtionality to export a model to NPU format.
Seems to be preference to using the tflite from the google-coral repo https://github.com/google-coral/pycoral/releases or at least Arm do for there Mali and may be true for all as they are using that in there tutorials with the 2.5 version in that repo.

The 0.8Tops is likely much less than what you will get on the Cortex-A55 2Ghz anyway and prob only useful for small models or maybe if your going to partition a model, but guess it could lighten the load.
From memory so could be wrong 4C is a bit more capable 3Tops? Still have never tried the RockchipNN and don’t even know if they do a delegate but delgates are NPU vendor supplied.

So all I can say is I have tried the Arm Mali delegate without much success.
I am trying to get myself in a position for the Rock5B as each element of CPU, GPU & NPU on that SoC can do some quite heavy lifting so you could theoretically partition across all three and run something that would be considered relatively heavy or run 3 models of considerable load concurrently but my play with Mali delegates isn’t runnng all that smooth :slight_smile:

If you download or compile a delegate then with the above tflite2.5 you should be able to run something like this.

import numpy as np
import tflite_runtime.interpreter as tflite

# Load TFLite model and allocate tensors.
# (if you are using the complete tensorflow package you can find load_delegate in tf.experimental.load_delegate)
test_delegate = tflite.load_delegate( library="<path to delegate>/Delegate.so",
                                       options={"backends": "CpuAcc,GpuAcc,CpuRef", "logging-severity":"info"})

interpreter = tflite.Interpreter(model_path="<testdir>/test_model.tflite", 
                                 experimental_delegates=[test_delegate])
interpreter.allocate_tensors()

# Get input and output tensors.
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()

# Test model on random input data.
input_shape = input_details[0]['shape']
input_data = np.array(np.random.random_sample(input_shape), dtype=np.uint8)
interpreter.set_tensor(input_details[0]['index'], input_data)

interpreter.invoke()

# Print out result
output_data = interpreter.get_tensor(output_details[0]['index'])
print(output_data)

But so far not so good for me…

anyone try this https://github.com/ROCmSoftwarePlatform/tensorflow-upstream I found a refrence in the code specifically for the mali t860 chipset… not quick sure all the steps to get it working but seems simple enough. maybe an alternative to armnn?

AMD https://rocmdocs.amd.com/en/latest/Deep_learning/Deep-learning.html

Rockchip NPU’s are covered in


But with the RockPiS you have neither Mali or RK Npu

So its just straight https://www.tensorflow.org/lite/ or https://onnx.ai/ maybe

The rockpi 4c does mention mali t8600, I can run tflite on the board but want to use the delegator to use the mali chipset, I’ve installed https://wiki.radxa.com/Rockpi4/Ubuntu#Additional_software so should have the chicpset working but need to know the "path to delegate"

The delegate is not a rockchip product the mali is arm

You can try it and the tutorial was full of bugs that are easy fixes but its not just a copy and paste.
There is a tutorial here but I spent a while and sort of gave up as anything but there simple test model seems to crash.

https://developer.arm.com/documentation/102561/2111/Device-specific-installation/Install-on-Raspberry-Pi?lang=en

It might be interesting with the RockPi5 is that is a Mali blob than the mesa drivers I have tried.