-1

I am using a tensorflow lite model created in Azure Custom Vision. The model returns a tensor consisting of 4 lists .

Here is my output specification

  final output = {
    0: List<List<num>>.filled(64, List<num>.filled(4, 0)),
    1: List<num>.filled(64, 0),
    // 1: List<Int64>.filled(64, Int64(0)),
    2: List<num>.filled(64, 0),
    3: [0.0],
  };

This works, but the values returned for the dict item 1, is supposed to be an int64, not an int. So the returned values are consistent, but messed up, e.g. 72057594037927936, instead of a 1.

When I try to use the commented out prefill of the dict item 1, i.e. List.filled(64, Int64(0)), where Int64 is defined in package:fixnum/fixnum.dart, it fails with the following message:

"type 'int' is not a subtype of type 'Int64' of 'value'"

How can I get the correct int values for a detected class, e.g. 1 instead of 72057594037927936?

Any advice would be highly appreciated.

Thanks,

Patrik

I tried to prepare the output tensor like so: List.filled(64, Int64(0)),

  • Finally I figured out a solution that works for me. Not very elegant IMHO, but it works and perhaps can be used by someone else to build a more generic, elegant and robust solution. ``` lang-dart const int OBSERVATIONS = 64; const int COORDINATES = 4; final output = { 1: List.filled(OBSERVATIONS, 0), }; final output_fetcher = { 1: Uint8List.fromList(List.filled(OBSERVATIONS * 8, 0)), }; _interpreter!.runForMultipleInputs([input], output_fetcher); output[1] = (output_fetcher[1]! as Uint8List) .buffer .asUint64List() .toInt8List() .toList();``` – Patrik Jonsson Lumentec Aug 31 '23 at 04:57

0 Answers0