Coder Social home page Coder Social logo

serengil / deepface Goto Github PK

View Code? Open in Web Editor NEW
10.0K 134.0 1.8K 51.99 MB

A Lightweight Face Recognition and Facial Attribute Analysis (Age, Gender, Emotion and Race) Library for Python

Home Page: https://www.youtube.com/watch?v=WnUVYQP4h44&list=PLsS_1RYmYQQFdWqxQggXHynP1rqaYXv_E&index=1

License: MIT License

Python 98.87% Dockerfile 0.75% Shell 0.32% Makefile 0.06%
face-recognition vgg-face facenet openface facial-expression-recognition age-prediction gender-prediction race-classification emotion-recognition deep-learning

deepface's People

Contributors

adnanhaddy avatar aku-ato avatar andrea-oliveri avatar andrealanfranchi avatar anthrax1 avatar bhky avatar biranchi2018 avatar blueprintparadise avatar danieldanuega avatar deepuvsdeepu avatar driesverachtert avatar ekkolon avatar fpaludi avatar haddyadnan avatar ma7555 avatar minhnguyenvan95 avatar ndido98 avatar onuratakan avatar rayvik avatar razaprodigy avatar rezakarbasi avatar rodrigo2019 avatar roelofruis avatar serengil avatar shirasael avatar unpublished avatar uriafranko avatar vincent-stragier avatar vjsyong avatar younver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deepface's Issues

path = folders[0] IndexError: list index out of range

Hey ! Thanks for this amazing project , I got this error in your functions.py line 74 in detectface, Any idea ?

deepface/commons/functions.py", line 74, in detectFace
path = folders[0]

IndexError: list index out of range

error in api

can you produce a list of the exact version of components you tested successfully and what is your version python?

pip install failure

I am unable to install deepface via pip:

pip install deepface resulted as-

ERROR: Could not find a version that satisfies the requirement deepface (from versions: none) ERROR: No matching distribution found for deepface

Model unpacking

I am using the library in colab and when I try to load the age/emotion/gender models it seems to unzip the absolute root url but then it cannot find the models in the higher level path.

Is there a different way to load these perhaps?

My code is quite simple:
models = {} models["emotion"] = Emotion.loadModel() models["age"] = Age.loadModel() #models["gender"] = Gender.loadModel() #DeepFace.analyze("9.jpg", models=models) DeepFace.analyze("9.jpg")

Console log:

facial_expression_model_weights.h5 will be downloaded...
Downloading...
From: https://drive.google.com/uc?id=13iUHHP3SlNg53qSuQZDdHDSDNdBP9nwy
To: /root/.deepface/weights/facial_expression_model_weights.zip

FileNotFoundError Traceback (most recent call last)
in ()
8 #print(img)
9
---> 10 process(im_pil)

2 frames
/usr/local/lib/python3.6/dist-packages/gdown/download.py in download(url, output, quiet, proxy, speed, use_cookies)
174 dir=osp.dirname(output),
175 )
--> 176 f = open(tmp_file, "wb")
177 else:
178 tmp_file = None

FileNotFoundError: [Errno 2] No such file or directory: '/root/.deepface/weights/facial_expression_model_weights.zipz42e9wnvtmp'

How does this module handle group photos?

Comparing an image with one person with one with many people yields a result, but I am not sure how it is calculating that result. Does it just match the closes face?

A couple other quick questions--Can the max_threshold_to_verify easily be modified? Finally, is there a way to have the "verified" value be set to false if the module cannot find a face in one of the images instead of erroring, and have this be done over a large dataset of images?

Thank you so much!

How to train custom model or exiting model on different datasets

the age and gender prediction model performing as good as i want. so i want to train exiting model with larger and FairFace Datasets, so it does not include biases towards Asian and Indian races. currently model is predicting most of the indian as middle eastern and girl black and white picture as male (e.g https://instagram.fdel8-1.fna.fbcdn.net/v/t51.2885-15/sh0.08/e35/s640x640/54511194_316042602429112_4909322531097362425_n.jpg?_nc_ht=instagram.fdel8-1.fna.fbcdn.net&_nc_cat=104&_nc_ohc=mmm3Ugh_-hgAX80XTsi&oh=e1fbaa372f216514d81d3bb86a19da86&oe=5F02F4EE)?

can you help or guide me how to train existing model on dataset

Thank You

Face embeddings

Hello, Thank you so much for the effort you put on this work.

So, I have already a faces dataset, which upon I apply some transformations and then I need to run the face verification system on both (original and transformed datasets) to see if the transformations were able to hide the identity or not.

In this case, I think that I should not use the OpenCV face detection model, this why I set enforce_detection = False.

I was just wondering if we set enforce_detection = False, how the face recognition model will get the face embeddings.

Will it use the whole image (since images contains already only faces) ?

Emotion detection problem

Great work on building this library by the way! I'm having an OpenCV exception when I try running emotion detection, while all the other networks work fine. I believe the problem stems from this line:

img = functions.detectFace(img_path, (48, 48), True)

By running detectFace with grayscale=True, we load the image already in grayscale with cv2.imread(), but then the function cv2.cvtColor expects a RGB image to convert to grayscale, hence an OpenCV error pops up. Thank you again for your time and for releasing this library to the world!

detected_face_gray = cv2.cvtColor(detected_face, cv2.COLOR_BGR2GRAY)

How to deal large scale list of photos and save memory e.g. DeepFace.analyze

Hi Sefik,

I have a very long list of photos,as the for loop consume a lot memory, could you specify how to do it with DeepFace.analyze function? for example there are 20 images

When I run it get KeyErro:"age" as follows.

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-31-8729b88c148d> in <module>
      2 #demography = DeepFace.analyze(image_path, actions = ['age', 'gender', 'race', 'emotion'])
      3 #demographies = DeepFace.analyze(["img1.jpg", "img2.jpg", "img3.jpg"]) #analyzing multiple faces same time
----> 4 print("Age: ", demography["age"])
      5 print("Gender: ", demography["gender"])
      6 print("Emotion: ", demography["dominant_emotion"])

KeyError: 'age'

Thanks for your help!

Peng

run api on python 3.8.3

I try to run API on python 3,8,3 but occur error.
Can you fix the API error on Python 3.8.3?

error
File "api2.py", in
graph = tf.get_default_graph()
AttributeError: module 'tensorflow' has no attribute 'get_default_graph'

Landmark detection

Hello,
Wondering if there are any APIs with which I can do Landmark detection and also contours like provided by Android's APIs.

Issue with using deepface with flask in server

_I am getting the following issue with my flask app when I am running it from the server.It works only for the first time after reloading the flask app. But It works fine all the time in my local machine. _

Actions to do: ['age', 'gender']
Debugging middleware caught exception in streamed response at a point where response headers were already sent.
Traceback (most recent call last):
File "/home/isl_gpu_desktop/peopleCount/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1075, in _run
subfeed, allow_tensor=True, allow_operation=False)
File "/home/isl_gpu_desktop/peopleCount/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3613, in as_graph_element
return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
File "/home/isl_gpu_desktop/peopleCount/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3692, in _as_graph_element_locked
raise ValueError("Tensor %s is not an element of this graph." % obj)
ValueError: Tensor Tensor("Placeholder:0", shape=(3, 3, 3, 64), dtype=float32) is not an element of this graph.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/isl_gpu_desktop/peopleCount/lib/python3.6/site-packages/werkzeug/wsgi.py", line 506, in next
return self._next()
File "/home/isl_gpu_desktop/peopleCount/lib/python3.6/site-packages/werkzeug/wrappers/base_response.py", line 45, in _iter_encoded
for item in iterable:
File "/home/isl_gpu_desktop/Documents/project/PeopleCountWithAgeGender/app.py", line 88, in gen
frame = people_counter_obj.run()
File "/home/isl_gpu_desktop/Documents/project/PeopleCountWithAgeGender/people_counter.py", line 416, in run
self.detect_faces(frame)
File "/home/isl_gpu_desktop/Documents/project/PeopleCountWithAgeGender/people_counter.py", line 373, in detect_faces
results = DeepFace.analyze(face_img, ['age', 'gender'])
File "/home/isl_gpu_desktop/peopleCount/lib/python3.6/site-packages/deepface/DeepFace.py", line 192, in analyze
age_model = Age.loadModel()
File "/home/isl_gpu_desktop/peopleCount/lib/python3.6/site-packages/deepface/extendedmodels/Age.py", line 40, in loadModel
age_model.load_weights(home+'/.deepface/weights/age_model_weights.h5')
File "/home/isl_gpu_desktop/peopleCount/lib/python3.6/site-packages/keras/engine/network.py", line 1180, in load_weights
f, self.layers, reshape=reshape)
File "/home/isl_gpu_desktop/peopleCount/lib/python3.6/site-packages/keras/engine/saving.py", line 929, in load_weights_from_hdf5_group
K.batch_set_value(weight_value_tuples)
File "/home/isl_gpu_desktop/peopleCount/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2435, in batch_set_value
get_session().run(assign_ops, feed_dict=feed_dict)
File "/home/isl_gpu_desktop/peopleCount/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 900, in run
run_metadata_ptr)
File "/home/isl_gpu_desktop/peopleCount/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1078, in _run
'Cannot interpret feed_dict key as Tensor: ' + e.args[0])
TypeError: Cannot interpret feed_dict key as Tensor: Tensor Tensor("Placeholder:0", shape=(3, 3, 3, 64), dtype=float32) is not an element of this graph.

Error in API in /verify

I'm sending request from postman :-

{
	"item": [
		{
			"name": "Face recognition - VGG",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json"
					}
				],
				"body": {
                                        "mode": "raw",
					"raw": {
					"model_name" : "Facenet",
					"img": [
						{
							"img1" : "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMSEhUSE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YQs3wxkQ7ZaHhnEwHQs+Xdr0P8AHkkXtPDd1HYRllXU+ItNrbIl+KDZO2nr0WDqXdABGMeAsfX461mrkLT7a0w4AiRpM/VaY45XxlyZ4z2tzVbmCpeI4SRp+yHwfauk8xmaJ8dPVW9DGseLGUWWM5ZfGJ4ph8wIIBjqASPfVZuliXUjkN92zp1jwXovHW03NJbqNwJjzhZDF8JFXvEvFvlaB6y4zv069FpjnNdubmymN3KDGJLHtqNMcwlrgdJ8fMa+6M43hgS0t1GV19wIG24gT6qsIDZYSHNBbMEOyzuCPEaf1FT47EOdIk5WkZbzaL6eq0x92x+vqJ+zrwyoW9XECDtmsB6FBcROWo5o2JHsYKmonK5rr2dJ3+Jpj9FBx5hFZ3QwQesgK99oy/8AMC81c5qHzJZlTMRzUuah8y7KAn5qXNUC6gJuakKhUScEBJzCuJq6gPVcU8kzCAqG+iLoVS4a2TMXYLDM1NjmDUC6AbTCKxNWTCYAuXu1nROBpdFosAyIVLw8XWgw4gLpw6h4weE8mAg3V4CGqY3xRts5j6sLB9tOK4epS5fMDnhwI"
						}
					]
				}
			}
		}
	}
]
}

Im getting This error :-

{
    "error": "you must pass at least one img object in your request",
    "success": false
}

All the params are passing in img list but still this error and even I tried the way you said in api folder (deepface.postman_collection.json file) but still same error I think bug in code.
Thanks

Lowering the batch size

Hello.. i've tried to running your code in jetson nano and i've met error like this.

image

I've tried to trying lowering the batch size but I think i do it wrong. I still got the same error. Can you help me? Thankyou

Cannot import name deepface

Hi there!

I have ran into a similar issue as the previous guy and have also did the same things. But i'm running on Mac OS.

ImportError: cannot import name 'DeepFace' from 'deepface' (/Users/oha/anaconda3/lib/python3.7/site-packages/deepface/init.py)

!pip install deepface
from deepface import DeepFace
import cv2
import matplotlib.pyplot as plt
from tensorflow import keras

Requirement already satisfied: deepface in /Users/oha/anaconda3/lib/python3.7/site-packages (0.0.9)
Requirement already satisfied: gdown>=3.10.1 in /Users/oha/anaconda3/lib/python3.7/site-packages (from deepface) (3.10.1)

Any idea how to fix this?

Thanks!

GPU Support

Hey i have nvidia 1070 GPU can you guide me to run this on gpu
i Tried
Deepface.allocateMemory()
but it saying it will run on CPU. let me know the necessary tools as well as settings required to run this on GPU.

Thanks

error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

Hi Sefik,

When run a list of photos, it got the error, please kindly help, thanks!

error                                     Traceback (most recent call last)
<ipython-input-106-11a608cbbff8> in <module>
----> 1 demographies = DeepFace.analyze(images)
      2 for i in range(len(images)):
      3     print(i)
      4     n=i+1
      5 

c:\users\pysep\appdata\local\programs\python\python38\lib\site-packages\deepface\DeepFace.py in analyze(img_path, actions, models, enforce_detection)
    381                         if action == 'emotion':
    382                                 emotion_labels = ['angry', 'disgust', 'fear', 'happy', 'sad', 'surprise', 'neutral']
--> 383                                 img = functions.detectFace(img_path, target_size = (48, 48), grayscale = True, enforce_detection = enforce_detection)
    384 
    385                                 emotion_predictions = emotion_model.predict(img)[0,:]

c:\users\pysep\appdata\local\programs\python\python38\lib\site-packages\deepface\commons\functions.py in detectFace(img, target_size, grayscale, enforce_detection)
    309 
    310                         if grayscale == True:
--> 311                                 img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    312 
    313                         img = cv2.resize(img, target_size)

error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

disk space issue

I've installed deepface successfully and now I'm running this command in a loop:

res = DeepFace.analyze("img.jpg", actions = ['age', 'gender', 'race', 'emotion'])

When I run the script it takes a lot of disk space (+60GB) , getting a "no space left on device" error. Then the process ends it free up the disk space used.
I'm not sure in which directory it writes all this data and how to avoid it.
Can you help me?

Thank you

Using Online Images

Hi - I believe this package requires locally saved files. Is there a way to use image urls without modifying the package? I am using DeepFace.analyze() in a loop on mac OS and it is eating up my storage. I looked into the library files and I am not certain where the issue may be. There are many temp directories on mac and I believe this function is writing files to a temp directory. I am testing on just 10 images and it is taking 8 gb. When I reset the kernel, my available storage goes back to normal.

The purpose for this is to use on about 23k images. I am only interested in race and gender. I can reduce the analyze() function to return just this and clean race.py and gender.py but this does not improve performance.

So i found out that the issue really is due to having to generate the models over and over in the loop. Employing clear_session and del model helps in this case.

The model with unloaded weights is not taken.

I have manually downloaded the model with weights since it does not allow the automatic download due to user traffic, then said model is not recognized AND again try to download which leads to the vicious circle, Where can I specify the downloaded .h5 file so that I don't try to download it again and the rest will work?

api.py hit error

get this error when call api from postman

in call
run_metadata_ptr)
tensorflow.python.framework.errors_impl.FailedPreconditionError: Error while reading resource variable Block17_1_Branch_1_Conv2d_0a_1x1/kernel from Container: localhost. This could mean that the variable was uninitialized. Not found: Container localhost does not exist. (Could not find resource: localhost/Block17_1_Branch_1_Conv2d_0a_1x1/kernel)
[[{{node Block17_1_Branch_1_Conv2d_0a_1x1/convolution/ReadVariableOp}}]]

Faces embeddings

Hello, Thank you so much for the effort you put on this work.

So, I have already a faces dataset, which upon I apply some transformations and then I need to run the face verification system on both (original and transformed datasets) to see if the transformations were able to hide the identity or not.

In this case, I think that I should not use the OpenCV face detection model, this why I set enforce_detection = False.

I was just wondering if we set enforce_detection = False, how the face recognition model will get the face embeddings.

Will it use the whole image (since images contains already only faces) ?

deepface model

I take the FBdeepface.py file and download VGGFace2_DeepFace_weights_val-0.9034.h5.zip model. I implemented it in my code.
I am working on the face recognition system. I use your model to predict face.
Is it normal to take 50 seconds to predict?

  • Keeping in mind the dataset I used contains 450 images(10 people)

Match 1:N

I am developing an application where the user at the time of registration registers a photo of the face for later verification.
When the user identifies himself I want to match his face with all registered faces and identify "this user is the ID ...".
How to do this with the deep face?

Analysis message suppression

Currently there seems like there is no way to suppress the progress bar message which pops up during facial feature analysis. Could a parameter be added to the analyze function to suppress these messages from being printed?

'_thread._local' object has no attribute 'value'

Hey there,

I just started with DeepFace and it seemed all to work. But something weirds happen when I put the exact same code (copied from the official page) in a function.

This is the code I try to run:

` try:

            faceinfo = DeepFace.analyze("images/happy.jpeg")
            print('[INFO] Emotion:', faceinfo["dominant_emotion"])
            print('[INFO] Age:', faceinfo["age"])
            print('[INFO] Gender:', faceinfo["gender"])
            print('[INFO] Race:', faceinfo["dominant_race"])


        except Exception as e:
            print(str(e) + ' [FACE INFO]')`

The error i'm getting: '_thread._local' object has no attribute 'value'

Could anyone help me out with this?

Train Olayı

Şefik hocam kütüphanenizi anlık olarak izliyor takip ediyorum :) github ınızda gördüğüm kadarıyla realtime.py dosyasını farkettim
inceledikten sonra farkettim ki her çalıştırmada image_path klasörünü her seferinde train ediyor.
Bunu her seferinde yapmak yerine o klasörü train ettikten sonra bir dosyaya yazıp daha sonra çalıştırma işini öyle yapsak daha iyi olmaz mı ?

Hatta şöyle bir şey daha sorayım örnek olarak ocak ayındaki train dosyaları gibi bir ayrıma giderek şöyle bir şey yapmak mümkün mü

people/ocak --> ocak ayında gelen insanların fotoğrafı ve içerisinde bu fotoğrafların analizini modele yükleyebileceğimiz bir .yaml dosyası

poeple/subat gibi bir şey yapmak mümkün mü ?

Can handle images with multiple faces, and multiple resolutions?

Does this framework can handle images with multiple faces and multiple resolutions? By multiple faces I mean, if it can compare "img_1.png" witch contains only the target face, and an array of images that may contain multiple faces including the target or no face at all.

Something like:

from deepface import DeepFace
dataset = ["img_2.png", "img_3.png"]
result = DeepFace.verify("img_1.png", dataset)

DeepFace.find and DeepFace.analyze issues

import pandas as pd
df=DeepFace.find(img_path='dataset/peng.png',db_path='C:/R_Py/Jupyter/deepface/dataset')

Using VGG-Face model backend and cosine distance.

Analyzing: 0%| | 0/1 [00:00<?, ?it/s]

WARNING: Representations for images in C:/R_Py/Jupyter/deepface/dataset folder were previously stored in representations_vgg_face.pkl . If you added new instances after this file creation, then please delete this file and call find function again. It will create it again.
There are 4 representations found in representations_vgg_face.pkl

Analyzing: 100%|█████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 2.71it/s]

find function lasts 1.724104881286621 seconds

df.shape[0]
0

Hi Selfk,

  1. When I tried the DeepFace.find with datasets, it shows no time in the data frame.

  2. It is not possible to delete it says the pkl is used in python(If you added new instances after this file creation, then please delete this file and call find function again. It will create it again. )

3, when I run the DeepFace.analyze, there are some detection are not accurate at all, man becomes women, kids are 26 years old, is there any way to retrain or get the result correctly? the easier the better, I am a beginner of the deepface.

Please kindly help with the 3 issues.

Thanks a lot!

Peng from youtube

``

Find Function through API

Hey Can you also add this feature.. like user will send base64 image to /find url and it will search in pickle file through find function if any image found then return image as base64 to whom it matches.....
please add this feature also.....

Face encoding generated for my pet

I am trying to find face encodings for an area. For an image it is able to find face encodings that too for a dog facing backwards.

2020-06-02T12:41:51_-1_Person_468_1182

`
from deepface import DeepFace
#from deepface.basemodels import VGGFace, OpenFace, Facenet, FbDeepFace
from deepface.basemodels import Facenet
from deepface.commons import functions, realtime, distance as dst
model = Facenet.loadModel()
input_shape = (160,160)
model_name = 'Facenet'
distance_metric = 'cosine'
threshold = functions.findThreshold(model_name, distance_metric)
def get_face_encodings(file_name):
try:
img1 = functions.detectFace(file_name,input_shape)
img1_representation = model.predict(img1)[0,:]
print(img1_representation)
return img1_representation
except:
return []
face_encoding = get_face_encodings(file)

`
Try it yourself , it sometimes find face encodings for me when I am facing against the camera

Face Detection Problem

I have tested your Deepface Library with a lot of images and it outperforms well... but there is a issue in face detection.. Sometime's Face not got detected in image and it returns valueError. So to make sure faces should be detected in every image Use MTCNN Library. It detects every faces in images. Its Far better than haar cascade in opencv. let me know your suggestion...

Thanks

Flask API with gunicorn on multi-thread and multi-worker mode

I created a simple (bare minimum) API server in Flask. It runs smoothly with the default TF graph.
However, I don't seem to make it work when number of threads is greater than 1.

AttributeError: '_thread._local' object has no attribute 'value'

This error is seen with following gunicorn configuration:

gunicorn --bind 0.0.0.0:$PORT --threads=2 --workers=1  app.app:app

Now, when worker is bumped up, the server just freezes indefinitely without any response.

gunicorn --bind 0.0.0.0:$PORT --threads=1 --workers=2  app.app:app --timeout 120 --preload  --timeout 120

I know it's an issue with TF session and threads. But, has anyone got it to work?

Also, I have loaded the model within the same default graph.

'NoneType' object has no attribute 'copy' -- error in database path

Hi, I got an error when trying to work because there is a space in the database path.

from deepface import DeepFace
DeepFace.stream("C:/FromUbuntu/Azure DevOps for Git/Proje Detayları/dataset")

image

worked when moving dataset to a space without spaces

from deepface import DeepFace
DeepFace.stream("C:/dataset")

thanks for the great work

lightgbm.basic.LightGBMError: Could not open

Hello Sefik!

Firstly thanks for this amazing project,

I was using your ensemble face verification system but today i can not use it because of getting this error:

lightgbm.basic.LightGBMError: Could not open /home/comp/anaconda3/envs/verification/lib/python3.6/site-packages/models/face-recognition-ensemble-model.txt

There is no model directory in site-packages. This occured today. Maybe smth changed in lightgbm. I looking for how to figure it out but cant find anything.

You have any idea ?

Have a nice day

Value Error

Hello again,

While applying DeepFace.analyze I got this error, I think something wrong with padding calculation

ValueError: Error when checking input: expected zero_padding2d_118_input to have shape (224, 224, 3) but got array with shape (48, 48, 1)

E tensorflow/stream_executor/cuda/cuda_driver.cc:313] failed call to cuInit: UNKNOWN ERROR (303 on Docker Debian 9

I have this error using debian on the docker, I would like to disable cuda support, is there how?

Below is the output:

Using TensorFlow backend.
^[[AUsing VGG-Face model backend and cosine distance.
2020-05-20 14:35:39.426369: E tensorflow/stream_executor/cuda/cuda_driver.cc:313] failed call to cuInit: UNKNOWN ERROR (303)
Verification: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 1.46it/s]
{'pair_1': {'distance': 0.23476946353912354,
'max_threshold_to_verify': 0.4,
'model': 'VGG-Face',
'similarity_metric': 'cosine',
'verified': True}}

IndexError: list index out of range (input_shape)

Hi and thank you for your work.

Unfortunately, it's not working for me. If I want to run the test, I get the output below. Somehow it seems to have problems loading the model. I have already reinstalled Keras twice (also with --no-cache-dir).

Can you help me please?

$ python3 test.py

Output:

Using TensorFlow backend.
Using VGG-Face model backend and cosine distance.
Traceback (most recent call last):
  File "test.py", line 2, in <module>
    result = DeepFace.verify("/home/pi/img1.jpg", "/home/pi/img2.jpg")
  File "/home/pi/.local/lib/python3.7/site-packages/deepface/DeepFace.py", line 212, in verify
    input_shape_x = input_shape[0]

Edit:
On first run, the file vgg_face_weights.h5 was successfully downloaded

I did some debugging and inserted following line for the output:

print(model.layers[0].input_shape)

Output:
[(None, 224, 224, 3)]

no module named cv2

Hi,
I installed deepface successfully on ubuntu 18.04:

vagrant@ubuntu-bionic:~$ pip3 install deepface
Collecting deepface
  Downloading https://files.pythonhosted.org/packages/95/30/778a099c47f0eaa90b06771d21e9c1acc9fe1b0b1c8cfd7d9f282c130793/deepface-0.0.18-py3-none-any.whl
Collecting tensorflow>=1.9.0 (from deepface)
  Downloading https://files.pythonhosted.org/packages/de/f0/96fb2e0412ae9692dbf400e5b04432885f677ad6241c088ccc5fe7724d69/tensorflow-1.14.0-cp36-cp36m-manylinux1_x86_64.whl (109.2MB)
    100% |████████████████████████████████| 109.2MB 15kB/s
Collecting tqdm>=4.30.0 (from deepface)
  Downloading https://files.pythonhosted.org/packages/4a/1c/6359be64e8301b84160f6f6f7936bbfaaa5e9a4eab6cbc681db07600b949/tqdm-4.45.0-py2.py3-none-any.whl (60kB)
    100% |████████████████████████████████| 61kB 10.2MB/s
Collecting Pillow>=5.2.0 (from deepface)
  Downloading https://files.pythonhosted.org/packages/ba/90/8a24e6220cfcf6a3a0162535d5b926e774117e384ff921908e07e4c92bda/Pillow-7.1.1-cp36-cp36m-manylinux1_x86_64.whl (2.1MB)
    100% |████████████████████████████████| 2.1MB 846kB/s
Collecting pandas>=0.23.4 (from deepface)
  Downloading https://files.pythonhosted.org/packages/bb/71/8f53bdbcbc67c912b888b40def255767e475402e9df64050019149b1a943/pandas-1.0.3-cp36-cp36m-manylinux1_x86_64.whl (10.0MB)
    100% |████████████████████████████████| 10.0MB 163kB/s
Collecting gdown>=3.10.1 (from deepface)
  Downloading https://files.pythonhosted.org/packages/1a/a4/b3bd477155c13b38ccf0b49ede5daebe7673c7b1c4445041c5665ae65c2d/gdown-3.10.2.tar.gz
Collecting numpy>=1.14.0 (from deepface)
  Downloading https://files.pythonhosted.org/packages/07/08/a549ba8b061005bb629b76adc000f3caaaf881028b963c2e18f811c6edc1/numpy-1.18.2-cp36-cp36m-manylinux1_x86_64.whl (20.2MB)
    100% |████████████████████████████████| 20.2MB 86kB/s
Collecting keras>=2.2.0 (from deepface)
  Downloading https://files.pythonhosted.org/packages/ad/fd/6bfe87920d7f4fd475acd28500a42482b6b84479832bdc0fe9e589a60ceb/Keras-2.3.1-py2.py3-none-any.whl (377kB)
    100% |████████████████████████████████| 378kB 614kB/s
Collecting wheel>=0.26 (from tensorflow>=1.9.0->deepface)
  Downloading https://files.pythonhosted.org/packages/8c/23/848298cccf8e40f5bbb59009b32848a4c38f4e7f3364297ab3c3e2e2cd14/wheel-0.34.2-py2.py3-none-any.whl
Collecting absl-py>=0.7.0 (from tensorflow>=1.9.0->deepface)
  Downloading https://files.pythonhosted.org/packages/1a/53/9243c600e047bd4c3df9e69cfabc1e8004a82cac2e0c484580a78a94ba2a/absl-py-0.9.0.tar.gz (104kB)
    100% |████████████████████████████████| 112kB 11.1MB/s
Collecting google-pasta>=0.1.6 (from tensorflow>=1.9.0->deepface)
  Downloading https://files.pythonhosted.org/packages/a3/de/c648ef6835192e6e2cc03f40b19eeda4382c49b5bafb43d88b931c4c74ac/google_pasta-0.2.0-py3-none-any.whl (57kB)
    100% |████████████████████████████████| 61kB 7.3MB/s
Collecting keras-applications>=1.0.6 (from tensorflow>=1.9.0->deepface)
  Downloading https://files.pythonhosted.org/packages/71/e3/19762fdfc62877ae9102edf6342d71b28fbfd9dea3d2f96a882ce099b03f/Keras_Applications-1.0.8-py3-none-any.whl (50kB)
    100% |████████████████████████████████| 51kB 10.8MB/s
Collecting grpcio>=1.8.6 (from tensorflow>=1.9.0->deepface)
  Downloading https://files.pythonhosted.org/packages/cf/7a/9744998129fce7e29c5f2d8b0f545913b7383e65d8366fc0ae98d11936af/grpcio-1.28.1.tar.gz (19.5MB)
    100% |████████████████████████████████| 19.5MB 72kB/s
Collecting tensorboard<1.15.0,>=1.14.0 (from tensorflow>=1.9.0->deepface)
  Downloading https://files.pythonhosted.org/packages/91/2d/2ed263449a078cd9c8a9ba50ebd50123adf1f8cfbea1492f9084169b89d9/tensorboard-1.14.0-py3-none-any.whl (3.1MB)
    100% |████████████████████████████████| 3.2MB 525kB/s
Collecting keras-preprocessing>=1.0.5 (from tensorflow>=1.9.0->deepface)
  Downloading https://files.pythonhosted.org/packages/28/6a/8c1f62c37212d9fc441a7e26736df51ce6f0e38455816445471f10da4f0a/Keras_Preprocessing-1.1.0-py2.py3-none-any.whl (41kB)
    100% |████████████████████████████████| 51kB 9.8MB/s
Collecting astor>=0.6.0 (from tensorflow>=1.9.0->deepface)
  Downloading https://files.pythonhosted.org/packages/c3/88/97eef84f48fa04fbd6750e62dcceafba6c63c81b7ac1420856c8dcc0a3f9/astor-0.8.1-py2.py3-none-any.whl
Collecting termcolor>=1.1.0 (from tensorflow>=1.9.0->deepface)
  Downloading https://files.pythonhosted.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz
Collecting wrapt>=1.11.1 (from tensorflow>=1.9.0->deepface)
  Downloading https://files.pythonhosted.org/packages/82/f7/e43cefbe88c5fd371f4cf0cf5eb3feccd07515af9fd6cf7dbf1d1793a797/wrapt-1.12.1.tar.gz
Collecting six>=1.10.0 (from tensorflow>=1.9.0->deepface)
  Downloading https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Collecting tensorflow-estimator<1.15.0rc0,>=1.14.0rc0 (from tensorflow>=1.9.0->deepface)
  Downloading https://files.pythonhosted.org/packages/3c/d5/21860a5b11caf0678fbc8319341b0ae21a07156911132e0e71bffed0510d/tensorflow_estimator-1.14.0-py2.py3-none-any.whl (488kB)
    100% |████████████████████████████████| 491kB 1.2MB/s
Collecting gast>=0.2.0 (from tensorflow>=1.9.0->deepface)
  Downloading https://files.pythonhosted.org/packages/d6/84/759f5dd23fec8ba71952d97bcc7e2c9d7d63bdc582421f3cd4be845f0c98/gast-0.3.3-py2.py3-none-any.whl
Collecting protobuf>=3.6.1 (from tensorflow>=1.9.0->deepface)
  Downloading https://files.pythonhosted.org/packages/57/02/5432412c162989260fab61fa65e0a490c1872739eb91a659896e4d554b26/protobuf-3.11.3-cp36-cp36m-manylinux1_x86_64.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 1.1MB/s
Collecting pytz>=2017.2 (from pandas>=0.23.4->deepface)
  Downloading https://files.pythonhosted.org/packages/e7/f9/f0b53f88060247251bf481fa6ea62cd0d25bf1b11a87888e53ce5b7c8ad2/pytz-2019.3-py2.py3-none-any.whl (509kB)
    100% |████████████████████████████████| 512kB 1.3MB/s
Collecting python-dateutil>=2.6.1 (from pandas>=0.23.4->deepface)
  Downloading https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl (227kB)
    100% |████████████████████████████████| 235kB 1.7MB/s
Collecting filelock (from gdown>=3.10.1->deepface)
  Downloading https://files.pythonhosted.org/packages/93/83/71a2ee6158bb9f39a90c0dea1637f81d5eef866e188e1971a1b1ab01a35a/filelock-3.0.12-py3-none-any.whl
Collecting requests[socks] (from gdown>=3.10.1->deepface)
  Downloading https://files.pythonhosted.org/packages/1a/70/1935c770cb3be6e3a8b78ced23d7e0f3b187f5cbfab4749523ed65d7c9b1/requests-2.23.0-py2.py3-none-any.whl (58kB)
    100% |████████████████████████████████| 61kB 9.1MB/s
Collecting pyyaml (from keras>=2.2.0->deepface)
  Downloading https://files.pythonhosted.org/packages/64/c2/b80047c7ac2478f9501676c988a5411ed5572f35d1beff9cae07d321512c/PyYAML-5.3.1.tar.gz (269kB)
    100% |████████████████████████████████| 276kB 5.6MB/s
Collecting scipy>=0.14 (from keras>=2.2.0->deepface)
  Downloading https://files.pythonhosted.org/packages/dc/29/162476fd44203116e7980cfbd9352eef9db37c49445d1fec35509022f6aa/scipy-1.4.1-cp36-cp36m-manylinux1_x86_64.whl (26.1MB)
    100% |████████████████████████████████| 26.1MB 64kB/s
Collecting h5py (from keras>=2.2.0->deepface)
  Downloading https://files.pythonhosted.org/packages/60/06/cafdd44889200e5438b897388f3075b52a8ef01f28a17366d91de0fa2d05/h5py-2.10.0-cp36-cp36m-manylinux1_x86_64.whl (2.9MB)
    100% |████████████████████████████████| 2.9MB 515kB/s
Collecting setuptools>=41.0.0 (from tensorboard<1.15.0,>=1.14.0->tensorflow>=1.9.0->deepface)
  Downloading https://files.pythonhosted.org/packages/a0/df/635cdb901ee4a8a42ec68e480c49f85f4c59e8816effbf57d9e6ee8b3588/setuptools-46.1.3-py3-none-any.whl (582kB)
    100% |████████████████████████████████| 583kB 1.3MB/s
Collecting markdown>=2.6.8 (from tensorboard<1.15.0,>=1.14.0->tensorflow>=1.9.0->deepface)
  Downloading https://files.pythonhosted.org/packages/ab/c4/ba46d44855e6eb1770a12edace5a165a0c6de13349f592b9036257f3c3d3/Markdown-3.2.1-py2.py3-none-any.whl (88kB)
    100% |████████████████████████████████| 92kB 10.1MB/s
Collecting werkzeug>=0.11.15 (from tensorboard<1.15.0,>=1.14.0->tensorflow>=1.9.0->deepface)
  Downloading https://files.pythonhosted.org/packages/cc/94/5f7079a0e00bd6863ef8f1da638721e9da21e5bacee597595b318f71d62e/Werkzeug-1.0.1-py2.py3-none-any.whl (298kB)
    100% |████████████████████████████████| 307kB 5.3MB/s
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests[socks]->gdown>=3.10.1->deepface)
  Downloading https://files.pythonhosted.org/packages/e8/74/6e4f91745020f967d09332bb2b8b9b10090957334692eb88ea4afe91b77f/urllib3-1.25.8-py2.py3-none-any.whl (125kB)
    100% |████████████████████████████████| 133kB 5.1MB/s
Collecting idna<3,>=2.5 (from requests[socks]->gdown>=3.10.1->deepface)
  Downloading https://files.pythonhosted.org/packages/89/e3/afebe61c546d18fb1709a61bee788254b40e736cff7271c7de5de2dc4128/idna-2.9-py2.py3-none-any.whl (58kB)
    100% |████████████████████████████████| 61kB 10.8MB/s
Collecting chardet<4,>=3.0.2 (from requests[socks]->gdown>=3.10.1->deepface)
  Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
    100% |████████████████████████████████| 143kB 10.0MB/s
Collecting certifi>=2017.4.17 (from requests[socks]->gdown>=3.10.1->deepface)
  Downloading https://files.pythonhosted.org/packages/57/2b/26e37a4b034800c960a00c4e1b3d9ca5d7014e983e6e729e33ea2f36426c/certifi-2020.4.5.1-py2.py3-none-any.whl (157kB)
    100% |████████████████████████████████| 163kB 8.7MB/s
Collecting PySocks!=1.5.7,>=1.5.6; extra == "socks" (from requests[socks]->gdown>=3.10.1->deepface)
  Downloading https://files.pythonhosted.org/packages/8d/59/b4572118e098ac8e46e399a1dd0f2d85403ce8bbaad9ec79373ed6badaf9/PySocks-1.7.1-py3-none-any.whl
Building wheels for collected packages: gdown, absl-py, grpcio, termcolor, wrapt, pyyaml
  Running setup.py bdist_wheel for gdown ... done
  Stored in directory: /home/vagrant/.cache/pip/wheels/95/49/64/58e8cd19363d1e3e491805cd780e302708985ad790dd13e1ad
  Running setup.py bdist_wheel for absl-py ... done
  Stored in directory: /home/vagrant/.cache/pip/wheels/8e/28/49/fad4e7f0b9a1227708cbbee4487ac8558a7334849cb81c813d
  Running setup.py bdist_wheel for grpcio ... -ls
\done
  Stored in directory: /home/vagrant/.cache/pip/wheels/00/4d/5f/07d0d4283911d2b917b867a11b1622d9d2cc8c286eefd10c33
  Running setup.py bdist_wheel for termcolor ... done
  Stored in directory: /home/vagrant/.cache/pip/wheels/7c/06/54/bc84598ba1daf8f970247f550b175aaaee85f68b4b0c5ab2c6
  Running setup.py bdist_wheel for wrapt ... done
  Stored in directory: /home/vagrant/.cache/pip/wheels/b1/c2/ed/d62208260edbd3fa7156545c00ef966f45f2063d0a84f8208a
  Running setup.py bdist_wheel for pyyaml ... done
  Stored in directory: /home/vagrant/.cache/pip/wheels/a7/c1/ea/cf5bd31012e735dc1dfea3131a2d5eae7978b251083d6247bd
Successfully built gdown absl-py grpcio termcolor wrapt pyyaml
Installing collected packages: wheel, six, absl-py, google-pasta, numpy, h5py, keras-applications, grpcio, setuptools, protobuf, markdown, werkzeug, tensorboard, keras-preprocessing, astor, termcolor, wrapt, tensorflow-estimator, gast, tensorflow, tqdm, Pillow, pytz, python-dateutil, pandas, filelock, urllib3, idna, chardet, certifi, PySocks, requests, gdown, pyyaml, scipy, keras, deepface
Successfully installed Pillow-7.1.1 PySocks-1.7.1 absl-py-0.9.0 astor-0.8.1 certifi-2020.4.5.1 chardet-3.0.4 deepface-0.0.18 filelock-3.0.12 gast-0.3.3 gdown-3.10.2 google-pasta-0.2.0 grpcio-1.28.1 h5py-2.10.0 idna-2.9 keras-2.3.1 keras-applications-1.0.8 keras-preprocessing-1.1.0 markdown-3.2.1 numpy-1.18.2 pandas-1.0.3 protobuf-3.11.3 python-dateutil-2.8.1 pytz-2019.3 pyyaml-5.3.1 requests-2.23.0 scipy-1.4.1 setuptools-46.1.3 six-1.14.0 tensorboard-1.14.0 tensorflow-1.14.0 tensorflow-estimator-1.14.0 termcolor-1.1.0 tqdm-4.45.0 urllib3-1.25.8 werkzeug-1.0.1 wheel-0.34.2 wrapt-1.12.1

And run this main.py file:

from deepface import DeepFace

img1= input('\nimg1 path\n')
img2= input('\nimg2 path\n')

result = DeepFace.verify(img1, img2)

print("\n\nIs verified: ", result["verified"])

And got this error:

Using TensorFlow backend.
/home/vagrant/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/vagrant/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/vagrant/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/vagrant/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/vagrant/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/vagrant/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
/home/vagrant/.local/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/vagrant/.local/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/vagrant/.local/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/vagrant/.local/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/vagrant/.local/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/vagrant/.local/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
Traceback (most recent call last):
  File "main.py", line 1, in <module>
    from deepface import DeepFace
  File "/home/vagrant/.local/lib/python3.6/site-packages/deepface/DeepFace.py", line 10, in <module>
    import cv2
ModuleNotFoundError: No module named 'cv2'

I think, though it is specified in requirements.txt, it doesn't install well. I got same error on windows 10 too.

Curiosity about vgg_face_weights.h5

For each model I ran a specific file was downloaded, for example vgg_face_weights.h5, VGGFace2_DeepFace_weights_val-0.9034.h5.zip, facenet_weights.h5, etc ...
What are these files for?
Do I need to update them?

Sorry, I'm new to this area, I don't have any knowledge.
Thanks again.

The view function did not return a valid response. The return type must be a string, tuple, Response instance, or WSGI callable, but it was a dict.

i got this error when use api.py :

File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1974, in make_response
    rv = self.response_class.force_type(rv, request.environ)
  File "/usr/local/lib/python3.6/dist-packages/werkzeug/wrappers.py", line 921, in force_type
    response = BaseResponse(*_run_wsgi_app(response, environ))
  File "/usr/local/lib/python3.6/dist-packages/werkzeug/wrappers.py", line 59, in _run_wsgi_app
    return _run_wsgi_app(*args)
  File "/usr/local/lib/python3.6/dist-packages/werkzeug/test.py", line 923, in run_wsgi_app
    app_rv = app(environ, start_response)
TypeError: 'dict' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1816, in full_dispatch_request
    return self.finalize_request(rv)
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1831, in finalize_request
    response = self.make_response(rv)
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1982, in make_response
    reraise(TypeError, new_error, sys.exc_info()[2])
  File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 34, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1974, in make_response
    rv = self.response_class.force_type(rv, request.environ)
  File "/usr/local/lib/python3.6/dist-packages/werkzeug/wrappers.py", line 921, in force_type
    response = BaseResponse(*_run_wsgi_app(response, environ))
  File "/usr/local/lib/python3.6/dist-packages/werkzeug/wrappers.py", line 59, in _run_wsgi_app
    return _run_wsgi_app(*args)
  File "/usr/local/lib/python3.6/dist-packages/werkzeug/test.py", line 923, in run_wsgi_app
    app_rv = app(environ, start_response)
TypeError: 'dict' object is not callable
The view function did not return a valid response. The return type must be a string, tuple, Response instance, or WSGI callable, but it was a dict.

the data i post to api is default from postman collection on this github, any clue ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.