Spaces:
Build error
Build error
Commit
Β·
9efc67a
1
Parent(s):
572ea36
restructured face_detection and face_rec folders and changed padding color to black
Browse files- app/__init__.py +7 -8
- app/api/routes.py +1 -1
- {app/face_detection β face_detection}/Models/v1/anchors.txt +0 -0
- {app/face_detection β face_detection}/Models/v1/model.h5 +0 -0
- {app/face_detection β face_detection}/config.py +0 -0
- {app/face_detection β face_detection}/create_load_model.py +1 -1
- {app/face_detection β face_detection}/decode_yolo_v2.py +1 -1
- {app/face_detection β face_detection}/helper.py +3 -2
- {app/face_detection β face_detection}/inference.py +4 -4
- {app/face_recognition β face_recognition}/Models/v1/config.py +0 -0
- {app/face_recognition β face_recognition}/Models/v1/model.h5 +0 -0
- {app/face_recognition β face_recognition}/aligner.py +0 -0
- {app/face_recognition β face_recognition}/config.py +0 -0
- {app/face_recognition β face_recognition}/helper.py +0 -0
- {app/face_recognition β face_recognition}/inference.py +2 -2
- {app/face_recognition β face_recognition}/setup_db_features.py +0 -0
- {app/face_recognition β face_recognition}/split_model.py +0 -0
app/__init__.py
CHANGED
|
@@ -1,18 +1,17 @@
|
|
| 1 |
from flask import Flask,session
|
| 2 |
from datetime import timedelta
|
| 3 |
|
| 4 |
-
from
|
| 5 |
-
from
|
| 6 |
-
from
|
| 7 |
-
from
|
| 8 |
-
from
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
-
face_detector=fd.face_detection("
|
| 13 |
face_detector.square_preprocessing=fd.square_pad()
|
| 14 |
-
|
| 15 |
-
face_recognizer=fr.face_recognition("app/face_recognition/Models/v1")
|
| 16 |
aligner_obj=aligner(min_aligner_confidence=0.6)
|
| 17 |
|
| 18 |
image_size=544
|
|
|
|
| 1 |
from flask import Flask,session
|
| 2 |
from datetime import timedelta
|
| 3 |
|
| 4 |
+
from face_detection import inference as fd
|
| 5 |
+
from face_detection.helper import get_crops as fd_get_crops
|
| 6 |
+
from face_recognition import inference as fr
|
| 7 |
+
from face_recognition.aligner import aligner
|
| 8 |
+
from face_recognition import helper as fr_helper
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
+
face_detector=fd.face_detection("face_detection/Models/v1")
|
| 13 |
face_detector.square_preprocessing=fd.square_pad()
|
| 14 |
+
face_recognizer=fr.face_recognition("face_recognition/Models/v1")
|
|
|
|
| 15 |
aligner_obj=aligner(min_aligner_confidence=0.6)
|
| 16 |
|
| 17 |
image_size=544
|
app/api/routes.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from flask import request,jsonify,g
|
| 2 |
from app.api import bp
|
| 3 |
from app.helper import generate_random_id,access_database_as_admin,image_to_base64,base64_to_image,add_row_user_table,read_row_user_table,read_user_table,remove_person_from_user_table
|
| 4 |
from PIL import ImageOps,Image
|
|
|
|
| 1 |
+
from flask import request,jsonify,g,session
|
| 2 |
from app.api import bp
|
| 3 |
from app.helper import generate_random_id,access_database_as_admin,image_to_base64,base64_to_image,add_row_user_table,read_row_user_table,read_user_table,remove_person_from_user_table
|
| 4 |
from PIL import ImageOps,Image
|
{app/face_detection β face_detection}/Models/v1/anchors.txt
RENAMED
|
File without changes
|
{app/face_detection β face_detection}/Models/v1/model.h5
RENAMED
|
File without changes
|
{app/face_detection β face_detection}/config.py
RENAMED
|
File without changes
|
{app/face_detection β face_detection}/create_load_model.py
RENAMED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import os
|
| 2 |
import tensorflow as tf
|
| 3 |
from tensorflow.keras import Model,layers
|
| 4 |
-
from
|
| 5 |
|
| 6 |
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
|
| 7 |
# custom layer for reshaping last layer
|
|
|
|
| 1 |
import os
|
| 2 |
import tensorflow as tf
|
| 3 |
from tensorflow.keras import Model,layers
|
| 4 |
+
from face_detection.config import class_names
|
| 5 |
|
| 6 |
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
|
| 7 |
# custom layer for reshaping last layer
|
{app/face_detection β face_detection}/decode_yolo_v2.py
RENAMED
|
@@ -4,7 +4,7 @@ from matplotlib.patches import Rectangle
|
|
| 4 |
import copy
|
| 5 |
import tensorflow.keras.backend as K
|
| 6 |
import cv2
|
| 7 |
-
from
|
| 8 |
|
| 9 |
|
| 10 |
|
|
|
|
| 4 |
import copy
|
| 5 |
import tensorflow.keras.backend as K
|
| 6 |
import cv2
|
| 7 |
+
from face_detection.config import cell_size,idx_to_class,class_to_idx,class_colors
|
| 8 |
|
| 9 |
|
| 10 |
|
{app/face_detection β face_detection}/helper.py
RENAMED
|
@@ -1,9 +1,10 @@
|
|
| 1 |
import cv2
|
| 2 |
import numpy as np
|
| 3 |
-
from
|
| 4 |
|
| 5 |
|
| 6 |
-
square_maker=square_pad(color=(255,255,255))
|
|
|
|
| 7 |
def get_crops(img,objs_found,aligner=None,resize:tuple=None):
|
| 8 |
img_h,img_w,_=img.shape
|
| 9 |
all_crops=[]
|
|
|
|
| 1 |
import cv2
|
| 2 |
import numpy as np
|
| 3 |
+
from face_detection.inference import square_pad
|
| 4 |
|
| 5 |
|
| 6 |
+
# square_maker=square_pad(color=(255,255,255))
|
| 7 |
+
square_maker=square_pad(color=(0,0,0))
|
| 8 |
def get_crops(img,objs_found,aligner=None,resize:tuple=None):
|
| 9 |
img_h,img_w,_=img.shape
|
| 10 |
all_crops=[]
|
{app/face_detection β face_detection}/inference.py
RENAMED
|
@@ -277,7 +277,7 @@ if __name__=="__main__":
|
|
| 277 |
plt.show()
|
| 278 |
# cv2.imwrite("test_output.jpg",pred_img[:,:,::-1])
|
| 279 |
else:
|
| 280 |
-
import
|
| 281 |
-
import
|
| 282 |
-
from
|
| 283 |
-
from
|
|
|
|
| 277 |
plt.show()
|
| 278 |
# cv2.imwrite("test_output.jpg",pred_img[:,:,::-1])
|
| 279 |
else:
|
| 280 |
+
import face_detection.create_load_model as load_model_lib
|
| 281 |
+
import face_detection.decode_yolo_v2 as decode_model_lib
|
| 282 |
+
from face_detection.create_load_model import *
|
| 283 |
+
from face_detection.decode_yolo_v2 import *
|
{app/face_recognition β face_recognition}/Models/v1/config.py
RENAMED
|
File without changes
|
{app/face_recognition β face_recognition}/Models/v1/model.h5
RENAMED
|
File without changes
|
{app/face_recognition β face_recognition}/aligner.py
RENAMED
|
File without changes
|
{app/face_recognition β face_recognition}/config.py
RENAMED
|
File without changes
|
{app/face_recognition β face_recognition}/helper.py
RENAMED
|
File without changes
|
{app/face_recognition β face_recognition}/inference.py
RENAMED
|
@@ -13,8 +13,8 @@ import importlib
|
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
-
from
|
| 17 |
-
from
|
| 18 |
|
| 19 |
|
| 20 |
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
+
from face_recognition import config
|
| 17 |
+
from face_recognition.aligner import aligner
|
| 18 |
|
| 19 |
|
| 20 |
|
{app/face_recognition β face_recognition}/setup_db_features.py
RENAMED
|
File without changes
|
{app/face_recognition β face_recognition}/split_model.py
RENAMED
|
File without changes
|