Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?
Feat/batch predict age and gender #1396
Changes from 18 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
There are no files selected for viewing
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.
model.predict
causes memory issue when it is called in a for loop, that is why we call it asself.model(img, training=False).numpy()[0, :]
in your design, if this is called in a for loop, still it will cause memory problem.
IMO, if it is single image, we should call
self.model(img, training=False).numpy()[0, :]
, it is many faces then callself.model.predict_on_batch
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.
Thank you for sharing your perspective on this matter.
We found the issue you mentioned is also mentioned in this page: tensorflow/tensorflow#44711. We believe it’s being resolved.
Furthermore, if we can utilize the batch prediction method provided in this PR, we may be able to avoid repeatedly calling the
predict
function within a loop of unrolled batch images, which is the root cause of the memory issue you described.We recommend that you consider retaining our batch prediction method.
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.
hey, even though this is sorted in newer tf versions, many users using old tf versions raise tickets about this problem. so, we should consider the people using older tf version. that is why, i recommend to use
self.model(img, training=False).numpy()[0, :]
for single images, andself.model.predict_on_batch
for batches.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.
Hi! 👋
Please take a look at our prediction function, which uses the legacy single prediction method you suggested, and also provides batch prediction if a batch of images is provided.
Please let us know if there’s anything else we can improve. Any advice you have is greatly appreciated.
deepface/deepface/models/Demography.py
Line 24 in a23893a