nncase
nncase copied to clipboard
Convert QUANTIZED_UINT8 tflite model to kmodel
I have a Google AutoML trained model exported to tflite and I wanted to convert it to kmodel to use it on a Sipeed Maixpy board. Even if I try to force an inference type, it doesn't understand and it gave me some errors.
This is the command I'm running:
./ncc/ncc -i tflite -o k210model --dataset /content/images /content/model.tflite /content/model.kmodel
and this is the error it returns:
Fatal: expect FLOAT32 tensor but got UINT8, use '--inference_type=FLOAT' when converting via toco.
System.InvalidOperationException: expect FLOAT32 tensor but got UINT8, use '--inference_type=FLOAT' when converting via toco.
at NnCase.Converter.Converters.TfLiteExtensions.GetTensor[T](Model model, Tensor tensor) in D:\Work\Repository\nncase\src\NnCase.Converter\Converters\TfLiteToGraphConverter.cs:line 420
at NnCase.Converter.Converters.TfLiteToGraphConverter.ConvertConv2d(Operator op) in D:\Work\Repository\nncase\src\NnCase.Converter\Converters\TfLiteToGraphConverter.cs:line 142
at NnCase.Converter.Converters.TfLiteToGraphConverter.ConvertOperator(Operator op) in D:\Work\Repository\nncase\src\NnCase.Converter\Converters\TfLiteToGraphConverter.cs:line 69
at System.Linq.Enumerable.SelectEnumerableIterator`2.ToList()
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at NnCase.Converter.Converters.TfLiteToGraphConverter.Convert() in D:\Work\Repository\nncase\src\NnCase.Converter\Converters\TfLiteToGraphConverter.cs:line 34
at NnCase.Cli.Program.Main(String[] args) in D:\Work\Repository\nncase\src\NnCase.Cli\Program.cs:line 113
at NnCase.Cli.Program.<Main>(String[] args)
Is there a command or an option that converts the UINT8 model to kmodel?
Thanks in advance
Hi, if you have found a solution to this, please let us know.
I couldn't find, had to change my approach for the problem and tried to train my model without AutoML. The results are obviously worse but it is what it is. Still waiting for a contributor to answer if it's possible or not
Currently only FLOAT models are supported.