serengil / deepface

A Lightweight Face Recognition and Facial Attribute Analysis (Age, Gender, Emotion and Race) Library for Python
https://bit.ly/deepface-py
MIT License
14.87k stars 2.24k forks source link

Question: How to use weights from internal local files in Docker #623

Closed AmmarMohanna closed 1 year ago

AmmarMohanna commented 1 year ago

I am trying to use the deepface.DeepFace.analyze functionality inside a Docker container.

Is there a guide somewhere on how to do that? I noticed that there is a parameter named 'models' that we can use. When I call the analyze function for the first time, it downloads four weight files:

I want to be able to pass these weights as arguments to the function so it does not download them at the very first call to the docker image.

serengil commented 1 year ago

if you copy your files into ~/.deepface/weights then it will not download weights

but still you have to obey the model structures.

AmmarMohanna commented 1 year ago

Thank you for your response. Worked fine!

cnahmgx commented 1 year ago

(PersonalDigitalAssistant) [aigc@host-100 weights]$ pwd /home/aigc/magaoxiang/bin/.deepface/weights (PersonalDigitalAssistant) [aigc@host-100 weights]$ ll total 566492 -rw-r--r-- 1 aigc aigc 580085408 Oct 14 02:00 vgg_face_weights.h5

As you said, I have downloaded the model weights “vgg_face_weights.h5” to the directory “/home/aigc/magaoxiang/bin/.deepface/weights”, but I am still prompted to download the model weights:

(PersonalDigitalAssistant) [aigc@host-100 bin]$ python test.py 2023-10-14 02:01:18.593885: I tensorflow/core/util/port.cc:111] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0. 2023-10-14 02:01:18.596076: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used. 2023-10-14 02:01:18.634873: E tensorflow/compiler/xla/stream_executor/cuda/cuda_dnn.cc:9342] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered 2023-10-14 02:01:18.634902: E tensorflow/compiler/xla/stream_executor/cuda/cuda_fft.cc:609] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered 2023-10-14 02:01:18.634923: E tensorflow/compiler/xla/stream_executor/cuda/cuda_blas.cc:1518] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered 2023-10-14 02:01:18.643387: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used. 2023-10-14 02:01:18.643604: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2023-10-14 02:01:19.311177: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT 2023-10-14 02:01:20.101448: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:894] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355 2023-10-14 02:01:20.135921: W tensorflow/core/common_runtime/gpu/gpu_device.cc:2211] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform. Skipping registering GPU devices... vgg_face_weights.h5 will be downloaded...