Visualyticai / DigitalOnboard_Spoof

0 stars 0 forks source link

Review changes for DOT-1 please update changes in DOT-6 #1

Open visualyticsai opened 3 years ago

visualyticsai commented 3 years ago

1) test image 57 does not exists 2) no module named sklearn 3) create separate folder for tests 4) class check_reality class name should be capatalized 5) Never use simple prints use loggings type prints in production codes 6) No need of below route

@app.route('/')
def index():
    return "Default Message"

7) change route "video_feed" to more realistic name 8) default key for images must be "frame" for all APIs

9)running python test_api.py gives following error:

127.0.0.1 - - [05/Dec/2020 23:47:40] "POST /video_feed HTTP/1.1" 200 - 127.0.0.1 - - [05/Dec/2020 23:47:40] "POST /video_feed HTTP/1.1" 500 - Traceback (most recent call last): File "/root/anaconda3/envs/spoof/lib/python3.7/site-packages/flask/app.py", line 2464, in call return self.wsgi_app(environ, start_response) File "/root/anaconda3/envs/spoof/lib/python3.7/site-packages/flask/app.py", line 2450, in wsgi_app response = self.handle_exception(e) File "/root/anaconda3/envs/spoof/lib/python3.7/site-packages/flask/app.py", line 1867, in handle_exception reraise(exc_type, exc_value, tb) File "/root/anaconda3/envs/spoof/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise raise value File "/root/anaconda3/envs/spoof/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "/root/anaconda3/envs/spoof/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "/root/anaconda3/envs/spoof/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "/root/anaconda3/envs/spoof/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise raise value File "/root/anaconda3/envs/spoof/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "/root/anaconda3/envs/spoof/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request return self.view_functionsrule.endpoint File "/home/owais/Work/practise/ekyc/DigitalOnboard_Spoof/app.py", line 17, in video_feed temp = check_reality(frame).returnLabel() File "/home/owais/Work/practise/ekyc/DigitalOnboard_Spoof/Face_reality.py", line 77, in returnLabel face = cv2.resize(face, (32, 32)) cv2.error: OpenCV(4.4.0) /tmp/pip-req-build-cg56sov1/opencv/modules/imgproc/src/resize.cpp:3929: error: (-215:Assertion failed) !ssize.empty() in function 'resize'

D3nii commented 3 years ago

Sir, I have resolved most of the issues.

D3nii commented 3 years ago

The error you are getting is when I pass a fake image through the code and in order to get around this, I tried to use

try: frame = imutils.resize(frame, width=600) except: logging.warning("fake") return "", 403

But apparently, it is not working. Could you suggest to me something else?

I have also converted the image from RGBA to RGB.