mirror of
https://github.com/serengil/deepface.git
synced 2025-06-09 12:57:08 +00:00
ignore tf2 warnings
This commit is contained in:
parent
45b4714f47
commit
b0f152ab31
@ -1,7 +1,11 @@
|
|||||||
import warnings
|
import warnings
|
||||||
warnings.filterwarnings("ignore")
|
warnings.filterwarnings("ignore")
|
||||||
import time
|
|
||||||
import os
|
import os
|
||||||
|
#os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
|
||||||
|
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
|
||||||
|
|
||||||
|
import time
|
||||||
from os import path
|
from os import path
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
@ -12,6 +16,12 @@ from deepface.basemodels import VGGFace, OpenFace, Facenet, FbDeepFace, DeepID,
|
|||||||
from deepface.extendedmodels import Age, Gender, Race, Emotion
|
from deepface.extendedmodels import Age, Gender, Race, Emotion
|
||||||
from deepface.commons import functions, realtime, distance as dst
|
from deepface.commons import functions, realtime, distance as dst
|
||||||
|
|
||||||
|
import tensorflow as tf
|
||||||
|
tf_version = int(tf.__version__.split(".")[0])
|
||||||
|
if tf_version == 2:
|
||||||
|
import logging
|
||||||
|
tf.get_logger().setLevel(logging.ERROR)
|
||||||
|
|
||||||
def build_model(model_name):
|
def build_model(model_name):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -720,11 +730,13 @@ def represent(img_path, model_name = 'VGG-Face', model = None, enforce_detection
|
|||||||
#decide input shape
|
#decide input shape
|
||||||
input_shape = input_shape_x, input_shape_y= functions.find_input_shape(model)
|
input_shape = input_shape_x, input_shape_y= functions.find_input_shape(model)
|
||||||
|
|
||||||
|
#detect and align
|
||||||
img = functions.preprocess_face(img = img_path
|
img = functions.preprocess_face(img = img_path
|
||||||
, target_size=(input_shape_y, input_shape_x)
|
, target_size=(input_shape_y, input_shape_x)
|
||||||
, enforce_detection = enforce_detection
|
, enforce_detection = enforce_detection
|
||||||
, detector_backend = detector_backend)
|
, detector_backend = detector_backend)
|
||||||
|
|
||||||
|
#represent
|
||||||
embedding = model.predict(img)[0].tolist()
|
embedding = model.predict(img)[0].tolist()
|
||||||
|
|
||||||
return embedding
|
return embedding
|
||||||
|
Loading…
x
Reference in New Issue
Block a user