Make facedetection models load from comfyui models

This commit is contained in:
Momilijaz96
2023-10-19 08:13:17 +00:00
committed by SameetAsadullah
parent 1088dbdcb4
commit 45ebbe5eb0
3 changed files with 11 additions and 3 deletions
+3 -2
View File
@@ -15,10 +15,11 @@ from custom_nodes.facerestore_cf.basicsr.utils.registry import ARCH_REGISTRY
# import codeformer_arch
dir_facerestore_models = os.path.join(folder_paths.models_dir, "facerestore_models")
dir_facedetection = os.path.join(folder_paths.models_dir, "facedetection")
dir_facedetection_models = os.path.join(folder_paths.models_dir, "facedetection")
os.makedirs(dir_facerestore_models, exist_ok=True)
os.makedirs(dir_facedetection, exist_ok=True)
os.makedirs(dir_facedetection_models, exist_ok=True)
folder_paths.folder_names_and_paths["facerestore_models"] = ([dir_facerestore_models], folder_paths.supported_pt_extensions)
folder_paths.folder_names_and_paths["facedetection_models"] = ([dir_facedetection_models], folder_paths.supported_pt_extensions)
def img2tensor(imgs, bgr2rgb=True, float32=True):
"""Numpy array to tensor.
@@ -17,7 +17,7 @@ from custom_nodes.facerestore_cf.facelib.detection.yolov5face.utils.general impo
scale_coords_landmarks,
)
IS_HIGH_VERSION = tuple(map(int, torch.__version__.split('+')[0].split('.'))) >= (1, 9, 0)
IS_HIGH_VERSION = True
def isListempty(inList):
+7
View File
@@ -4,6 +4,8 @@ import os.path as osp
import torch
from torch.hub import download_url_to_file, get_dir
from urllib.parse import urlparse
import folder_paths
# from custom_nodes.facerestore_cf.basicsr.utils.download_util import download_file_from_google_drive
#import gdown
@@ -96,6 +98,11 @@ def load_file_from_url(url, model_dir=None, progress=True, file_name=None):
filename = os.path.basename(parts.path)
if file_name is not None:
filename = file_name
model_path = folder_paths.get_full_path("facedetection_models", filename)
if model_path:
return model_path
cached_file = os.path.abspath(os.path.join(ROOT_DIR, model_dir, filename))
if not os.path.exists(cached_file):
print(f'Downloading: "{url}" to {cached_file}\n')