1996scarlet / OpenVtuber

虚拟爱抖露(アイドル)共享计划, 是基于单目RGB摄像头的人眼与人脸特征点检测算法, 在实时3D面部捕捉以及模型驱动领域的应用.
GNU General Public License v3.0
898 stars 94 forks source link

Program terminated with uncaught exception of type NSException #9

Closed lofiCafe closed 3 years ago

lofiCafe commented 3 years ago

Here is the console log.

➜  PythonClient git:(master) ✗ python3 vtuber_link_start.py
/Users/T**/VTube/OpenVtuber/PythonClient/TFLiteFaceDetector.py:13: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
  self._min_boxes = np.array([[10, 16, 24], [32, 48],
2021-01-10 11:06:34.944433: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-01-10 11:06:34.944758: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-01-10 11:06:35.108 Python[11977:4273942] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff2d67eb57 __exceptionPreprocess + 250
    1   libobjc.A.dylib                     0x00007fff665115bf objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff2d6a734c -[NSException raise] + 9
    3   AppKit                              0x00007fff2a8a15ec -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 310
    4   AppKit                              0x00007fff2a889052 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1416
    5   AppKit                              0x00007fff2a888ac3 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42
    6   AppKit                              0x00007fff2abc1a28 -[NSWindow initWithContentRect:styleMask:backing:defer:screen:] + 52
    7   cv2.cpython-38-darwin.so            0x0000000110d95ed5 cvNamedWindow + 677
    8   cv2.cpython-38-darwin.so            0x0000000110d9579c cvShowImage + 188
    9   cv2.cpython-38-darwin.so            0x0000000110d93c66 _ZN2cv6imshowERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKNS_11_InputArrayE + 230
    10  cv2.cpython-38-darwin.so            0x000000010fff539e _ZL18pyopencv_cv_imshowP7_objectS0_S0_ + 302
    11  Python                              0x000000010f9f60f6 cfunction_call_varargs + 171
    12  Python                              0x000000010f9f5be5 _PyObject_MakeTpCall + 274
    13  Python                              0x000000010fa96572 call_function + 804
    14  Python                              0x000000010fa92f91 _PyEval_EvalFrameDefault + 30081
    15  Python                              0x000000010f9f642a function_code_fastcall + 106
    16  Python                              0x000000010f9f5e71 PyVectorcall_Call + 108
    17  Python                              0x000000010fa93328 _PyEval_EvalFrameDefault + 31000
    18  Python                              0x000000010f9f642a function_code_fastcall + 106
    19  Python                              0x000000010fa963a8 call_function + 346
    20  Python                              0x000000010fa92f75 _PyEval_EvalFrameDefault + 30053
    21  Python                              0x000000010f9f642a function_code_fastcall + 106
    22  Python                              0x000000010fa963a8 call_function + 346
    23  Python                              0x000000010fa92f75 _PyEval_EvalFrameDefault + 30053
    24  Python                              0x000000010f9f642a function_code_fastcall + 106
    25  Python                              0x000000010f9f8554 method_vectorcall + 256
    26  Python                              0x000000010f9f5e71 PyVectorcall_Call + 108
    27  Python                              0x000000010fb0c4b2 t_bootstrap + 74
    28  Python                              0x000000010facdd74 pythread_wrapper + 25
    29  libsystem_pthread.dylib             0x00007fff678be109 _pthread_start + 148
    30  libsystem_pthread.dylib             0x00007fff678b9b8b thread_start + 15
)
libc++abi.dylib: terminating with uncaught exception of type NSException
[1]    11977 abort      python3 vtuber_link_start.py

OS ENV:

OS: macOS Catalina 10.15.7 19H15 x86_64
Kernel: 19.6.0
Shell: zsh 5.7.1
CPU: Intel i7-9750H (12) @ 2.60GHz
GPU: Intel UHD Graphics 630, AMD Radeon Pro 5300M
Memory: 16728MiB / 32768MiB
1996scarlet commented 3 years ago

Due to mac's excellent security control (sandbox mode), there may be some problems with data interaction between threads. I suggest: 1, Comment this line, and then view the result directly in the browser https://github.com/1996scarlet/OpenVtuber/blob/011822ccfcbd602c289fbc37d14a070cebcf50a0/PythonClient/vtuber_link_start.py#L119

2, Or you can change the target function of draw_thread to face_detection, and then run the draw() function on the main thread.

Since I don't have a mac device, you need to test by yourself. Good luck!

lofiCafe commented 3 years ago

Thanks for replying. XD

Wei-1 commented 3 years ago

Your suggestion does solve the problem, I will recommend adding this in the document.