FIX: Face analysing SpeedUP
Return of the deepcopy method instead of an insightface model reloading each time
This commit is contained in:
parent
7ec7612001
commit
899db45f99
@ -1,4 +1,4 @@
|
||||
# Roop-GE 0.2.0 for StableDiffusion
|
||||
# Roop-GE 0.2.1 for StableDiffusion
|
||||
### NSFW (uncensored) version (use it on your own responsibility) of [original sd-webui-roop](https://github.com/s0md3v/sd-webui-roop) with a lot of improvements
|
||||
|
||||
> GE (Gourieff Edition), aka "NSFW-Roop"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
version_flag = "v0.2.0"
|
||||
version_flag = "v0.2.1"
|
||||
|
||||
from scripts.roop_logging import logger
|
||||
|
||||
|
||||
@ -50,6 +50,17 @@ def cosine_similarity(test_vec: np.ndarray, source_vecs: List[np.ndarray]) -> fl
|
||||
FS_MODEL = None
|
||||
CURRENT_FS_MODEL_PATH = None
|
||||
|
||||
ANALYSIS_MODEL = None
|
||||
|
||||
|
||||
def getAnalysisModel():
|
||||
global ANALYSIS_MODEL
|
||||
if ANALYSIS_MODEL is None:
|
||||
ANALYSIS_MODEL = insightface.app.FaceAnalysis(
|
||||
name="buffalo_l", providers=providers
|
||||
)
|
||||
return ANALYSIS_MODEL
|
||||
|
||||
|
||||
def getFaceSwapModel(model_path: str):
|
||||
global FS_MODEL
|
||||
@ -116,7 +127,7 @@ def upscale_image(image: Image, upscale_options: UpscaleOptions):
|
||||
|
||||
|
||||
def get_face_single(img_data: np.ndarray, face_index=0, det_size=(640, 640)):
|
||||
face_analyser = insightface.app.FaceAnalysis(name="buffalo_l", providers=providers)
|
||||
face_analyser = copy.deepcopy(getAnalysisModel())
|
||||
face_analyser.prepare(ctx_id=0, det_size=det_size)
|
||||
face = face_analyser.get(img_data)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user