handle opencv variants

Signed-off-by: Vladimir Mandic <mandic00@live.com>
pull/4312/head
Vladimir Mandic 2025-10-25 09:38:26 -04:00
parent 4ecec822e0
commit 10bbbed218
2 changed files with 12 additions and 1 deletions

View File

@ -1261,6 +1261,13 @@ def install_pydantic():
reload('pydantic', '1.10.21')
def install_opencv():
install('opencv-python-headless==4.12.0.88', ignore=True, quiet=True)
install('opencv-python==4.12.0.88', ignore=True, quiet=True)
install('opencv-contrib-python==4.12.0.88', ignore=True, quiet=True)
install('opencv-contrib-python-headless==4.12.0.88', ignore=True, quiet=True)
def install_insightface():
install('git+https://github.com/deepinsight/insightface@29b6cd65aa0e9ae3b6602de3c52e9d8949c8ee86#subdirectory=python-package', 'insightface') # insightface==0.7.3 with patches
if args.new:
@ -1329,6 +1336,7 @@ def install_requirements():
if not installed(line, quiet=True):
_res = install(line)
install_pydantic()
install_opencv()
if args.profile:
pr.disable()
print_profile(pr, 'Requirements')

View File

@ -155,6 +155,9 @@ from PIL import Image # pylint: disable=W0611,C0411
timer.startup.record("pillow")
import cv2 # pylint: disable=W0611,C0411
timer.startup.record("cv2")
class _tqdm_cls():
def __call__(self, *args, **kwargs):
bar_format = 'Progress {rate_fmt}{postfix} {bar} {percentage:3.0f}% {n_fmt}/{total_fmt} {elapsed} {remaining} ' + '\x1b[38;5;71m' + '{desc}' + '\x1b[0m'
@ -225,4 +228,4 @@ class VersionString(str): # support both string and tuple for version check
torch.__version__ = VersionString(torch.__version__)
errors.log.info(f'Torch: torch=={torch.__version__} torchvision=={torchvision.__version__}')
errors.log.info(f'Packages: diffusers=={diffusers.__version__} transformers=={transformers.__version__} accelerate=={accelerate.__version__} gradio=={gradio.__version__} pydantic=={pydantic.__version__} numpy=={np.__version__}')
errors.log.info(f'Packages: diffusers=={diffusers.__version__} transformers=={transformers.__version__} accelerate=={accelerate.__version__} gradio=={gradio.__version__} pydantic=={pydantic.__version__} numpy=={np.__version__} cv2=={cv2.__version__}')