fix Auto focal point crop for opencv >= 4.8.x

autocrop.download_and_cache_models
in opencv >= 4.8 the face detection model was updated
download the base on opencv version
returns the model path or raise exception
This commit is contained in:
w-e-w
2023-11-27 17:26:16 +09:00
parent f0f100e67b
commit 03ee297aa2
2 changed files with 18 additions and 15 deletions

View File

@@ -3,7 +3,7 @@ from PIL import Image, ImageOps
import math
import tqdm
from modules import paths, shared, images, deepbooru
from modules import shared, images, deepbooru
from modules.textual_inversion import autocrop
@@ -196,7 +196,7 @@ def preprocess_work(process_src, process_dst, process_width, process_height, pre
dnn_model_path = None
try:
dnn_model_path = autocrop.download_and_cache_models(os.path.join(paths.models_path, "opencv"))
dnn_model_path = autocrop.download_and_cache_models()
except Exception as e:
print("Unable to load face detection model for auto crop selection. Falling back to lower quality haar method.", e)