akshaybahadur21 / Facial-Recognition-using-Facenet

A simple implementation of facial recognition using facenets for humans 🧔 🔍
MIT License
278 stars 143 forks source link

Default MaxPoolingOp only supports NHWC on device type CPU #25

Closed vinayak-parab closed 4 years ago

vinayak-parab commented 4 years ago

I am getting the above error when I run your code on a CPU. can you please help me figure out this error? Below is the error dump: 2020-08-11 11:14:53.225743: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found 2020-08-11 11:14:53.230514: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. 2020-08-11 11:14:58.467702: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found 2020-08-11 11:14:58.484449: E tensorflow/stream_executor/cuda/cuda_driver.cc:313] failed call to cuInit: UNKNOWN ERROR (303) 2020-08-11 11:14:58.680196: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-5P2P0GO 2020-08-11 11:14:58.684570: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-5P2P0GO 2020-08-11 11:14:58.766228: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 2020-08-11 11:14:59.500350: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x20f03ea2f50 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2020-08-11 11:14:59.505708: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version WARNING:tensorflow:No training configuration found in the save file, so the model was not compiled. Compile it manually. Total Params: 3743280 Traceback (most recent call last): File "rec-feat.py", line 114, in recognize() File "rec-feat.py", line 84, in recognize database = initialize() File "rec-feat.py", line 79, in initialize database[identity] = fr_utils.img_path_to_encoding(file, FRmodel) File "C:\Users\Dell\PycharmProjects\FACENET_IMPL\Facial-Recognition-using-Facenet_akb\fr_utils.py", line 194, in img_path_to_encoding return img_to_encoding(img1, model) File "C:\Users\Dell\PycharmProjects\FACENET_IMPL\Facial-Recognition-using-Facenet_akb\fr_utils.py", line 202, in img_to_encoding embedding = model.predict(x_train) File "C:\Users\Dell\anaconda3\envs\akb\lib\site-packages\tensorflow\python\keras\engine\training.py", line 88, in _method_wrapper return method(self, *args, *kwargs) File "C:\Users\Dell\anaconda3\envs\akb\lib\site-packages\tensorflow\python\keras\engine\training.py", line 1268, in predict tmp_batch_outputs = predict_function(iterator) File "C:\Users\Dell\anaconda3\envs\akb\lib\site-packages\tensorflow\python\eager\def_function.py", line 580, in call result = self._call(args, **kwds) File "C:\Users\Dell\anaconda3\envs\akb\lib\site-packages\tensorflow\python\eager\def_function.py", line 650, in _call return self._concrete_stateful_fn._filtered_call(canon_args, canon_kwds) # pylint: disable=protected-access File "C:\Users\Dell\anaconda3\envs\akb\lib\site-packages\tensorflow\python\eager\function.py", line 1665, in _filtered_call self.captured_inputs) File "C:\Users\Dell\anaconda3\envs\akb\lib\site-packages\tensorflow\python\eager\function.py", line 1746, in _call_flat ctx, args, cancellation_manager=cancellation_manager)) File "C:\Users\Dell\anaconda3\envs\akb\lib\site-packages\tensorflow\python\eager\function.py", line 598, in call ctx=ctx) File "C:\Users\Dell\anaconda3\envs\akb\lib\site-packages\tensorflow\python\eager\execute.py", line 60, in quick_execute inputs, attrs, num_outputs) tensorflow.python.framework.errors_impl.InvalidArgumentError: Default MaxPoolingOp only supports NHWC on device type CPU [[node FaceRecoModel/max_pooling2d_1/MaxPool (defined at C:\Users\Dell\PycharmProjects\FACENET_IMPL\Facial-Recognition-using-Facenet_akb\fr_utils.py:202) ]] [Op:__inference_predict_function_5808]

Function call stack: predict_function

vinayak-parab commented 4 years ago

Created a virtual environment in conda with tensorflow==1.13.1 and keras = 2.2.4 and python==3.6. The above specified configuration resolved the issue for me.