diff --git a/.gitignore b/.gitignore index 294b9d6..4063df2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,14 @@ +# Virtual environments venv +.venv + +# Cache __pycache__ + +# IDEs .idea + +# Test output video_output audio.wav /keyboard_output.txt @@ -8,3 +16,8 @@ audio.wav /vpt-audio.wav /vpt-keyboard.txt /vpt-mouse.txt + +# PyInstaller +*.spec +build +dist diff --git a/Pipfile b/Pipfile index b7053a7..fc09a7a 100644 --- a/Pipfile +++ b/Pipfile @@ -19,9 +19,12 @@ matplotlib = "*" [dev-packages] python-language-server = {extras = ["all"], version = "*"} pylint = "*" +pyinstaller = "*" [requires] python_version = "3.8" [scripts] vpt = "python -m vpt" +bundle-win = "pyinstaller ./vpt/__main__.py --name vpt --distpath ./dist --add-data 'models;models'" +bundle-unix = "pyinstaller ./vpt/__main__.py --name vpt --distpath ./dist --add-data \"models:models\"" diff --git a/README.md b/README.md index 6eaf365..9454c80 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,17 @@ On Arch Linux, use: ## Usage -Run `pipenv run vpt `. For detailed usage information, run `pipenv run vpt -h`. +Run `pipenv run vpt `. For detailed usage information, run `pipenv run vpt -h`. If you are using Linux, you might need to run some commands as root (or with `sudo`) as [mouse recording](https://github.com/boppreh/mouse#:~:text=requires%20sudo) and [keyboard recording](https://github.com/boppreh/keyboard#:~:text=requires%20sudo) require it. + +## Bundling + +To bundle the application as a distributable executable, run `pipenv run bundle-win` on Windows, or `pipenv run bundle-unix` on most unix-based systems. +The resulting program can be found in the "_dist/vpt_" folder, with the exeuctable file itself called `vpt`. + +Note: The Windows version requires that the ["Microsoft C++ Redistributable +for Visual Studio 2015, 2017 and 2019"](https://support.microsoft.com/help/2977003/the-latest-supported-visual-c-downloads) be installed on the system before running. +They are **not** bundled with the program. diff --git a/vpt/__main__.py b/vpt/__main__.py index 88d7a55..9109e21 100644 --- a/vpt/__main__.py +++ b/vpt/__main__.py @@ -13,5 +13,6 @@ elif args['cmd'] == 'check': check() elif args['cmd'] is None: + # If no argument, fall back to recording # record(args['audio'], args['video']) pass diff --git a/vpt/cli/record.py b/vpt/cli/record.py index e69de29..aaf3ddd 100644 --- a/vpt/cli/record.py +++ b/vpt/cli/record.py @@ -0,0 +1,2 @@ +def record(): + pass diff --git a/vpt/processors/gaze_detector/__init__.py b/vpt/processors/gaze_detector/__init__.py index 7adf2d1..25c72a2 100644 --- a/vpt/processors/gaze_detector/__init__.py +++ b/vpt/processors/gaze_detector/__init__.py @@ -1,5 +1,7 @@ """Human facial landmark detector based on Convolutional Neural Network.""" import math +import os +os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # To disable TF's warnings import cv2 import numpy as np @@ -12,6 +14,8 @@ from vpt.processors.base import ProcessorBase from vpt.sources.base import SourceBase +tf.get_logger().setLevel('ERROR') + class FaceDetector: """Detect human face from image"""