convert tflite to kmodel for non image data


#1

hello,
I trained a tflite model for iris dataset. It takes in 4 floating point numbers as input and returns softmax prediction for 3 flower categories. When I tried to convert the tflitemodel to kmodel(tflite2kmodel.sh), I saw that there should be some images in an image folder for k210model output. But my model is not for images. Is there any way I can run this model in Maix?


#2

for those small input, you need padding zeros for data input, as kpu minimum input size is 4x4
so, you can padding zeros to make input to 4x4 matrix or above.
and normalization float to 0~255 before input.


#3

Thanks for the info on 4x4 input. So for a 4x1 input, I need to map my data into 0-255 and use it as a pixel in image? coz to convert to kmodel, I need to put some images in the image folder of nncase tool.

Is there any plan to include non image models? For example, if I am getting data from multiple sensors, I would like to feed them into a neural net to get some decision. Also scaling to 0-255 may cause loss of precision or information sometimes.


#4

you can generate 4x4 pic via some python script.

it is not case for non-image model, it is just quantization problem.
If you think 8bit is too short, you can quantize to 16bit, and put 8bit to high byte, 8bit to low byte.
when you train model, weights will automatically know what it mean