我正在使用 Chaquopy 在 Android 上运行带有 tensorflow 的 keras。当我在模型上调用 predict() 时,出现以下堆栈跟踪异常:
AndroidRuntime: Process: com.example.android.camera2basic, PID: 10113
AndroidRuntime: com.chaquo.python.PyException: ImportError: This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.
AndroidRuntime: at <python>.multiprocessing.synchronize.<module>(synchronize.py:30)
AndroidRuntime: at <python>.zipimport.load_module(<frozen zipimport>:259)
AndroidRuntime: at <python>.java.chaquopy.import_override(import.pxi:60)
AndroidRuntime: at <python>.multiprocessing.context.Lock(context.py:67)
AndroidRuntime: at <python>.multiprocessing.queues.__init__(queues.py:336)
AndroidRuntime: at <python>.multiprocessing.context.SimpleQueue(context.py:113)
AndroidRuntime: at <python>.multiprocessing.pool.__init__(pool.py:196)
AndroidRuntime: at <python>.multiprocessing.pool.__init__(pool.py:922)
AndroidRuntime: at <python>.tensorflow.python.keras.engine.training_utils.get_copy_pool(training_utils.py:210)
AndroidRuntime: at <python>.tensorflow.python.keras.engine.training_utils.__init__(training_utils.py:242)
AndroidRuntime: at <python>.tensorflow.python.keras.engine.training_utils.create(training_utils.py:335)
AndroidRuntime: at <python>.tensorflow.python.keras.engine.training_v2.run_one_epoch(training_v2.py:171)
AndroidRuntime: at <python>.tensorflow.python.keras.engine.training_v2._model_iteration(training_v2.py:464)
AndroidRuntime: at <python>.tensorflow.python.keras.engine.training_v2.predict(training_v2.py:495)
AndroidRuntime: at <python>.tensorflow.python.keras.engine.training.predict(training.py:1004)
我的理解是Android不支持信号量。
有没有人对此有任何解决方法?