diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/core/BaseVisionTaskApi.java b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/core/BaseVisionTaskApi.java index 0405e6dbf..0decfaf18 100644 --- a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/core/BaseVisionTaskApi.java +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/core/BaseVisionTaskApi.java @@ -34,7 +34,6 @@ public class BaseVisionTaskApi implements AutoCloseable { protected final String normRectStreamName; static { - System.loadLibrary("mediapipe_tasks_vision_jni"); ProtoUtil.registerTypeName(NormalizedRect.class, "mediapipe.NormalizedRect"); } diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/facedetector/FaceDetector.java b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/facedetector/FaceDetector.java index 09dad443a..4152e5d4d 100644 --- a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/facedetector/FaceDetector.java +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/facedetector/FaceDetector.java @@ -81,6 +81,10 @@ public final class FaceDetector extends BaseVisionTaskApi { private static final String TASK_GRAPH_NAME = "mediapipe.tasks.vision.face_detector.FaceDetectorGraph"; + static { + System.loadLibrary("mediapipe_tasks_vision_jni"); + } + /** * Creates a {@link FaceDetector} instance from a model file and the default {@link * FaceDetectorOptions}. diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/facelandmarker/FaceLandmarker.java b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/facelandmarker/FaceLandmarker.java index f7792a1be..2f57aacb1 100644 --- a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/facelandmarker/FaceLandmarker.java +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/facelandmarker/FaceLandmarker.java @@ -86,6 +86,10 @@ public final class FaceLandmarker extends BaseVisionTaskApi { private static final String TASK_GRAPH_NAME = "mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"; + static { + System.loadLibrary("mediapipe_tasks_vision_jni"); + } + /** * Creates a {@link FaceLandmarker} instance from a model asset bundle path and the default {@link * FaceLandmarkerOptions}. diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/facestylizer/FaceStylizer.java b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/facestylizer/FaceStylizer.java index dbc26b39a..305f22301 100644 --- a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/facestylizer/FaceStylizer.java +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/facestylizer/FaceStylizer.java @@ -88,6 +88,10 @@ public final class FaceStylizer extends BaseVisionTaskApi { "mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"; private final boolean hasResultListener; + static { + System.loadLibrary("mediapipe_tasks_vision_jni"); + } + /** * Creates an {@link FaceStylizer} instance from an {@link FaceStylizerOptions}. * diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/gesturerecognizer/GestureRecognizer.java b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/gesturerecognizer/GestureRecognizer.java index 03c2d03f0..42e46c6d0 100644 --- a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/gesturerecognizer/GestureRecognizer.java +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/gesturerecognizer/GestureRecognizer.java @@ -93,6 +93,10 @@ public final class GestureRecognizer extends BaseVisionTaskApi { private static final String TASK_GRAPH_NAME = "mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"; + static { + System.loadLibrary("mediapipe_tasks_vision_jni"); + } + /** * Creates a {@link GestureRecognizer} instance from a model file and the default {@link * GestureRecognizerOptions}. diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/handlandmarker/HandLandmarker.java b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/handlandmarker/HandLandmarker.java index 8b02b15ad..f259f24f2 100644 --- a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/handlandmarker/HandLandmarker.java +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/handlandmarker/HandLandmarker.java @@ -89,6 +89,10 @@ public final class HandLandmarker extends BaseVisionTaskApi { private static final String TASK_GRAPH_NAME = "mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"; + static { + System.loadLibrary("mediapipe_tasks_vision_jni"); + } + /** * Creates a {@link HandLandmarker} instance from a model file and the default {@link * HandLandmarkerOptions}. diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imageclassifier/ImageClassifier.java b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imageclassifier/ImageClassifier.java index 8da7c0267..6f5790398 100644 --- a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imageclassifier/ImageClassifier.java +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imageclassifier/ImageClassifier.java @@ -104,6 +104,7 @@ public final class ImageClassifier extends BaseVisionTaskApi { "mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"; static { + System.loadLibrary("mediapipe_tasks_vision_jni"); ProtoUtil.registerTypeName( ClassificationsProto.ClassificationResult.class, "mediapipe.tasks.components.containers.proto.ClassificationResult"); diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imageembedder/ImageEmbedder.java b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imageembedder/ImageEmbedder.java index 0c1d24366..7e4c7c229 100644 --- a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imageembedder/ImageEmbedder.java +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imageembedder/ImageEmbedder.java @@ -87,6 +87,7 @@ public final class ImageEmbedder extends BaseVisionTaskApi { "mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"; static { + System.loadLibrary("mediapipe_tasks_vision_jni"); ProtoUtil.registerTypeName( EmbeddingsProto.EmbeddingResult.class, "mediapipe.tasks.components.containers.proto.EmbeddingResult"); diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imagegenerator/ImageGenerator.java b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imagegenerator/ImageGenerator.java index 73a205044..250af3aab 100644 --- a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imagegenerator/ImageGenerator.java +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imagegenerator/ImageGenerator.java @@ -80,6 +80,10 @@ public final class ImageGenerator extends BaseVisionTaskApi { private CachedInputs cachedInputs = new CachedInputs(); private boolean inProcessing = false; + static { + System.loadLibrary("mediapipe_tasks_vision_image_generator_jni"); + } + /** * Creates an {@link ImageGenerator} instance from an {@link ImageGeneratorOptions}. * diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imagesegmenter/ImageSegmenter.java b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imagesegmenter/ImageSegmenter.java index 2a64b588b..5837e6d06 100644 --- a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imagesegmenter/ImageSegmenter.java +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/imagesegmenter/ImageSegmenter.java @@ -93,6 +93,10 @@ public final class ImageSegmenter extends BaseVisionTaskApi { private boolean hasResultListener = false; private List labels = new ArrayList<>(); + static { + System.loadLibrary("mediapipe_tasks_vision_jni"); + } + /** * Creates an {@link ImageSegmenter} instance from an {@link ImageSegmenterOptions}. * diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/interactivesegmenter/InteractiveSegmenter.java b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/interactivesegmenter/InteractiveSegmenter.java index fe0ce0c3f..a53f76f9d 100644 --- a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/interactivesegmenter/InteractiveSegmenter.java +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/interactivesegmenter/InteractiveSegmenter.java @@ -102,6 +102,7 @@ public final class InteractiveSegmenter extends BaseVisionTaskApi { private List labels = new ArrayList<>(); static { + System.loadLibrary("mediapipe_tasks_vision_jni"); ProtoUtil.registerTypeName(RenderData.class, "mediapipe.RenderData"); } diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/objectdetector/ObjectDetector.java b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/objectdetector/ObjectDetector.java index 0c70a119d..3a0343424 100644 --- a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/objectdetector/ObjectDetector.java +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/objectdetector/ObjectDetector.java @@ -113,6 +113,10 @@ public final class ObjectDetector extends BaseVisionTaskApi { private static final int IMAGE_OUT_STREAM_INDEX = 1; private static final String TASK_GRAPH_NAME = "mediapipe.tasks.vision.ObjectDetectorGraph"; + static { + System.loadLibrary("mediapipe_tasks_vision_jni"); + } + /** * Creates an {@link ObjectDetector} instance from a model file and the default {@link * ObjectDetectorOptions}. diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/poselandmarker/PoseLandmarker.java b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/poselandmarker/PoseLandmarker.java index d59448dac..fba2c714e 100644 --- a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/poselandmarker/PoseLandmarker.java +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/poselandmarker/PoseLandmarker.java @@ -86,6 +86,10 @@ public final class PoseLandmarker extends BaseVisionTaskApi { private static final String TASK_GRAPH_NAME = "mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"; + static { + System.loadLibrary("mediapipe_tasks_vision_jni"); + } + /** * Creates a {@link PoseLandmarker} instance from a model file and the default {@link * PoseLandmarkerOptions}.