-
-
Notifications
You must be signed in to change notification settings - Fork 483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suddenly freezes #392
Comments
Please upload the Editor.log. |
Waiting for WebCamTexture to start
UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/StackTrace.cs:37)
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
Mediapipe.Unity.MemoizedLogger:Log (Mediapipe.Logger/LogLevel,object) (at Assets/Mediapipe/Samples/Common/Scripts/MemoizedLogger.cs:181)
Mediapipe.Logger:Log (Mediapipe.Logger/LogLevel,object) (at Packages/com.github.homuler.mediapipe/Runtime/Scripts/Util/Logger.cs:156)
Mediapipe.Logger:LogVerbose (object) (at Packages/com.github.homuler.mediapipe/Runtime/Scripts/Util/Logger.cs:205)
Mediapipe.Unity.WebCamSource/<WaitForWebCamTexture>d__50:MoveNext () (at Assets/Mediapipe/Samples/Common/Scripts/ImageSource/WebCamSource.cs:253)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr) (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17)
(Filename: Assets/Mediapipe/Samples/Common/Scripts/ImageSource/WebCamSource.cs Line: 253)
TimeoutException: Failed to start WebCam
at Mediapipe.Unity.WebCamSource+<WaitForWebCamTexture>d__50.MoveNext () [0x00082] in /Users//MediaPipeUnityPlugin/Assets/Mediapipe/Samples/Common/Scripts/ImageSource/WebCamSource.cs:260
at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00020] in /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17
It looks like a |
It stops suddenly while I'm using it, not when I switch the scene. The camera I'm using is the built-in camera of my mac. |
But actually you switched scenes, right?
Can you at least tell me the model (e.g. MacBook Pro 14-inch (2021))? (and the resolution if possible) |
Switch the scene and it will work fine for a while. Sometimes it stops at FaceDetectionSolution even without switching scenes. I'm sorry for my lack of words. |
The same happened to me, and when I checked, it stopped when |
Thanks! > @merlin-rtzr
|
I confirmed that the following script can reproduce the issue (in an almost empty scene), and now I suspect there is a problem with the Unity implementation. using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using Mediapipe.Unity;
public class FreezeTest : MonoBehaviour
{
[SerializeField] RawImage screen;
[SerializeField] int width;
[SerializeField] int height;
[SerializeField] int fps;
WebCamTexture webCamTexture;
Color32[] pixelData;
IEnumerator Start()
{
var webCamDevice = WebCamTexture.devices[0];
webCamTexture = new WebCamTexture(webCamDevice.name, width, height, fps);
webCamTexture.Play();
yield return new WaitUntil(() => webCamTexture.width > 16);
var texture = new Texture2D(width, height, TextureFormat.RGBA32, false);
pixelData = new Color32[width * height];
screen.texture = texture;
while (true)
{
webCamTexture.GetPixels32(pixelData);
texture.SetPixels32(pixelData);
texture.Apply();
Debug.Log(texture.GetNativeTexturePtr());
yield return new WaitForEndOfFrame();
}
}
void Destroy()
{
webCamTexture.Stop();
}
} |
There is a workaround or we have to wait for a new release with the fix? |
It's easy to avoid this issue since it only exists in the sample app code (not in the plugin code). However, fixing it is another thing, and I'm still thinking about what to do. |
Hi, I tried as you suggested commenting lines 181 and 187 from TextureFrame
but now I'm getting this error that stops all async flow of mediapipe:
|
@Magistrix93 It's already fixed (cf. #505), so please pull the latest commit. |
OS Platform and Distribution (e.g., Linux Ubuntu 20.04, WSL2): mac OS Monterey(Using Apple M1 max PC)
Target (e.g. desktop cpu, android arm64):desktop cpu
Bazel version: 4.2.2
Python version: 3.10.1
GCC/G++ version: 13.0.0
Unity version: 2021.2.7f1
Describe the current behavior
After starting the Start scene, Unity will do pose detect and other processes normally for a while, but suddenly Unity will freeze and stop working. There are no errors.
Describe the expected behavior
I don't want it to freeze.
Steps to reproduce the issue
After the build, I start Unity, change the Preferable Inference Mode to CPU, and then start the start scene. Other than that, I did not do anything else.
Full logs
No errors.
Additional context
I thought it might be a problem with my PC's camera, so I tried the web camera separately from the built-in camera, but it froze.
The text was updated successfully, but these errors were encountered: