Loading Pose graph in different scenes
See original GitHub issueDescription
MediapipeUnityPlugin: v0.8.2
Unity: 2020.2.1f1
Dev Machine: Windows 10 Pro
Target: Android
Device: MI Note 8 pro
AAR built using: Docker Linux image on Windows.
DLL built using: Windows Docker image
Target is set to GPU
I am trying to load the model in different scenes.
I have attached the Pose Tracking Solution
GameObject to my scene with Bootstrap GameObject and accessing models output landmark using the PoseTrackingSolution
class.
I am building it for Android and it does not work well in the first run, but when I close the app and run it again it logs the same INFO
but does not run.
To check whether the model is loaded or not I have added a global variable when is set to true after the following code:
Initially it is false
public static bool isGraphLoaded = false;
Later I set it to true here:
yield return new WaitForEndOfFrame();
isGraphLoaded = true;
Sometimes I saw isGraphLoaded
never be true.
Please let me know if I am doing something wrong here, or maybe if there is any better way to know that graph is loaded or not.
Logs:
2022/02/08 17:53:26.654 11903 11993 Info Unity Bootstrap: Setting global flags...
2022/02/08 17:53:26.654 11903 11993 Info Unity Mediapipe.Unity.MemoizedLogger:Log(LogLevel, String, Object)
2022/02/08 17:53:26.654 11903 11993 Info Unity Mediapipe.Unity.<Start>d__17:MoveNext()
2022/02/08 17:53:26.654 11903 11993 Info Unity UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
2022/02/08 17:53:26.654 11903 11993 Info Unity
2022/02/08 17:53:26.654 11903 11993 Error native E20220208 17:53:26.654320 11993 logging.cc:18] Aborted
2022/02/08 17:53:26.655 11903 11993 Error Unity MediaPipeException: MediaPipe Aborted, refer glog files for more details
2022/02/08 17:53:26.655 11903 11993 Error Unity at Mediapipe.MpReturnCodeExtension.Assert (Mediapipe.MpReturnCode code) [0x00000] in <00000000000000000000000000000000>:0
2022/02/08 17:53:26.655 11903 11993 Error Unity at Mediapipe.Unity.Bootstrap+<Start>d__17.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
2022/02/08 17:53:26.655 11903 11993 Error Unity at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0
2022/02/08 17:53:26.655 11903 11993 Error Unity
2022/02/08 17:53:26.658 11903 11993 Info Unity ==> Setting credit:
2022/02/08 17:53:26.658 11903 11993 Info Unity Mediapipe.Unity.PoseTracking.<fetchAssetBundles>d__39:MoveNext()
2022/02/08 17:53:26.658 11903 11993 Info Unity System.Runtime.CompilerServices.AsyncTaskCache:CreateCacheableTask(TResult)
2022/02/08 17:53:26.658 11903 11993 Info Unity Mediapipe.Unity.PoseTracking.PoseModeDrawing:fetchAssetBundles()
2022/02/08 17:53:26.658 11903 11993 Info Unity System.Action:Invoke()
2022/02/08 17:53:26.658 11903 11993 Info Unity UnityThread:Update()
2022/02/08 17:53:26.658 11903 11993 Info Unity
2022/02/08 17:53:26.660 11903 11993 Info Unity PoseTrackingGraph: Using OpenGLES config
2022/02/08 17:53:26.660 11903 11993 Info Unity Mediapipe.Unity.MemoizedLogger:Log(LogLevel, String, Object)
2022/02/08 17:53:26.660 11903 11993 Info Unity Mediapipe.Unity.<Initialize>d__35:MoveNext()
2022/02/08 17:53:26.660 11903 11993 Info Unity Mediapipe.Unity.<Run>d__20:MoveNext()
2022/02/08 17:53:26.660 11903 11993 Info Unity UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
2022/02/08 17:53:26.660 11903 11993 Info Unity Mediapipe.Unity.WaitForResult:.ctor(MonoBehaviour, IEnumerator, Int64)
2022/02/08 17:53:26.660 11903 11993 Info Unity Mediapipe.Unity.GraphRunner:WaitForInit()
2022/02/08 17:53:26.660 11903 11993 Info Unity Mediapipe.Unity.PoseTracking.<Run>d__28:MoveNext()
2022/02/08 17:53:26.660 11903 11993 Info Unity UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
2022/02/08 17:53:26.660 11903 11993 Info Unity Mediapipe.Unity.PoseTracking.PoseTrackingSolution:Play()
2022/02/08 17:53:26.660 11903 11993 Info Unity Mediapipe.Unity.<Start>d__4:MoveNext()
2022/02/08 17:53:26.660 11903 11993 Info Unity UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
2022/02/08 17:53:26.673 11903 11993 Info Unity PoseTrackingGraph: Loading dependent assets...
2022/02/08 17:53:26.673 11903 11993 Info Unity Mediapipe.Unity.MemoizedLogger:Log(LogLevel, String, Object)
2022/02/08 17:53:26.673 11903 11993 Info Unity Mediapipe.Unity.<Initialize>d__35:MoveNext()
2022/02/08 17:53:26.673 11903 11993 Info Unity Mediapipe.Unity.<Run>d__20:MoveNext()
2022/02/08 17:53:26.673 11903 11993 Info Unity UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
2022/02/08 17:53:26.673 11903 11993 Info Unity Mediapipe.Unity.WaitForResult:.ctor(MonoBehaviour, IEnumerator, Int64)
2022/02/08 17:53:26.673 11903 11993 Info Unity Mediapipe.Unity.GraphRunner:WaitForInit()
2022/02/08 17:53:26.673 11903 11993 Info Unity Mediapipe.Unity.PoseTracking.<Run>d__28:MoveNext()
2022/02/08 17:53:26.673 11903 11993 Info Unity UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
2022/02/08 17:53:26.673 11903 11993 Info Unity Mediapipe.Unity.PoseTracking.PoseTrackingSolution:Play()
2022/02/08 17:53:26.673 11903 11993 Info Unity Mediapipe.Unity.<Start>d__4:MoveNext()
2022/02/08 17:53:26.673 11903 11993 Info Unity UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
2022/02/08 17:53:26.674 11903 11993 Info Unity StreamingAssetsResourceManager: pose_detection.bytes will not be copied to /storage/emulated/0/Android/data/ai.torquevision.zumbio/files/pose_detection.bytes because it already exists
2022/02/08 17:53:26.674 11903 11993 Info Unity Mediapipe.Unity.MemoizedLogger:Log(LogLevel, String, Object)
2022/02/08 17:53:26.674 11903 11993 Info Unity Mediapipe.Unity.<PrepareAssetAsync>d__11:MoveNext()
2022/02/08 17:53:26.674 11903 11993 Info Unity Mediapipe.Unity.<Run>d__20:MoveNext()
2022/02/08 17:53:26.674 11903 11993 Info Unity UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
2022/02/08 17:53:26.674 11903 11993 Info Unity Mediapipe.Unity.WaitForResult:.ctor(MonoBehaviour, IEnumerator, Int64)
2022/02/08 17:53:26.674 11903 11993 Info Unity Mediapipe.Unity.GraphRunner:WaitForAsset(String, String, Boolean)
2022/02/08 17:53:26.674 11903 11993 Info Unity Mediapipe.Unity.PoseTracking.PoseTrackingGraph:RequestDependentAssets()
2022/02/08 17:53:26.674 11903 11993 Info Unity Mediapipe.Unity.<Initialize>d__35:MoveNext()
2022/02/08 17:53:26.674 11903 11993 Info Unity Mediapipe.Unity.<Run>d__20:MoveNext()
2022/02/08 17:53:26.674 11903 11993 Info Unity UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
2022/02/08 17:53:26.674 11903 11993 Info Unity Mediapipe.Unity.WaitForResult:.ctor(MonoBehaviour, IEnumerator, Int64)
2022/02/08 17:53:26.674 11903 11993 Info Unity Mediapipe.Unity.GraphRunner:WaitForInit()
2022/02/08 17:53:26.674 11903 11993 Info Unity Mediapipe.Unity.PoseTracking.<Run>d__28:MoveNext()
2022/02/08 17:53:26.674 11903 11993 Info Unity UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
2022/02/08 17:53:26.674 11903 11993 Info Unity Mediapipe.Unity.PoseTracking.PoseTrackingSo
2022/02/08 17:53:26.675 11903 11993 Info Unity StreamingAssetsResourceManager: pose_landmark_lite.bytes will not be copied to /storage/emulated/0/Android/data/ai.torquevision.zumbio/files/pose_landmark_lite.bytes because it already exists
2022/02/08 17:53:26.675 11903 11993 Info Unity Mediapipe.Unity.MemoizedLogger:Log(LogLevel, String, Object)
2022/02/08 17:53:26.675 11903 11993 Info Unity Mediapipe.Unity.<PrepareAssetAsync>d__11:MoveNext()
2022/02/08 17:53:26.675 11903 11993 Info Unity Mediapipe.Unity.<Run>d__20:MoveNext()
2022/02/08 17:53:26.675 11903 11993 Info Unity UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
2022/02/08 17:53:26.675 11903 11993 Info Unity Mediapipe.Unity.WaitForResult:.ctor(MonoBehaviour, IEnumerator, Int64)
2022/02/08 17:53:26.675 11903 11993 Info Unity Mediapipe.Unity.GraphRunner:WaitForAsset(String, String, Boolean)
2022/02/08 17:53:26.675 11903 11993 Info Unity Mediapipe.Unity.PoseTracking.PoseTrackingGraph:RequestDependentAssets()
2022/02/08 17:53:26.675 11903 11993 Info Unity Mediapipe.Unity.<Initialize>d__35:MoveNext()
2022/02/08 17:53:26.675 11903 11993 Info Unity Mediapipe.Unity.<Run>d__20:MoveNext()
2022/02/08 17:53:26.675 11903 11993 Info Unity UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
2022/02/08 17:53:26.675 11903 11993 Info Unity Mediapipe.Unity.WaitForResult:.ctor(MonoBehaviour, IEnumerator, Int64)
2022/02/08 17:53:26.675 11903 11993 Info Unity Mediapipe.Unity.GraphRunner:WaitForInit()
2022/02/08 17:53:26.675 11903 11993 Info Unity Mediapipe.Unity.PoseTracking.<Run>d__28:MoveNext()
2022/02/08 17:53:26.675 11903 11993 Info Unity UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
2022/02/08 17:53:26.675 11903 11993 Info Unity Mediapipe.Unity.PoseTracking.PoseTr
2022/02/08 17:53:32.244 11903 11993 Error native E20220208 17:53:32.244141 11993 calculator_graph.cc:152] Unknown exception occured
2022/02/08 17:53:32.248 11903 11993 Error Unity MediaPipePluginException: Unknown exception is thrown in Unmanaged Code
2022/02/08 17:53:32.248 11903 11993 Error Unity at Mediapipe.MpReturnCodeExtension.Assert (Mediapipe.MpReturnCode code) [0x00000] in <00000000000000000000000000000000>:0
2022/02/08 17:53:32.248 11903 11993 Error Unity at Mediapipe.CalculatorGraph.CloseAllPacketSources () [0x00000] in <00000000000000000000000000000000>:0
2022/02/08 17:53:32.248 11903 11993 Error Unity at Mediapipe.Unity.GraphRunner.Stop () [0x00000] in <00000000000000000000000000000000>:0
2022/02/08 17:53:32.248 11903 11993 Error Unity at Mediapipe.Unity.PoseTracking.PoseTrackingGraph.Stop () [0x00000] in <00000000000000000000000000000000>:0
Sometimes I get these errors when I enable Glogs:
2022/02/09 13:40:03.276 25110 25150 Info Unity Bootstrap: Setting global flags...
2022/02/09 13:40:03.276 25110 25150 Info Unity Mediapipe.Unity.MemoizedLogger:Log(LogLevel, String, Object)
2022/02/09 13:40:03.276 25110 25150 Info Unity Mediapipe.Unity.<Start>d__17:MoveNext()
2022/02/09 13:40:03.276 25110 25150 Info Unity UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
2022/02/09 13:40:03.276 25110 25150 Error native E20220209 13:40:03.276816 25150 logging.cc:18] Aborted
2022/02/09 13:40:03.277 25110 25150 Error Unity MediaPipeException: MediaPipe Aborted, refer glog files for more details
2022/02/09 13:40:03.277 25110 25150 Error Unity at Mediapipe.MpReturnCodeExtension.Assert (Mediapipe.MpReturnCode code) [0x00000] in <00000000000000000000000000000000>:0
2022/02/09 13:40:03.277 25110 25150 Error Unity at Mediapipe.Unity.Bootstrap+<Start>d__17.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
2022/02/09 13:40:03.277 25110 25150 Error Unity at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0
2022/02/09 13:40:03.277 25110 25150 Error Unity
2022/02/09 13:40:03.283 25110 25150 Info Unity PoseTrackingGraph: Using OpenGLES config
2022/02/09 13:40:03.283 25110 25150 Info Unity Mediapipe.Unity.MemoizedLogger:Log(LogLevel, String, Object)
2022/02/09 13:40:03.283 25110 25150 Info Unity Mediapipe.Unity.<Initialize>d__35:MoveNext()
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
Bootstrap
includes code that must be run only once (e.g.GpuManager.Initialize
). But this is not the case if instances ofGpuResources
andGlCalculatorHelper
are destroyed before switching scenes.It worked! Sharing some comments if anybody faces the same issue:
Bootstrap
andImage Source
GameObjects are added in your main scene only.DontDestroyOnLoad
methods called in BootStrap.Bootstrap
andImage Source
GameObjects in the scene to load and start the graph.