Open cahyowhy opened 1 year ago
got an error while running method BoundingBoxUtils.convert
BoundingBoxUtils.convert
E/flutter ( 8045): [ERROR:flutter/runtime/dart_isolate.cc(1097)] Unhandled exception: E/flutter ( 8045): Invalid argument(s): Size of bounding box dimBouBoxension 1 is not 4. Got 25 in shape [1, 25] E/flutter ( 8045): #0 SupportPreconditions.checkArgument (package:tflite_flutter_helper_plus/src/common/support_preconditions.dart:16:7) E/flutter ( 8045): #1 BoundingBoxUtils.convert (package:tflite_flutter_helper_plus/src/image/bounding_box_utils.dart:74:26) E/flutter ( 8045): #2 TfliteClassifier.predict (package:etlesigap/utils/object_detection/tflite_clasifier.dart:219:45) E/flutter ( 8045): #3 IsolateimageClasifier.entryPoint (package:etlesigap/utils/object_detection/isolate_image_clasifier.dart:62:32) E/flutter ( 8045): <asynchronous suspension>
this is my output shapes
[ [1,25], [1,25,4], [1], [1,25] ]
and this is how i used
TensorBuffer outputLocations = TensorBufferFloat(_outputShapes[0]); TensorBuffer outputClasses = TensorBufferFloat(_outputShapes[1]); TensorBuffer outputScores = TensorBufferFloat(_outputShapes[2]); TensorBuffer numLocations = TensorBufferFloat(_outputShapes[3]); // Outputs map Map<int, Object> outputs = { 0: outputLocations.buffer, 1: outputClasses.buffer, 2: outputScores.buffer, 3: numLocations.buffer, }; var inferenceTimeStart = DateTime.now().millisecondsSinceEpoch; // run inference _interpreter.runForMultipleInputs([inputImage.buffer], outputs); // _interpreter.runForMultipleInputs([inputImage.buffer.asUint8List()], outputs); var inferenceTimeElapsed = DateTime.now().millisecondsSinceEpoch - inferenceTimeStart; // Maximum number of results to show int resultsCount = min(numResults, numLocations.getIntValue(0)); // Using labelOffset = 1 as ??? at index 0 int labelOffset = 1; // Using bounding box utils for easy conversion of tensorbuffer to List<Rect> List<Rect> locations = BoundingBoxUtils.convert( // tensor: outputClasses, tensor: outputLocations, // valueIndex: [1, 0, 3, 2], valueIndex: [1, 3, 0, 2], boundingBoxAxis: 1, // boundingBoxAxis: 2, boundingBoxType: BoundingBoxType.boundaries, coordinateType: CoordinateType.ratio, height: inputSize, width: inputSize, );
my model props
got an error while running method
BoundingBoxUtils.convert
this is my output shapes
and this is how i used