tflite version error
Note: /home/irotech/Desktop/flutter_linux_v1.7.8+hotfix.4-stable/flutter/.pub-cache/hosted/pub.dartlang.org/tflite-1.0.4/android/src/main/java/sq/flutter/tflite/TflitePlugin.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.
I am continuously getting this error and i have tried all the version of Tflite till 1.0.1, but still getting the same error.
this looks like a warning? are u sure the build process ends after this?
No Build Process doesn't end on this, but i am not able to use tflite feature in my app. Simply it just starting camera, maybe because app is not supporting tflite.
did you load the correct model?
Thanks, I got it, now it's running fine
But I Need Your Little Bit Help, I Am Getting A new error
I/flutter ( 9450): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 9450): The following NoSuchMethodError was thrown building HomePage(dirty, dependencies: [MediaQuery],
I/flutter ( 9450): state: _HomePageState#0269d):
I/flutter ( 9450): The getter 'height' was called on null.
I/flutter ( 9450): Receiver: null
I/flutter ( 9450): Tried calling: height
I/flutter ( 9450):
I/flutter ( 9450): The relevant error-causing widget was:
I/flutter ( 9450): HomePage file:///home/irotech/Desktop/flutterProjects/shop_by_image/lib/main.dart:25:13
I/flutter ( 9450):
I/flutter ( 9450): When the exception was thrown, this was the stack:
I/flutter ( 9450): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
I/flutter ( 9450): #1 _HomePageState.build (package:shop_by_image/HomePage.dart:127:33)
I/flutter ( 9450): #2 StatefulElement.build (package:flutter/src/widgets/framework.dart:4334:27)
I/flutter ( 9450): #3 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4223:15)
I/flutter ( 9450): #4 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
I/flutter ( 9450): #5 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
I/flutter ( 9450): #6 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11)
I/flutter ( 9450): #7 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
I/flutter ( 9450): #8 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 9450): #9 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 9450): #10 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
I/flutter ( 9450): #11 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 9450): #12 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 9450): #13 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
I/flutter ( 9450): #14 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
I/flutter ( 9450): #15 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
I/flutter ( 9450): #16 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
I/flutter ( 9450): #17 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 9450): #18 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 9450): #19 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
I/flutter ( 9450): #20 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 9450): #21 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 9450): #22 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
I/flutter ( 9450): #23 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 9450): #24 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 9450): #25 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
....
...
..
.
I/flutter ( 9450): #314 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 9450): #315 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 9450): #316 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1028:16)
I/flutter ( 9450): #317 RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:999:5)
I/flutter ( 9450): #318 RenderObjectToWidgetAdapter.attachToRenderTree.
I Try To print the Recognition what i am getting from the frame. "Object Detect on Frame Failure"
this is a flutter error, not a tflite module error try to clean start the app
did u clean start it?
Yes, getting same error
`String _model="YOLO";
int _imageHeight=0;
int _imageWidth=0;
List
CameraController controller; deviceRatio(context) => MediaQuery.of(context).size.width / MediaQuery.of(context).size.height; bool isDetecting=false;
@override void initState(){ super.initState(); loadModel(); if(widget.cameras==null || widget.cameras.length<1){ print("No Camera is Found"); }else{ controller=new CameraController(widget.cameras[0], ResolutionPreset.medium); controller.initialize().then((_){ if(!mounted){ return; } setState(() {});
controller.startImageStream((CameraImage img) async{
// print("Enter1");
if(!isDetecting){
isDetecting=true;
// int startTime = DateTime.now().millisecondsSinceEpoch;
if(_model=="YOLO"){
// print("Enter3");
try{
var recognation= await Tflite.detectObjectOnFrame(
bytesList:img.planes.map((plane){
return plane.bytes;
}).toList(),
model: _model,
imageHeight:img.height,
imageWidth:img.width,
imageMean:0,
imageStd:255.0,
numResultsPerClass:1,
threshold:0.2,
);
print(recognation);
setState(() {
_recognition=recognation;
_imageHeight=img.height;
_imageWidth=img.width;
});
}on PlatformException {
print("Object Detect on Frame Failure");
}
}
}
});
});
}
}
@override void dispose(){ controller?.dispose(); super.dispose(); }
loadModel() async{ try{ await Tflite.close(); String modelRespo; if(_model=="YOLO"){ modelRespo= await Tflite.loadModel( model: "assets/tflite/yolov2_tiny.tflite", labels: "assets/tflite/yolov2_tiny.txt", ); } print(modelRespo); }on PlatformException { print("Failed to load the model"); } }
// setRecognition(recognition,imageHeight,imageWidth){ // setState(() { // _recognition=recognition; // _imageHeight=imageHeight; // _imageWidth=imageWidth; // }); // }
@override Widget build(BuildContext context) { Size screen=MediaQuery.of(context).size;
var tmp = MediaQuery.of(context).size;
var screenH = math.max(tmp.height, tmp.width);
var screenW = math.min(tmp.height, tmp.width);
tmp = controller.value.previewSize;
var previewH = math.max(tmp.height, tmp.width);
var previewW = math.min(tmp.height, tmp.width);
var screenRatio = screenH / screenW;
var previewRatio = previewH / previewW;
return Stack(
children: <Widget>[
!controller.value.isInitialized?Center(
child:CircularProgressIndicator(),
):OverflowBox(
maxHeight:
screenRatio > previewRatio ? screenH : screenW / previewW * previewH,
maxWidth:
screenRatio > previewRatio ? screenH / previewH * previewW : screenW,
child: CameraPreview(controller),
),
BoundedBox(
_recognition==null ?[]:_recognition,
math.max(_imageHeight,_imageWidth),
math.min(_imageHeight, _imageWidth),
screen.height,
screen.width,
_model
)
],
);
} }`
Actually I am Not Getting this error, what does it mean? The first few lines only i am not able to understand!
@bunny1999 please stop mentioning your error in literally all the issues.
as for the error try checking what your tmp variable is.