mirror of
https://github.com/Bing-su/adetailer.git
synced 2026-01-26 19:29:54 +00:00
fix: pkg version, YOLO load
This commit is contained in:
@@ -1 +1 @@
|
||||
__version__ = "23.7.10"
|
||||
__version__ = "23.8.0.dev0"
|
||||
|
||||
@@ -11,24 +11,13 @@ from adetailer import PredictOutput
|
||||
from adetailer.common import create_mask_from_bbox
|
||||
|
||||
|
||||
def load_yolo(model_path: str | Path):
|
||||
try:
|
||||
return YOLO(model_path)
|
||||
except ModuleNotFoundError:
|
||||
# https://github.com/ultralytics/ultralytics/issues/3856
|
||||
YOLO("yolov8n.pt")
|
||||
return YOLO(model_path)
|
||||
|
||||
|
||||
def ultralytics_predict(
|
||||
model_path: str | Path,
|
||||
image: Image.Image,
|
||||
confidence: float = 0.3,
|
||||
device: str = "",
|
||||
) -> PredictOutput:
|
||||
model_path = str(model_path)
|
||||
|
||||
model = load_yolo(model_path)
|
||||
model = YOLO(model_path)
|
||||
pred = model(image, conf=confidence, device=device)
|
||||
|
||||
bboxes = pred[0].boxes.xyxy.cpu().numpy()
|
||||
|
||||
@@ -44,8 +44,8 @@ def run_pip(*args):
|
||||
def install():
|
||||
deps = [
|
||||
# requirements
|
||||
("ultralytics", "8.0.97", None),
|
||||
("mediapipe", "0.10.0", None),
|
||||
("ultralytics", "8.0.143", None),
|
||||
("mediapipe", "0.10.2", None),
|
||||
("rich", "13.4.2", None),
|
||||
# ultralytics
|
||||
("py-cpuinfo", None, None),
|
||||
|
||||
Reference in New Issue
Block a user