Skip to content

Commit

Permalink
[Fixes] Minor doc fixes as well ass removed Metal delegate
Browse files Browse the repository at this point in the history
  • Loading branch information
VadymPinchuk committed Aug 13, 2023
1 parent ee68b43 commit aeb25f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import 'package:tflite_flutter/tflite_flutter.dart';
// **WARNING:** This is not production code and is only intended to be used for
// demonstration purposes.
//
// The following database works by spawning a background isolate and
// The following Detector example works by spawning a background isolate and
// communicating with it over Dart's SendPort API. It is presented below as a
// demonstration of the feature "Background Isolate Channels" and shows using
// plugins from a background isolate. The [SimpleDatabase] operates on the root
// isolate and the [_SimpleDatabaseServer] operates on a background isolate.
// plugins from a background isolate. The [Detector] operates on the root
// isolate and the [_DetectorServer] operates on a background isolate.
//
// Here is an example of the protocol they use to communicate:
//
Expand Down Expand Up @@ -113,11 +113,6 @@ class Detector {
interpreterOptions.addDelegate(XNNPackDelegate());
}

// Use Metal Delegate
if (Platform.isIOS) {
interpreterOptions.addDelegate(GpuDelegate());
}

return Interpreter.fromAsset(
_modelPath,
options: interpreterOptions..threads = 4,
Expand Down Expand Up @@ -257,7 +252,7 @@ class _DetectorServer {
var preProcessStart = DateTime.now().millisecondsSinceEpoch;

/// Pre-process the image
/// Resizing image fpr model, [300, 300]
/// Resizing image for model [300, 300]
final imageInput = image_lib.copyResize(
image!,
width: mlModelInputSize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ class _DetectorWidgetState extends State<DetectorWidget>
void _initializeCamera() async {
cameras = await availableCameras();
// cameras[0] for back-camera
_cameraController = CameraController(cameras[0], ResolutionPreset.medium,
enableAudio: false)
..initialize().then((_) async {
// Stream of image passed to [onLatestImageAvailable] callback
_cameraController = CameraController(
cameras[0],
ResolutionPreset.medium,
enableAudio: false,
)..initialize().then((_) async {
await _controller.startImageStream(onLatestImageAvailable);
setState(() {});

Expand Down

0 comments on commit aeb25f5

Please sign in to comment.