Comments (10)
deepface does nothing with gpu. do you mind to raise this issue in the tensorflow's repo?
from deepface.
Thanks for reply. And I found the yolov8.pt not for tensorflow.
from deepface.
there is an open PR about this - #1145
Once this is merged, then yolo can be used with GPU
from deepface.
there is an open PR about this - #1145
Once this is merged, then yolo can be used with GPU
Thanks. I am gonna try it.
And the use of tensorflow-gpu still confusing me. Do you know why the period of find embeddings ("embedding = model.find_embeddings(img)" ) cost same time ~0.2s on GPU and CPU. It used Ghostfacenet and I thought it is based on tensorflow that the gpu should speedup the period?
Thanks again for your work and help.
from deepface.
guess the gpu problem is because of the input type, the img ndarray works in cpu and need transfer to tensor for gpus.
from deepface.
numpy to tensor is required for yolo?
from deepface.
numpy to tensor is required for yolo?
I think the input format problems makes size,usage of gpu require the tensor format.
I am quite a rookie for codes, so just gonna try it.
I found the gpu works in 10X speed for retinaface which did the tensor format.
and I just install the pytorch and made yolov8.to(device="cuda:0"),and there is a error:
Call arguments received by layer "conv2d" " f"(type Conv2D):
• inputs=tf.Tensor(shape=(1, 112, 112, 3), dtype=float32)
np.ndarray is for cpu and may be the reason ghostfacenet keep the same speed on tensorflow-gpu that it still use the cpu without right format.
from deepface.
unfortunately, i do not have a gpu and cannot make tests :/
from deepface.
numpy to tensor is required for yolo?
not required for yolo, just same as fastmtcnn.
but facing the problem in embedding_obj = representation.represent() when using ghostfacenet,still trying to figure out(think not the detector problem that the fastmtcnn output the same error, and kind of strange there is CuDNN 8.1.0.77 in pycharm env but it notify me the 8.0.5 in usage and I don't remember I have installed any 8.0.5, I only have used the other 8.9.2 for base env):
2024-04-09 10:08:59.696442: E tensorflow/stream_executor/cuda/cuda_dnn.cc:377] Loaded runtime CuDNN library: 8.0.5 but source was compiled with: 8.1.0. CuDNN library needs to have matching major version and equal or higher minor version. If using a binary install, upgrade your CuDNN library. If building from sources, make sure the library loaded at runtime is compatible with the version specified during compile configuration.
2024-04-09 10:08:59.697755: W tensorflow/core/framework/op_kernel.cc:1780] OP_REQUIRES failed at conv_ops.cc:1134 : UNIMPLEMENTED: DNN library is not found.
Traceback (most recent call last):
File "D:\Lingyun svn\trunk\facetrack\DeepFace_mod.py", line 582, in
main()
File "D:\Lingyun svn\trunk\facetrack\DeepFace_mod.py", line 578, in main
test_vid(vid,False,detector,model,dbase)
File "D:\Lingyun svn\trunk\facetrack\DeepFace_mod.py", line 537, in test_vid
img = perform_facial_recognition(
File "D:\Lingyun svn\trunk\facetrack\DeepFace_mod.py", line 133, in perform_facial_recognition
target_label, target_img = search_identity(
File "D:\Lingyun svn\trunk\facetrack\DeepFace_mod.py", line 435, in search_identity
dfs = DeepFace.find(
File "g:\deepface_new0407\deepface\deepface\DeepFace.py", line 309, in find
return recognition.find(
File "g:\deepface_new0407\deepface\deepface\modules\recognition.py", line 180, in find
representations += __find_bulk_embeddings(
File "g:\deepface_new0407\deepface\deepface\modules\recognition.py", line 389, in __find_bulk_embeddings
embedding_obj = representation.represent(
File "g:\deepface_new0407\deepface\deepface\modules\representation.py", line 107, in represent
embedding = model.forward(img)
File "g:\deepface_new0407\deepface\deepface\models\FacialRecognition.py", line 29, in forward
return self.model(img, training=False).numpy()[0].tolist()
File "G:\conda_env\deepface_tf_torch_gpu\lib\site-packages\keras\utils\traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "G:\conda_env\deepface_tf_torch_gpu\lib\site-packages\tensorflow\python\framework\ops.py", line 7209, in raise_from_not_ok_status
raise core._status_to_exception(e) from None # pylint: disable=protected-access
tensorflow.python.framework.errors_impl.UnimplementedError: Exception encountered when calling layer "conv2d" " f"(type Conv2D).
{{function_node _wrapped__Conv2D_device/job:localhost/replica:0/task:0/device:GPU:0}} DNN library is not found. [Op:Conv2D]
Call arguments received by layer "conv2d" " f"(type Conv2D):
• inputs=tf.Tensor(shape=(1, 112, 112, 3), dtype=float32)
from deepface.
unfortunately, i do not have a gpu and cannot make tests :/
my bad, it's should not be about tensor. The error was from the cudnn version from tensorflow and pytorch. should install cudakittool 11.3 and cudnn 8.1 before them to solve.
It's strange ghostfacenetv1 have same inference time on gpu (sured tf run on gpu). I tried its onnx model, which actually did 10X speed on gpu. ghostfacenet v1 spend 0.2s to inference on deepface and onnx spend 0.07s while onnx-gpu cost 0.007s.
from deepface.
Related Issues (20)
- Request for support of model conversion like in .onnx or .engine file. HOT 2
- [FEATURE]: extract_faces return face center point info or stop further enlargement if face center point can't be kept at image center HOT 8
- [BUG]: TypeError: unhashable type: 'list' HOT 2
- Fine Tuning Threshold in Face Recognition HOT 1
- New api endpoint HOT 4
- [BUG]: license is not shown in pip package
- Add TFace & Anti-Spoofing models 🎭 HOT 3
- Which Billion-Scale Database is the best for Face Recognition Query? HOT 1
- [BUG]: The verify function in gunicorn is unavailable
- [BUG]: <Wrong display of height and width values in DeepFace.represent function> HOT 2
- [BUG]: x of facial area left and right eye seems to be swapped since version 0.0.90 HOT 8
- [BUG]: Models ArcFace, Dlib, and others are not working. VGG-Face is the only model working for me HOT 3
- [BUG]: Age of children detected wrong HOT 1
- [BUG]: tensorflow deprecation warning with tf-keras HOT 1
- [FEATURE]: Nix flake deployment mechanism HOT 3
- [FEATURE]: Face Recognition in an image filled with other people HOT 2
- FAU Detection HOT 1
- [BUG]: Intermittent Packet Type Mismatch Error in Long-Term Face Detection with DeepFace and MediaPipe "Graph has errors: Packet type mismatch on a calculator receiving from stream "image": ; Empty packets are not allowed for type: OneOf<::mediapipe::Image, ::mediapipe::ImageFrame, mediapipe::GpuBuffer>" HOT 1
- [More info from find method]: Find method should optionally return full face detection results HOT 3
- [BUG]: deepface "find" method runs very slowly (16 sec per iteration), unable to use gpu HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deepface.