Open ArunShi opened 4 years ago
Mr. Arun opened a ticket with MS. However I wanted to know if "Vision Skills Manager" is a Microsoft class or a custom Java library implementation. The error java.lang.OutOfMemoryError: Failed to allocate a 67107856 byte allocation with 6291456 free bytes and 41MB until OOM, max allowed footprint 500119960, growth limit 536870912>"} ai.customvision.visionskills.VisionSkillsManager.throwIfJNIFailed
does not appear from a Microsoft library. Can someone comment more on it?
Thanks @ArunShi for reporting this issue. We tried to reproduce this error with no luck so far. Could you please share some more info with us?
I was able to reproduce this issue on my 2 Android devices: Samsung Galaxy S8 (Android 9) and Huawei MediaPad M5 lite (also Android 9).
I'm developing an app which is using multiple models for object detection. For now I'm using this example project to load models and detect objects with newest source code from this repository.
In my app each model is loaded by creating new MSCognitiveServicesCustomVisionObjectDetector() classifier, which constructor takes path to model.
Loading the model approx. 4-7 times (depends on device and probably on avaiable memory) results in an OutOfMemoryException inside a ai.customvision.visionskills.VisionSkillsException. This exception occurs also when loading the same model many times. It's also reproducible using example cats and dogs model provided in this project.
It occurs at this section of MSCognitiveServicesCustomVisionObjectDetector class constructor
// Build a config object for ImageClassifier
ai.customvision.tflite.ObjectDetector.Configuration config = ai.customvision.tflite.ObjectDetector.ConfigurationBuilder()
.setModelFile(modelManifestPath).build();
Whole stack trace is basically the same as provided above.
we have noted that OutofMemory error occurs in the default class of Vision Skills Manager. We could not able to edit this class because by default its comes from MS Cognitive library. Attached the log file for your reference
This issue is for a: (mark with an
x
)Minimal steps to reproduce
Any log messages given by the failure
ai.customvision.visionskills.VisionSkillsManager.throwIfJNIFailed (VisionSkillsManager.java:24) ai.customvision.visionskills.VisionSkillsManager.SkillConfigurationBuild_orThrow (VisionSkillsManager.java:553) ai.customvision.visionskills.VisionSkillsManager.skillConfigurationBuild (VisionSkillsManager.java:309) ai.customvision.visionskills.ConfigurationBase.build (ConfigurationBase.java:41) ai.customvision.visionskills.CVSObjectDetector$Configuration.build (CVSObjectDetector.java:66) com.example.crajava.mldc.MSCognitiveServicesCustomVisionObjectDetector. (MSCognitiveServicesCustomVisionObjectDetector.java:78)
com.example.crajava.mldc.ObjectDetectorActivity.onCreate (ObjectDetectorActivity.java:123)
android.app.Activity.performCreate (Activity.java:7136)
android.app.Activity.performCreate (Activity.java:7127)
android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1271)
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2926)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3081)
android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:78)
android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108)
android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1838)
android.os.Handler.dispatchMessage (Handler.java:106)
android.os.Looper.loop (Looper.java:193)
android.app.ActivityThread.main (ActivityThread.java:6715)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:911)
Expected/desired behavior
OS and Version?
Versions
Mention any other details that might be useful