Im trying to build and run an IOS App for facial recognition using a custom face alignment model generated with pytorch.
I followed the tutorial to setup libtorch with cocoapod on my xcode project, and managed to load and use my custom model in C++ code.
Everything worked fine and the app run on an IOS simulator, I’m able detect faces on images.
But running the app on a real Iphone give the following error in xcode when calling for my model forward method:
libc++abi.dylib: terminating with uncaught exception of type std::runtime_error: NNPACK SpatialConvolution_updateOutput failed
The above operation failed in interpreter.
Traceback (most recent call last):
/usr/local/lib/python3.5/dist-packages/torch/nn/modules/conv.py(342): conv2d_forward
/usr/local/lib/python3.5/dist-packages/torch/nn/modules/conv.py(345): forward
/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py(525): _slow_forward
/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py(539): call
/usr/local/lib/python3.5/dist-packages/face_alignment/detection/sfd/net_s3fd.py(97): forward
torch_compilo.py(47): forward
/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py(525): _slow_forward
/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py(539): call
/usr/local/lib/python3.5/dist-packages/torch/jit/init.py(997): trace_module
/usr/local/lib/python3.5/dist-packages/torch/jit/init.py(865): trace
torch_compilo.py(53):
Serialized File “code/torch/face_alignment/detection/sfd/net_s3fd.py”, line 206
input29 = torch.relu(input28)
input30 = torch.max_pool2d(input29, [2, 2], [2, 2], [0, 0], [1, 1], False)
input31 = torch._convolution(input30, weight12, _27, [1, 1], [3, 3], [1, 1], False, [0, 0], 1, False, False, True)
~~~~~~~~~~~~~~~~~~ <— HERE
input32 = torch.relu(input31)
input33 = torch._convolution(input32, weight13, _29, [1, 1], [0, 0], [1, 1], False, [0, 0], 1, False, False, True)
Any help regarding this issue will be appreciated!