From ee7db990c7d6262c907259184c66e420367b3935 Mon Sep 17 00:00:00 2001 From: Persie Date: Sat, 24 Aug 2024 20:02:41 +0200 Subject: [PATCH 1/6] is_asset --- .../computer_vision/flutter_vision/FlutterVisionPlugin.java | 2 +- lib/flutter_vision.dart | 1 + lib/src/plugin/android.dart | 3 ++- lib/src/plugin/base.dart | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/vladih/computer_vision/flutter_vision/FlutterVisionPlugin.java b/android/src/main/java/com/vladih/computer_vision/flutter_vision/FlutterVisionPlugin.java index 5a71fa0..bbd4745 100644 --- a/android/src/main/java/com/vladih/computer_vision/flutter_vision/FlutterVisionPlugin.java +++ b/android/src/main/java/com/vladih/computer_vision/flutter_vision/FlutterVisionPlugin.java @@ -172,7 +172,7 @@ private void close_ocr_model(Result result) { private void load_yolo_model(Map args) throws Exception { final String model = this.assets.getAssetFilePathByName(args.get("model_path").toString()); - final Object is_asset_obj = args.get("is_asset"); + final Object is_asset_obj = args.get("is_asset"); final boolean is_asset = is_asset_obj == null ? false : (boolean) is_asset_obj; final int num_threads = (int) args.get("num_threads"); final boolean quantization = (boolean) args.get("quantization"); diff --git a/lib/flutter_vision.dart b/lib/flutter_vision.dart index 993d8ca..9081d1f 100644 --- a/lib/flutter_vision.dart +++ b/lib/flutter_vision.dart @@ -94,6 +94,7 @@ abstract class FlutterVision { required String modelVersion, bool? quantization, int? numThreads, + bool? is_asset, bool? useGpu}); ///yoloOnFrame accept a byte List as input and diff --git a/lib/src/plugin/android.dart b/lib/src/plugin/android.dart index c13f298..e1d9922 100644 --- a/lib/src/plugin/android.dart +++ b/lib/src/plugin/android.dart @@ -87,11 +87,12 @@ class AndroidFlutterVision extends BaseFlutterVision implements FlutterVision { required String modelVersion, bool? quantization, int? numThreads, + bool? is_asset, bool? useGpu}) async { try { await channel.invokeMethod('loadYoloModel', { 'model_path': modelPath, - 'is_asset': true, + 'is_asset': is_asset ?? true, 'quantization': quantization ?? false, 'num_threads': numThreads ?? 1, 'use_gpu': useGpu ?? false, diff --git a/lib/src/plugin/base.dart b/lib/src/plugin/base.dart index 0245f4d..20808b5 100644 --- a/lib/src/plugin/base.dart +++ b/lib/src/plugin/base.dart @@ -70,6 +70,7 @@ abstract class BaseFlutterVision { bool? quantization, int? numThreads, bool? useGpu, + bool? is_asset, }); Future>> yoloOnFrame({ From b2b5e17792fb5de79cbf25227f5dee8959124f79 Mon Sep 17 00:00:00 2001 From: Persie Date: Sat, 24 Aug 2024 20:34:15 +0200 Subject: [PATCH 2/6] dependencies --- lib/src/plugin/android.dart | 2 +- pubspec.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/src/plugin/android.dart b/lib/src/plugin/android.dart index e1d9922..eedd97f 100644 --- a/lib/src/plugin/android.dart +++ b/lib/src/plugin/android.dart @@ -92,7 +92,7 @@ class AndroidFlutterVision extends BaseFlutterVision implements FlutterVision { try { await channel.invokeMethod('loadYoloModel', { 'model_path': modelPath, - 'is_asset': is_asset ?? true, + 'is_asset': is_asset ?? false, 'quantization': quantization ?? false, 'num_threads': numThreads ?? 1, 'use_gpu': useGpu ?? false, diff --git a/pubspec.yaml b/pubspec.yaml index e1cbb82..ca8e530 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: flutter_vision description: Plugin for managing Yolov5, Yolov8 and Tesseract v5 accessing with TensorFlow Lite 2.x. Support object detection, segmentation and OCR on Android. iOS, Working in progress. -version: 1.1.4 +version: 1.1.5 homepage: https://github.com/vladiH/flutter_vision @@ -12,11 +12,11 @@ environment: dependencies: flutter: sdk: flutter - path: ^1.8.1 - path_provider: ^2.0.11 + path: ^1.9.0 + path_provider: ^2.1.4 dev_dependencies: - flutter_lints: ^2.0.1 + flutter_lints: ^4.0.0 flutter_test: sdk: flutter # For information on the generic Dart part of this file, see the From 03952c34bbeb8ab070c498e0094488f2bda5684e Mon Sep 17 00:00:00 2001 From: Persie Date: Sat, 24 Aug 2024 20:42:34 +0200 Subject: [PATCH 3/6] fix --- .../flutter_vision/FlutterVisionPlugin.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/vladih/computer_vision/flutter_vision/FlutterVisionPlugin.java b/android/src/main/java/com/vladih/computer_vision/flutter_vision/FlutterVisionPlugin.java index bbd4745..2487dd2 100644 --- a/android/src/main/java/com/vladih/computer_vision/flutter_vision/FlutterVisionPlugin.java +++ b/android/src/main/java/com/vladih/computer_vision/flutter_vision/FlutterVisionPlugin.java @@ -171,9 +171,14 @@ private void close_ocr_model(Result result) { } private void load_yolo_model(Map args) throws Exception { - final String model = this.assets.getAssetFilePathByName(args.get("model_path").toString()); + String model = ""; final Object is_asset_obj = args.get("is_asset"); final boolean is_asset = is_asset_obj == null ? false : (boolean) is_asset_obj; + if(is_asset){ + model = this.assets.getAssetFilePathByName(args.get("model_path").toString()); + }else{ + model = args.get("model_path").toString(); + } final int num_threads = (int) args.get("num_threads"); final boolean quantization = (boolean) args.get("quantization"); final boolean use_gpu = (boolean) args.get("use_gpu"); From 679384cfbe81f529e396029e2a905e94eb5a30c6 Mon Sep 17 00:00:00 2001 From: Persie Date: Sun, 25 Aug 2024 01:48:20 +0200 Subject: [PATCH 4/6] i --- .../computer_vision/flutter_vision/FlutterVisionPlugin.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/vladih/computer_vision/flutter_vision/FlutterVisionPlugin.java b/android/src/main/java/com/vladih/computer_vision/flutter_vision/FlutterVisionPlugin.java index 2487dd2..e1e9047 100644 --- a/android/src/main/java/com/vladih/computer_vision/flutter_vision/FlutterVisionPlugin.java +++ b/android/src/main/java/com/vladih/computer_vision/flutter_vision/FlutterVisionPlugin.java @@ -174,15 +174,17 @@ private void load_yolo_model(Map args) throws Exception { String model = ""; final Object is_asset_obj = args.get("is_asset"); final boolean is_asset = is_asset_obj == null ? false : (boolean) is_asset_obj; + String label_path = ""; if(is_asset){ model = this.assets.getAssetFilePathByName(args.get("model_path").toString()); + label_path = this.assets.getAssetFilePathByName(args.get("label_path").toString()); }else{ model = args.get("model_path").toString(); + label_path = args.get("label_path").toString(); } final int num_threads = (int) args.get("num_threads"); final boolean quantization = (boolean) args.get("quantization"); final boolean use_gpu = (boolean) args.get("use_gpu"); - final String label_path = this.assets.getAssetFilePathByName(args.get("label_path").toString()); final int rotation = (int) args.get("rotation"); final String version = args.get("model_version").toString(); switch (version) { From 0cb68e8e2f07c9abb00e9b8562ac9b261f3c8691 Mon Sep 17 00:00:00 2001 From: Persie Date: Mon, 28 Oct 2024 00:25:26 +0100 Subject: [PATCH 5/6] added namespace --- android/build.gradle | 3 ++- pubspec.yaml | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 4e9e193..3233fd7 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -32,7 +32,8 @@ rootProject.allprojects { apply plugin: 'com.android.library' android { - compileSdkVersion 31 + namespace "com.vladih.computer_vision.flutter_vision" + compileSdkVersion 35 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 diff --git a/pubspec.yaml b/pubspec.yaml index ca8e530..5f27af0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: flutter_vision description: Plugin for managing Yolov5, Yolov8 and Tesseract v5 accessing with TensorFlow Lite 2.x. Support object detection, segmentation and OCR on Android. iOS, Working in progress. -version: 1.1.5 +version: 1.1.6 homepage: https://github.com/vladiH/flutter_vision @@ -12,11 +12,11 @@ environment: dependencies: flutter: sdk: flutter - path: ^1.9.0 + path: ^1.9.1 path_provider: ^2.1.4 dev_dependencies: - flutter_lints: ^4.0.0 + flutter_lints: ^5.0.0 flutter_test: sdk: flutter # For information on the generic Dart part of this file, see the From 109aa9f4735e1f819ca70d5c991485342e847050 Mon Sep 17 00:00:00 2001 From: Persie Date: Mon, 28 Oct 2024 00:49:42 +0100 Subject: [PATCH 6/6] changed path version --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 5f27af0..4fb4a9a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,7 +12,7 @@ environment: dependencies: flutter: sdk: flutter - path: ^1.9.1 + path: ^1.9.0 path_provider: ^2.1.4 dev_dependencies: