diff --git a/README.md b/README.md index e2c7528..f4f2ba2 100644 --- a/README.md +++ b/README.md @@ -26,20 +26,11 @@ Put all wildcards files in */wildcards* dir. Use *Install from URL* option with this repo url. ### Requirements - -- openmim==0.3.5 -- mmcv-full==1.7.1 -- mmdet==2.27.0 -- lightning-utilities==0.4.0 -- pytorch-lightning==1.7.6 - dlib==19.24.0 - setuptools +- cmake -All requirements will be installed on first use, except for: - - [cmake](https://cmake.org/download/) - used only for dlib masks - -**NOTE:** Some of these packages are incompatible with newer versions of **lightning-utilities** and **pytorch-lightning**. If some other extensions you use require newer versions, they will be incompatible with this extension. - +All requirements will be installed on first use. ### Mask types @@ -47,8 +38,6 @@ All requirements will be installed on first use, except for: 2. Face dlib 3. Face depthmask 4. Body depthmask -5. Face mmdet -6. Body mmdet ### Examples @@ -56,4 +45,4 @@ All requirements will be installed on first use, except for: ### Contributing -Feel free to submit PRs to develop! \ No newline at end of file +Feel free to submit PRs to develop! diff --git a/install.py b/install.py index fa10a54..cb8b545 100644 --- a/install.py +++ b/install.py @@ -7,8 +7,10 @@ from modules.sd_models import model_hash from modules import modelloader 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"]) @@ -37,30 +39,34 @@ def list_models(model_path): python = sys.executable -run(f'"{python}" -m pip install lightning-utilities==0.4.0', desc=None, errdesc=f"Couldn't install lightning-utilities") -run(f'"{python}" -m pip install pytorch-lightning==1.7.6', desc=None, errdesc=f"Couldn't install pytorch-lightning") +if include_mmdet: + run(f'"{python}" -m pip install lightning-utilities==0.4.0', desc=None, errdesc=f"Couldn't install lightning-utilities") + run(f'"{python}" -m pip install pytorch-lightning==1.7.6', desc=None, errdesc=f"Couldn't install pytorch-lightning") if not is_installed("cmake"): run(f'"{python}" -m pip install cmake', desc="Installing cmake", errdesc="Couldn't install cmake") -if not is_installed("dlib"): +if not is_installed("setuptools"): run(f'"{python}" -m pip install setuptools', desc="Installing setuptools", errdesc="Couldn't install setuptools") + +if not is_installed("dlib"): try: run(f'"{python}" -m pip install dlib==19.24.0', desc="Installing dlib", errdesc="Couldn't install dlib") except Exception as e: - print("----------------------------------------") + print(e) + print("----------------------------------------------") print("Failed building wheel for dlib") print("ERROR: CMake must be installed to build dlib") print("Install cmake from https://cmake.org/download/") - print("----------------------------------------") + print("----------------------------------------------") -if not is_installed("mmdet"): - run(f'"{python}" -m pip install openmim==0.3.5', desc="Installing openmim", errdesc="Couldn't install openmim") +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 (len(list_models(dd_models_path)) == 0): +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") diff --git a/scripts/eyemask/mask_generator.py b/scripts/eyemask/mask_generator.py index 6d604cc..f534620 100644 --- a/scripts/eyemask/mask_generator.py +++ b/scripts/eyemask/mask_generator.py @@ -7,7 +7,12 @@ import numpy as np from PIL import Image, ImageDraw from .constants import script_models_dir from .utils import expand_polygon, calculate_distance -from .modules import depthmap, mmdetdd +from .modules import depthmap + +try: + from .modules import mmdetdd +except Exception as e: + pass depthmap_generator = depthmap.SimpleDepthMapGenerator() diff --git a/scripts/eyemask/script.py b/scripts/eyemask/script.py index d902e33..019427d 100644 --- a/scripts/eyemask/script.py +++ b/scripts/eyemask/script.py @@ -16,8 +16,8 @@ class EyeMasksCore(): 'Face dlib', 'Face depth', 'Body depth', - 'Face mmdet', - 'Body mmdet' + # 'Face mmdet', + # 'Body mmdet' ] MASK_TYPE_EYES_DLIB = utils.index(MASK_TYPES, 'Eyes dlib') diff --git a/static/images/mask-types-all.jpg b/static/images/mask-types-all.jpg new file mode 100644 index 0000000..749c5fa Binary files /dev/null and b/static/images/mask-types-all.jpg differ diff --git a/static/images/mask-types.jpg b/static/images/mask-types.jpg index 749c5fa..228e9bc 100644 Binary files a/static/images/mask-types.jpg and b/static/images/mask-types.jpg differ