You could potentially use Hugh Perkins' pytorch wrappers as a starting point for this: https://github.com/hughperkins/pytorch
If you interested I can send you my implementation, but it is very simple.
Interesting! Sure, I'd like to see it. Can you attach a file here or send a link to it somewhere?
I attached my rewritten version of TorchNeuralNet class
Thanks, this is very helpful.
Did you try using their `torch.fromNumpyArray` function to avoid the hack of writing an image to disk with Python and reading it with Torch?
I'm a little worried about adding another non-standard dependency to OpenFace that needs to be manually installed. Even though it's easy to install, it's an inconvenience for a lot of users.
I've added this file to the repo so it can be obtained and modified if needed. I added a link to this mailing list and noted that you created it. I also added a reference to the file and this mailing list post in the original code when the subprocess fails in case this will help any other users that have the same scenario as you:
Hello Vitalius Parubochyi,
Could you please tell me how to use your file? Can I delete the torch_neural_net.py file and rename your file to torch_neural_net.py and install openface again?
I tried and their function works great. It converts numpy array into FloatTensor. But I found some differences in Python and Torch image arrays. I'm not familiar with the implementation of the Torch image module, so I'm not sure how image array looks in Torch. But I found three differences: 1) torch image arrays are normalized (0.0-1.0), numpy images are not by default (0-255). 2) I didn't find right order for torch image arrays channels. 3) When I used your hack with image saving and convert RGB or BGR image into torch using `torch.fromNumpyArray` I got different arrays in the both cases.
Maybe if I have a time, I'll explore this more in detail, but for this moment I left your way.