Removed mmdet code

develop
ilian.iliev 2024-10-06 17:45:26 +03:00
parent 71366970a4
commit b5930abfe0
1 changed files with 0 additions and 50 deletions

View File

@ -3,46 +3,11 @@ import sys
from launch import is_installed, run, git_clone from launch import is_installed, run, git_clone
from modules.paths import models_path from modules.paths import models_path
from modules.sd_models import model_hash
from modules import modelloader from modules import modelloader
from basicsr.utils.download_util import load_file_from_url from basicsr.utils.download_util import load_file_from_url
include_mmdet = False
dd_models_path = os.path.join(models_path, "mmdet")
def list_models(model_path):
model_list = modelloader.load_models(model_path=model_path, ext_filter=[".pth"])
def modeltitle(path, shorthash):
abspath = os.path.abspath(path)
if abspath.startswith(model_path):
name = abspath.replace(model_path, '')
else:
name = os.path.basename(path)
if name.startswith("\\") or name.startswith("/"):
name = name[1:]
shortname = os.path.splitext(name.replace("/", "_").replace("\\", "_"))[0]
return f'{name} [{shorthash}]', shortname
models = []
for filename in model_list:
h = model_hash(filename)
title, short_model_name = modeltitle(filename, h)
models.append(title)
return models
python = sys.executable python = sys.executable
if include_mmdet:
run(f'"{python}" -m pip install lightning-utilities==0.11.2', desc=None, errdesc=f"Couldn't install lightning-utilities")
run(f'"{python}" -m pip install pytorch-lightning==2.2.4', desc=None, errdesc=f"Couldn't install pytorch-lightning")
if not is_installed("cmake"): if not is_installed("cmake"):
run(f'"{python}" -m pip install cmake', desc="Installing cmake", errdesc="Couldn't install cmake") run(f'"{python}" -m pip install cmake', desc="Installing cmake", errdesc="Couldn't install cmake")
@ -60,19 +25,4 @@ if not is_installed("dlib"):
print("Install cmake from https://cmake.org/download/") print("Install cmake from https://cmake.org/download/")
print("----------------------------------------------") print("----------------------------------------------")
if include_mmdet and not is_installed("mmdet"):
run(f'"{python}" -m pip install -U openmim==0.3.3', desc=None, errdesc="Couldn't install openmim")
run(f'"{python}" -m mim install mmcv-full==1.7.1', desc=f"Installing mmcv-full", errdesc=f"Couldn't install mmcv-full")
run(f'"{python}" -m pip install mmdet==2.27.0', desc=f"Installing mmdet", errdesc=f"Couldn't install mmdet")
if include_mmdet and (len(list_models(dd_models_path)) == 0):
print("No detection models found, downloading...")
bbox_path = os.path.join(dd_models_path, "bbox")
segm_path = os.path.join(dd_models_path, "segm")
load_file_from_url("https://huggingface.co/dustysys/ddetailer/resolve/main/mmdet/bbox/mmdet_anime-face_yolov3.pth", bbox_path)
load_file_from_url("https://huggingface.co/dustysys/ddetailer/raw/main/mmdet/bbox/mmdet_anime-face_yolov3.py", bbox_path)
load_file_from_url("https://huggingface.co/dustysys/ddetailer/resolve/main/mmdet/segm/mmdet_dd-person_mask2former.pth", segm_path)
load_file_from_url("https://huggingface.co/dustysys/ddetailer/raw/main/mmdet/segm/mmdet_dd-person_mask2former.py", segm_path)
git_clone("https://github.com/isl-org/MiDaS.git", "repositories/midas", "midas") git_clone("https://github.com/isl-org/MiDaS.git", "repositories/midas", "midas")