Reverting compare.py and adding new tests

This commit is contained in:
boltgolt 2018-11-19 18:36:35 +01:00
parent dee2c98a99
commit 873211da4c
No known key found for this signature in database
GPG key ID: BECEC9937E1AAE26
7 changed files with 25 additions and 18 deletions

View file

@ -8,19 +8,12 @@ script:
# Install the binary, running the debian scripts in the process # Install the binary, running the debian scripts in the process
- sudo apt install ../*.deb -y - sudo apt install ../*.deb -y
# Confirm the cv2 module has been installed correctly - ./tests/importing.sh
- sudo /usr/bin/env python3 -c "import cv2; print(cv2.__version__);" - ./tests/passthrough.sh
# Confirm the face_recognition module has been installed correctly
- sudo /usr/bin/env python3 -c "import face_recognition; print(face_recognition.__version__);"
# Check if the username passthough works correctly with sudo
- 'howdy | ack-grep --passthru --color "current active user: travis"'
- 'sudo howdy | ack-grep --passthru --color "current active user: travis"'
# Remove howdy from the installation # Remove howdy from the installation
- sudo apt purge howdy -y - sudo apt purge howdy -y
notifications: notifications:
email: email:
on_success: never on_success: never

View file

@ -42,16 +42,17 @@ dark_tries = 0
# Try to load the face model from the models folder # Try to load the face model from the models folder
try: try:
models = json.load(open(os.path.dirname(os.path.abspath(__file__)) + "/models/" + user + ".dat")) models = json.load(open(os.path.dirname(os.path.abspath(__file__)) + "/models/" + user + ".dat"))
# Put all models together into 1 array
encodings = [model["data"] for model in models]
except FileNotFoundError: except FileNotFoundError:
sys.exit(10) sys.exit(10)
# Check if the file contains a model # Check if the file contains a model
if not encodings: if len(models) < 1:
sys.exit(10) sys.exit(10)
# Put all models together into 1 array
for model in models:
encodings += model["data"]
# Add the time needed to start the script # Add the time needed to start the script
timings.append(time.time()) timings.append(time.time())
@ -63,12 +64,13 @@ if config.getboolean("video", "force_mjpeg"):
# Set a magic number, will enable MJPEG but is badly documentated # Set a magic number, will enable MJPEG but is badly documentated
video_capture.set(cv2.CAP_PROP_FOURCC, 1196444237) video_capture.set(cv2.CAP_PROP_FOURCC, 1196444237)
# Set the frame width and height if requested # Get the height and width config values
fw = config.getint("video", "frame_width") fw = config.getint("video", "frame_width")
fh = config.getint("video", "frame_height") fh = config.getint("video", "frame_height")
# Set the frame width and height if requested
if fw != -1: if fw != -1:
video_capture.set(cv2.CAP_PROP_FRAME_WIDTH, fw) video_capture.set(cv2.CAP_PROP_FRAME_WIDTH, fw)
if fh != -1: if fh != -1:
video_capture.set(cv2.CAP_PROP_FRAME_HEIGHT, fh) video_capture.set(cv2.CAP_PROP_FRAME_HEIGHT, fh)
@ -86,11 +88,13 @@ timings.append(time.time())
# Fetch the max frame height # Fetch the max frame height
max_height = int(config.get("video", "max_height")) max_height = int(config.get("video", "max_height"))
# Start the read loop # Fetch config settings out of the loop
frames = 0
timeout = config.getint("video", "timout") timeout = config.getint("video", "timout")
dark_threshold = config.getfloat("video", "dark_threshold") dark_threshold = config.getfloat("video", "dark_threshold")
end_report = config.getboolean("debug", "end_report") end_report = config.getboolean("debug", "end_report")
# Start the read loop
frames = 0
while True: while True:
# Increment the frame count every loop # Increment the frame count every loop
frames += 1 frames += 1
@ -145,7 +149,7 @@ while True:
match_index += 1 match_index += 1
# Try to find a match that's confident enough # Try to find a match that's confident enough
if match * 10 < float(config.get("video", "certainty")) and match > 0: if match * 10 < config.getfloat("video", "certainty") and match > 0:
timings.append(time.time()) timings.append(time.time())
# If set to true in the config, print debug text # If set to true in the config, print debug text

7
tests/importing.sh Executable file
View file

@ -0,0 +1,7 @@
# Confirm the cv2 module has been installed correctly
echo "cv2 version:"
sudo /usr/bin/env python3 -c "import cv2; print(cv2.__version__);"
# Confirm the face_recognition module has been installed correctly
echo "face_recognition version:"
sudo /usr/bin/env python3 -c "import face_recognition; print(face_recognition.__version__);"

3
tests/passthrough.sh Normal file
View file

@ -0,0 +1,3 @@
# Check if the username passthough works correctly with sudo
howdy | ack-grep --passthru --color "current active user: travis"
sudo howdy | ack-grep --passthru --color "current active user: travis"

BIN
tests/video/match1.m4v Normal file

Binary file not shown.

BIN
tests/video/match2.m4v Normal file

Binary file not shown.

BIN
tests/video/noMatch.m4v Normal file

Binary file not shown.