allo- / virtual_webcam_background

Use a virtual webcam background and overlays with body-pix and v4l2loopback
GNU General Public License v3.0
306 stars 48 forks source link

Packaging the project properly #3

Open maxammann opened 4 years ago

maxammann commented 4 years ago

I was thinking how I could contribute to this project.

What I first noticed was that it is not as easy to setup as it could be. I could submit a PR to package this as PIP package using a setup.py. This would also make it posisble to distribute the package as tar or debian package.

Negative side effect would be that I'd need to move the source files.

allo- commented 4 years ago

Yes this is on the road map. I think the program can be packaged and it should download the model into .local/share/virtual_webcam.

Do you know a good way to find out the data directory on Linux/Windows/OSX? I think Windows should have AppData/Roaming/VirtualWebcam, but probably python has some module to get the correct path on any platform.

In addition it depends on better packaging of tfjs-to-tf. This package indirectly includes its file api.py into its setup.py, so the installation depends on having tensorflowjs installed before. So the first step may be to create a PR on that repository and ask them to publish the package to pypi.

What do you mean with needing to move the files? Creating some src or virtual_webcam folder for the source files? That would be no problem.

maxammann commented 4 years ago

yes, files should be moved to virtual_webcam/file.py The start script probably should live in scripts/ and is not part of the main module.

I'm setting the project up right now. So far I found out that tensorflow 2.1.0 which is required by tensorflowjs requires python 3.7.7. It is not compatible with python 3.8 afaik.

do you think it would be posisble that we convert the models once from the js-syntax and then reupload them on github? That way the tensorflowjs dependency would not be required, right?

maxammann commented 4 years ago

Not sure about the datapath on Windows/OSX. On linux there are the XDG environment variables. Btw, the project is running on my laptop :)

allo- commented 4 years ago

I use Python 3.7.7, because of some incompatibility as well. Tensorflow 2.x is a requirement for me to use CUDA 10, but possibly people with previous CUDA versions may need other Tensorflow versions?

For the models, I see two issues. First what is the license and are we allowed to provide them or even a derived work (the converted models)? And second what is the availability? I think Google will host them for a long time at the same URL, but hosting them, e.g., in this repo would break for example when the repo is renamed or moved.

allo- commented 4 years ago

I opened a bug in the tfjs-to-tf project and it should be fixed now, see https://github.com/patlevin/tfjs-to-tf/issues/8.

I will test it later and update requirements.txt and the installation howto accordingly.

allo- commented 4 years ago

For the file structure I plan a good separation between the main program and filters or other plugins anyway. Filters are currently in one file, but I think I split them into independent files, such that people can write filters without forking the complete project.