-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Feat/batch predict age and gender #1396
base: master
Are you sure you want to change the base?
Changes from 54 commits
c42df04
a4b1b5d
b55cb31
29c818d
27e8fc9
38c0652
b9418eb
d992428
e96ede3
e1417a0
f8be282
9f3875e
9c079e9
bba4322
4cf43be
05dbc80
c312684
ffbba7f
edcef02
472f146
b69dcfc
0f65a87
bb820a7
e182285
69267cd
5747d96
5a18814
72b94d1
c647488
e668cd4
85e2d8d
ba0d0c5
29141b3
36fb512
431544a
0417732
c44af00
ad577b4
52a38ba
ba8c651
4284252
eb7b841
688fbe6
a442f7a
8883b21
fa4044a
910d6e1
72b6db1
a23893a
da4a0c5
c72b474
7e719df
6a7bbdb
6a8d1d9
0d7e151
0971fcd
db4b749
95bb92c
61b6931
6df7b7d
b584d29
ee3093d
4d77931
0ab3ac2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,3 +135,16 @@ def test_analyze_for_different_detectors(): | |
assert result["gender"]["Man"] > result["gender"]["Woman"] | ||
else: | ||
assert result["gender"]["Man"] < result["gender"]["Woman"] | ||
|
||
def test_analyze_for_multiple_faces(): | ||
img = "dataset/img4.jpg" | ||
# Copy and combine the same image to create multiple faces | ||
img = cv2.imread(img) | ||
img = cv2.hconcat([img, img]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hconcat makes a single image
to have a numpy array with (2, 1728, 2500, 3) shape, you should do something like:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also please check that img is now having (2, x, x, x) shape There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Finally, unit tests failed for that input. The case you tested did not test what you did. It is still single image. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @serengil 👋 Due to the complexity of designing a more efficient flow for We will discuss enhancing the performance of the Please help us merge this PR if all the requirements are met. |
||
demography_objs = DeepFace.analyze(img, silent=True) | ||
NatLee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
assert len(demography_objs) == 2 | ||
for demography in demography_objs: | ||
logger.debug(demography) | ||
assert demography["age"] > 20 and demography["age"] < 40 | ||
assert demography["dominant_gender"] == "Woman" | ||
logger.info("✅ test analyze for multiple faces done") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i initially confused about why why squeeze first and expand dimensions second
would you please add a comment here something like:
we did perform squeeze and expand dimensions sequentially to have same behaviour for (224, 224, 3), (1, 224, 224, 3) and (n, 224, 224, 3)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We took a look at the processing flow and discovered that the
squeeze
operation is unnecessary. Every single image input would have an expanded batch dimension of(1, 224, 224, 3)
, so there’s no need to handle inputs with this dimension.The redundant
squeeze
process has been removed.