Merge branch 'dev' into main

This commit is contained in:
Bingsu
2023-09-20 00:35:27 +09:00
6 changed files with 19 additions and 7 deletions

View File

@@ -8,12 +8,12 @@ repos:
- id: mixed-line-ending
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.287"
rev: "v0.0.290"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.0
rev: 23.9.1
hooks:
- id: black

View File

@@ -1,5 +1,11 @@
# Changelog
## 2023-09-20
- v23.9.3
- ultralytics 버전 8.0.181로 업데이트 (https://github.com/ultralytics/ultralytics/pull/4891)
- mediapipe와 ultralytics의 lazy import
## 2023-09-10
- v23.9.2

View File

@@ -1 +1 @@
__version__ = "23.9.2"
__version__ = "23.9.3"

View File

@@ -2,7 +2,6 @@ from __future__ import annotations
from functools import partial
import mediapipe as mp
import numpy as np
from PIL import Image, ImageDraw
@@ -29,6 +28,8 @@ def mediapipe_predict(
def mediapipe_face_detection(
model_type: int, image: Image.Image, confidence: float = 0.3
) -> PredictOutput:
import mediapipe as mp
img_width, img_height = image.size
mp_face_detection = mp.solutions.face_detection
@@ -84,6 +85,8 @@ def get_convexhull(points: np.ndarray) -> list[tuple[int, int]]:
def mediapipe_face_mesh(image: Image.Image, confidence: float = 0.3) -> PredictOutput:
import mediapipe as mp
mp_face_mesh = mp.solutions.face_mesh
draw_util = mp.solutions.drawing_utils
drawing_styles = mp.solutions.drawing_styles
@@ -127,6 +130,8 @@ def mediapipe_face_mesh(image: Image.Image, confidence: float = 0.3) -> PredictO
def mediapipe_face_mesh_eyes_only(
image: Image.Image, confidence: float = 0.3
) -> PredictOutput:
import mediapipe as mp
mp_face_mesh = mp.solutions.face_mesh
left_idx = np.array(list(mp_face_mesh.FACEMESH_LEFT_EYE)).flatten()

View File

@@ -5,7 +5,6 @@ from pathlib import Path
import cv2
from PIL import Image
from torchvision.transforms.functional import to_pil_image
from ultralytics import YOLO
from adetailer import PredictOutput
from adetailer.common import create_mask_from_bbox
@@ -17,6 +16,8 @@ def ultralytics_predict(
confidence: float = 0.3,
device: str = "",
) -> PredictOutput:
from ultralytics import YOLO
model = YOLO(model_path)
pred = model(image, conf=confidence, device=device)

View File

@@ -44,8 +44,8 @@ def run_pip(*args):
def install():
deps = [
# requirements
("ultralytics", "8.0.173", None),
("mediapipe", "0.10.3", None),
("ultralytics", "8.0.181", None),
("mediapipe", "0.10.5", None),
("rich", "13.0.0", None),
# mediapipe
("protobuf", "3.20", "3.9999"),