jaeheee / flutterwithmediapipe Goto Github PK
View Code? Open in Web Editor NEWFlutter with MediaPipe ML models
Flutter with MediaPipe ML models
Thank you for this repository!
Face Detector works fine when there is one face present, but when there are 2 or more Non maximum supression algorithm gets stuck in infinite while loop. It doesn't filter out non-intersecting boxes properly.
I have slightly modified your code in non_maximum_supression.dart to
var picks = <int>[];
while (I.isNotEmpty) {
var ind0 = positions.sublist(positions.length - 1, positions.length);
var ind1 = positions.sublist(0, positions.length - 1);
var xx1 = _maximum(_itemIndex(_x1, ind0)[0], _itemIndex(_x1, ind1));
var yy1 = _maximum(_itemIndex(_y1, ind0)[0], _itemIndex(_y1, ind1));
var xx2 = _minimum(_itemIndex(_x2, ind0)[0], _itemIndex(_x2, ind1));
var yy2 = _minimum(_itemIndex(_y2, ind0)[0], _itemIndex(_y2, ind1));
var w = _maximum(0.0, xx2 - xx1);
var h = _maximum(0.0, yy2 - yy1);
var inter = w * h;
var o = inter /
(_sum(_itemIndex(area, ind0)[0], _itemIndex(area, ind1)) - inter);
picks.add(ind0[0]);
List<double> newI = [];
List<int> newPositions = [];
o.asMap().forEach((key, value) {
if (value <= threshold) {
newI.add(I[key]);
newPositions.add(positions[key]);
}
});
I = newI;
positions = newPositions;
}
List<Detection> results = [];
for (var pick in picks) {
results.add(detections[pick]);
}
return results;
and also in face_detection_service.dart
for (var detection in detections) {
Rect? bbox;
final score = detection.score;
if (score > threshold) {
bbox = Rect.fromLTRB(
inputImage.width * detection.xMin,
inputImage.height * detection.yMin,
inputImage.width * detection.width,
inputImage.height * detection.height,
);
bbox = _imageProcessor.inverseTransformRect(
bbox, image.height, image.width);
}
rectFaces.add({'bbox': bbox, 'score': score});
}
rectFaces.sort((a, b) => b['score'].compareTo(a['score']));
return rectFaces;
It detects and returns multiple boxes for each face present. I hope it helps, thanks again for this project.
I can create a new Flutter project and successfully run it,
But I encountered an error while running this Flutter project, as shown below;
I need help
——————————————————————————————
Launching lib\main.dart on NTN AN20 in debug mode...
[!] Your app isn't using AndroidX.
To avoid potential build failures, you can quickly migrate your app by following the steps on https://goo.gl/CP92wY .
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
What went wrong:
Task 'assembleDebug' not found in root project 'android'.
Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 23s
ProcessException: Process exited abnormally with exit code 1:
Welcome to Gradle 7.2!
Here are the highlights of this release:
For more details see https://docs.gradle.org/7.2/release-notes.html
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings
FAILURE: Build failed with an exception.
What went wrong:
Project 'app' not found in root project 'android'.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1s
Command: D:\zlxDownload\FlutterWithMediaPipe-main\android\gradlew.bat app:tasks --all --console=auto
when i open the app i cant see screen painter on any model .
Hello, I downloaded your project and wanted to give it a try, but I got an error because of the sign in function in the build.gradle file. Unfortunately, there is no such keystore file on my computer, so I cannot run the application.
`FAILURE: Build failed with an exception.
Where:
Build file 'D:\Projects\tensorFlow-Flutter-main\tensorFlow-Flutter-main\android\app\build.gradle' line: 57
What went wrong:
A problem occurred evaluating project ':app'.
D:\Projects\tensorFlow-Flutter-main\tensorFlow-Flutter-main\android\keystore\keystore.password (Sistem belirtilen yolu bulam�yor)
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org/
I am running this application on a google pixel 4a.
I am getting these issues for all 4 models of media pipe..
Encountering the following errors:
======== Exception caught by foundation library ====================================================
The following _CastError was thrown while dispatching notifications for CameraController:
Null check operator used on a null value
codes below:
if (Platform.isAndroid) {
image = imageLib.copyRotate(image, angle: -90);
image = imageLib.flipHorizontal(image);
}
var tensorImage = TensorImage(TensorType.float32);
tensorImage.loadImage(image);
tensorImage = imageProcessor.process(tensorImage);
Hi,
On macos developing environment with an Android device, I did:
sh install.sh
flutter pub get
flutter run
But received error like this:
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/*path*/FlutterWithMediaPipe/android/app/build.gradle' line: 57
* What went wrong:
A problem occurred evaluating project ':app'.
> /Users/*path*/FlutterWithMediaPipe/android/keystore/keystore.password (No such file or directory)
How to use holistic solution?
I am unable to build the project for iOS. Here are the steps to reproduce the error:
sh install.sh
flutter pub add get
pod install
flutter run
This produces the following error:
Ld /Users/vijeshrao/Library/Developer/Xcode/DerivedData/Runner-hggazerwaeetoqeyyebckgveptau/Build/Intermediates.noindex/Pods.build/Release-iphoneos/tflite_flutter.build/Objects-normal/armv7/Binary/tflite_flutter normal armv7 (in target 'tflite_flutter' from project 'Pods')
cd /Users/vijeshrao/Downloads/FlutterWithMediaPipe-main\ 2/ios/Pods
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target armv7-apple-ios9.0 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk -L/Users/vijeshrao/Library/Developer/Xcode/DerivedData/Runner-hggazerwaeetoqeyyebckgveptau/Build/Products/Release-iphoneos/tflite_flutter -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/lib/swift -F/Users/vijeshrao/Library/Developer/Xcode/DerivedData/Runner-hggazerwaeetoqeyyebckgveptau/Build/Products/Release-iphoneos/tflite_flutter -F/Users/vijeshrao/Documents/flutter/bin/cache/artifacts/engine/ios-release/Flutter.xcframework/ios-arm64_armv7 -filelist /Users/vijeshrao/Library/Developer/Xcode/DerivedData/Runner-hggazerwaeetoqeyyebckgveptau/Build/Intermediates.noindex/Pods.build/Release-iphoneos/tflite_flutter.build/Objects-normal/armv7/tflite_flutter.LinkFileList -install_name @rpath/tflite_flutter.framework/tflite_flutter -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/vijeshrao/Library/Developer/Xcode/DerivedData/Runner-hggazerwaeetoqeyyebckgveptau/Build/Intermediates.noindex/Pods.build/Release-iphoneos/tflite_flutter.build/Objects-normal/armv7/tflite_flutter_lto.o -fembed-bitcode-marker -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/vijeshrao/Library/Developer/Xcode/DerivedData/Runner-hggazerwaeetoqeyyebckgveptau/Build/Intermediates.noindex/Pods.build/Release-iphoneos/tflite_flutter.build/Objects-normal/armv7/tflite_flutter.swiftmodule -all_load -lc++ -framework TensorFlowLiteC -framework Flutter -framework Foundation -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/vijeshrao/Library/Developer/Xcode/DerivedData/Runner-hggazerwaeetoqeyyebckgveptau/Build/Intermediates.noindex/Pods.build/Release-iphoneos/tflite_flutter.build/Objects-normal/armv7/tflite_flutter_dependency_info.dat -o /Users/vijeshrao/Library/Developer/Xcode/DerivedData/Runner-hggazerwaeetoqeyyebckgveptau/Build/Intermediates.noindex/Pods.build/Release-iphoneos/tflite_flutter.build/Objects-normal/armv7/Binary/tflite_flutter
ld: framework not found TensorFlowLiteC
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How can I solve this issue? Please let me know.
Thank you in advance..!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.