TadasBaltrusaitis / OpenFace

OpenFace – a state-of-the art tool intended for facial landmark detection, head pose estimation, facial action unit recognition, and eye-gaze estimation.
Other
6.72k stars 1.83k forks source link

Allowed to publish python bindings? #898

Open D0miH opened 3 years ago

D0miH commented 3 years ago

Hello,

first of all thanks for publishing this very nice library.

I noticed that Python bindings for this library are not present and many researchers would profit from Python bindings. Therefore, I wrote Python bindings for landmark detection in images and videos and are planning to write additional bindings for facial action unit recognition and gaze tracking as well. To write the python bindings I made small changes to the code of the OpenFace library in a fork (https://github.com/D0miH/OpenFace).

My plan was to publish the Python bindings as an open source project on GitHub and upload the Python wheels archives on PyPi. The wheel archives would include the trained models of the OpenFace library. Of course I would give proper credit and would clearly point out that OpenFace and the python bindings are for non-commercial and academic use only. But after reading the OpenFace-License I am not sure if I am allowed to do this since in the license it says:

DERIVATIVES: [...] You may only use such derivatives and modifications for your own noncommercial internal research purposes, and you may not otherwise use, distribute or copy such derivatives and modifications in violation of this Agreement. [...]

So my question is: Am I allowed to publish the Python bindings project on GitHub which includes the fork of this project as a submodule? And am I allowed to upload the built python wheels on PiPy (including the trained models in the wheel archives)?

Thanks and best, Dominik

a-hurst commented 3 years ago

@D0miH Are your bindings based off of the ones I wrote with pybind11, or are they a completely different implementation? My time is limited at the moment, but I feel like if there's any hope of official PyPi wheels for OpenFace in the future we should pool our efforts into a single PR (I started one here a few months back: #858). The changes to the C++ code you've made in your branch would go nicely with what I've thrown together so far.

The big things that are currently missing (apart from expanding the bindings to cover more of the OpenFace API) are basic documentation/examples, unit tests, and CI. I'm also not sure how to build Windows wheels with OpenFace's external dependencies bundled (e.g. OpenCV), since there's no Windows equivalent to auditwheel or delocate for the platform yet.

I had the same question as you regarding the license a few months ago, and I didn't really get a response other than that the maintainer was interested in adding official Python bindings, and would be willing to review a PR adding them. I'm assuming they don't have a ton of time for this project right now, given the general lack of activity, so not sure where that leaves us. If we leave the OpenFace library itself unmodified in pre-compiled wheels (which my bindings currently do), does it still count as a derivative which can't be distributed? The license is pretty vague here.

As for bundling the models with the wheels: that was my original idea too, but the models are way too big for that to be workable (especially the massive CEN patches). My workaround was to write a set of Python functions that would either download all models to a folder in the current working directory (for a self-contained project) or alternatively to an invisible .openface/ folder in the user's home directory (for the bindings to work regardless of the current working directory). That keeps wheel size to a minimum, without sacrificing too much ease-of-setup.