Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Features #14

Merged
merged 19 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions scripts/analyze.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import json;
import sys;
from deepface import DeepFace;

result = DeepFace.analyze(
img_path = "{{img_path}}",
actions={{actions}},
enforce_detection={{enforce_detection}},
detector_backend="{{detector_backend}}",
align={{align}},
silent={{silent}},
);

print(json.dumps(result, default=str))
try:
result = DeepFace.analyze(
img_path = "{{img_path}}",
actions={{actions}},
enforce_detection={{enforce_detection}},
anti_spoofing={{anti_spoofing}},
detector_backend="{{detector_backend}}",
align={{align}},
silent={{silent}},
);
print(json.dumps(result, default=str))
except ValueError as e:
print(json.dumps({"error": str(e)}), file=sys.stderr)
23 changes: 14 additions & 9 deletions scripts/extract_faces.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import json;
import sys;
from deepface import DeepFace;

result = DeepFace.extract_faces(
img_path = "{{img_path}}",
target_size={{target_size}},
enforce_detection={{enforce_detection}},
detector_backend="{{detector_backend}}",
align={{align}},
grayscale={{grayscale}},
);
try:
result = DeepFace.extract_faces(
img_path = "{{img_path}}",
target_size={{target_size}},
enforce_detection={{enforce_detection}},
anti_spoofing={{anti_spoofing}},
detector_backend="{{detector_backend}}",
align={{align}},
grayscale={{grayscale}},
);

print(json.dumps(result, default=str))
print(json.dumps(result, default=str))
except ValueError as e:
print(json.dumps({"error": str(e)}), file=sys.stderr)
29 changes: 17 additions & 12 deletions scripts/find.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
from deepface import DeepFace;
import sys;

result = DeepFace.find(
img_path = "{{img_path}}",
db_path = "{{db_path}}",
model_name = "{{model_name}}",
distance_metric = "{{distance_metric}}",
enforce_detection = {{enforce_detection}},
detector_backend = "{{detector_backend}}",
align = {{align}},
normalization = "{{normalization}}",
silent = {{silent}}
);
try:
result = DeepFace.find(
img_path = "{{img_path}}",
db_path = "{{db_path}}",
model_name = "{{model_name}}",
distance_metric = "{{distance_metric}}",
enforce_detection = {{enforce_detection}},
anti_spoofing={{anti_spoofing}},
detector_backend = "{{detector_backend}}",
align = {{align}},
normalization = "{{normalization}}",
silent = {{silent}}
);

print(result[0].to_json())
print(result[0].to_json())
except ValueError as e:
print(json.dumps({"error": str(e)}), file=sys.stderr)
2 changes: 2 additions & 0 deletions scripts/represent.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import json;
import sys;
Gummibeer marked this conversation as resolved.
Show resolved Hide resolved
from deepface import DeepFace;

result = DeepFace.represent(
img_path = "{{img_path}}",
model_name = "{{model_name}}",
enforce_detection = {{enforce_detection}},
anti_spoofing = "{{anti_spoofing}}",
detector_backend = "{{detector_backend}}",
align = {{align}},
normalization = "{{normalization}}"
Expand Down
27 changes: 16 additions & 11 deletions scripts/verify.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import json;
import sys;
from deepface import DeepFace;

result = DeepFace.verify(
img1_path = "{{img1_path}}",
img2_path = "{{img2_path}}",
enforce_detection = {{enforce_detection}},
align = {{align}},
model_name = "{{model_name}}",
detector_backend = "{{detector_backend}}",
distance_metric = "{{distance_metric}}",
normalization = "{{normalization}}"
);
try:
result = DeepFace.verify(
img1_path = "{{img1_path}}",
img2_path = "{{img2_path}}",
enforce_detection = {{enforce_detection}},
anti_spoofing={{anti_spoofing}},
align = {{align}},
model_name = "{{model_name}}",
detector_backend = "{{detector_backend}}",
distance_metric = "{{distance_metric}}",
normalization = "{{normalization}}"
);

print(json.dumps(result, default=str))
print(json.dumps(result, default=str))
except ValueError as e:
print(json.dumps({"error": str(e)}), file=sys.stderr)
4 changes: 2 additions & 2 deletions src/Data/FacialArea.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public function __construct(
public readonly int $y,
public readonly int $w,
public readonly int $h,
public readonly ?int $left_eye,
public readonly ?int $right_eye,
public readonly int|array|null $left_eye,
public readonly int|array|null $right_eye,
) {
}

Expand Down
Loading
Loading