question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

verify function could be passed with numpy array ?

See original GitHub issue

I want to use DeepFace.verify() on a numpy array representing an image `img1 = img1[:,:,::-1]; img2 = img2[:,:,::-1]

obj = DeepFace.verify(img1, img2 , model_name = ‘Dlib’, distance_metric = ‘euclidean’)`

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
serengilcommented, Dec 22, 2020

I also share the my testing code

import cv2

img1 = cv2.imread("deepface/tests/dataset/img1.jpg")
img2 = cv2.imread("deepface/tests/dataset/img2.jpg")

print(type(img1))
print(type(img2))

from deepface import DeepFace
obj = DeepFace.verify(img1, img2)
print(obj)

This returns the following message

(tensorflow) C:\Users\IS96273\Desktop>python dummy.py <class ‘numpy.ndarray’> <class ‘numpy.ndarray’> Using TensorFlow backend. {‘verified’: True, ‘model’: ‘VGG-Face’, ‘similarity_metric’: ‘cosine’, ‘distance’: 0.2709779739379883, ‘max_threshold_to_verify’: 0.4}

I also add a control for numpy inputs in the unit tests. Thank you very much.

0reactions
thisKKcommented, Dec 22, 2020

Thank you very much for your help

Read more comments on GitHub >

github_iconTop Results From Across the Web

Are numpy arrays passed by reference? - Stack Overflow
In Python, all variable names are references to values. When Python evaluates an assignment, the right-hand side is evaluated before the ...
Read more >
Passing numpy array to shared library - Alban Siffer
Here we explain how we can pass numpy arrays to C (C++ and Go) shared libraries. ... Just let us imagine that we...
Read more >
Test whether the elements of a given NumPy array is zero or ...
In numpy, we can check that whether none of the elements of given array is zero or not with the help of numpy.all()...
Read more >
numpy.array — NumPy v1.24 Manual
In this case, it ensures the creation of an array object compatible with that passed in via this argument. New in version 1.20.0....
Read more >
numpy.any — NumPy v1.24 Manual
Test whether any array element along a given axis evaluates to True. ... then keepdims will not be passed through to the any...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found