Fix representations_<model>.pkl not being created
This commit is contained in:
parent
2cf945feec
commit
4f1f253c6c
|
@ -2,9 +2,9 @@
|
|||
config/
|
||||
using_yolov8.ipynb
|
||||
yolov8n.pt
|
||||
.venv/
|
||||
*venv/
|
||||
__pycache__/
|
||||
faces/*
|
||||
!faces/.gitkeep
|
||||
dist/
|
||||
draft-commit-message.txt
|
||||
test.txt
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
"type": "python",
|
||||
"request": "launch",
|
||||
"module": "wyzely_detect",
|
||||
"justMyCode": true
|
||||
// "justMyCode": true
|
||||
"justMyCode": false
|
||||
}
|
||||
]
|
||||
}
|
|
@ -49,7 +49,7 @@
|
|||
" # We could use Path to get the parent directory of the image to use as the identity\n",
|
||||
" print(f'Most likely identity: {Path(pd_dataframe.iloc[0][\"identity\"]).parent.name}')\n",
|
||||
" # Get the most likely identity's confidence\n",
|
||||
" print(f'Confidence: {pd_dataframe.iloc[0][\"model_name=\"ArcFace\", detector_backend=\"opencv\")\"]}')\n",
|
||||
" print(f'Confidence: {pd_dataframe.iloc[0][\"ArcFace_cosine\"]}')\n",
|
||||
"\n",
|
||||
"# uuid_path.unlink()"
|
||||
]
|
||||
|
@ -69,6 +69,60 @@
|
|||
"source": [
|
||||
"DeepFace.stream(db_path=\"faces\", model_name=\"ArcFace\", detector_backend=\"opencv\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Stream normal frame by frame"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from deepface import DeepFace\n",
|
||||
"import cv2\n",
|
||||
"from pathlib import Path\n",
|
||||
"import uuid\n",
|
||||
"import pandas as pd\n",
|
||||
"\n",
|
||||
"def main():\n",
|
||||
" cap = cv2.VideoCapture(0)\n",
|
||||
" while True:\n",
|
||||
" ret, frame = cap.read()\n",
|
||||
" dfs = DeepFace.find(frame, db_path = \"faces\", enforce_detection=False, silent=False, model_name=\"ArcFace\", detector_backend=\"opencv\")\n",
|
||||
" for i, pd_dataframe in enumerate(dfs):\n",
|
||||
" print(f'On dataframe {i}')\n",
|
||||
" print(pd_dataframe)\n",
|
||||
" print(f'Most likely identity: {Path(pd_dataframe.iloc[0][\"identity\"]).parent.name}')\n",
|
||||
" print(f'Confidence: {pd_dataframe.iloc[0][\"ArcFace_cosine\"]}')\n",
|
||||
" cv2.imshow(\"frame\", frame)\n",
|
||||
" if cv2.waitKey(1) & 0xFF == ord(\"q\"):\n",
|
||||
" break\n",
|
||||
" cap.release()\n",
|
||||
" cv2.destroyAllWindows()\n",
|
||||
" \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"main()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Other functions\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
|
|
@ -3627,4 +3627,4 @@ files = [
|
|||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = ">=3.10, <3.12"
|
||||
content-hash = "952e41ab099f9d1c7055465d5a3c228df677c422d20dea8ff8d558d2e4d8f2be"
|
||||
content-hash = "6712094a7e402c4587037939b7a33ad4c2463a545c222374bc471925c33242d9"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "wyzely-detect"
|
||||
version = "0.1.0"
|
||||
version = "0.1.9"
|
||||
description = "Recognize faces/objects in a video stream (from a webcam or a security camera) and send notifications to your devices"
|
||||
authors = ["slashtechno <77907286+slashtechno@users.noreply.github.com>"]
|
||||
license = "MIT"
|
||||
|
@ -29,6 +29,7 @@ tensorflow-io-gcs-filesystem = "0.31.0"
|
|||
|
||||
|
||||
deepface = "^0.0.79"
|
||||
tensorflow = "^2.14.0"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
black = "^23.9.1"
|
||||
|
|
|
@ -115,8 +115,12 @@ def recognize_face(
|
|||
face_dataframes = DeepFace.find(
|
||||
run_frame,
|
||||
db_path=str(path_to_directory),
|
||||
enforce_detection=True,
|
||||
# enforce_detection=True,
|
||||
# Seems this works?
|
||||
enforce_detection=False,
|
||||
silent=True,
|
||||
# Could use VGG-Face, but whilst fixing another issue, ArcFace seemed to be slightly faster
|
||||
# I read somewhere that opencv is the fastest (but not as accurate). Could be changed later, but opencv seems to work well
|
||||
model_name="ArcFace", detector_backend="opencv"
|
||||
)
|
||||
except ValueError as e:
|
||||
|
|
Loading…
Reference in New Issue