diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py index 9c24e00c..0d72f48e 100644 --- a/ultralytics/__init__.py +++ b/ultralytics/__init__.py @@ -1,6 +1,6 @@ # Ultralytics YOLO 🚀, AGPL-3.0 license -__version__ = "8.1.18" +__version__ = "8.1.19" from ultralytics.data.explorer.explorer import Explorer from ultralytics.models import RTDETR, SAM, YOLO, YOLOWorld diff --git a/ultralytics/data/utils.py b/ultralytics/data/utils.py index be331bf3..1ce8127a 100644 --- a/ultralytics/data/utils.py +++ b/ultralytics/data/utils.py @@ -365,6 +365,9 @@ def check_cls_dataset(dataset, split=""): # Download (optional if dataset=https://file.zip is passed directly) if str(dataset).startswith(("http:/", "https:/")): dataset = safe_download(dataset, dir=DATASETS_DIR, unzip=True, delete=False) + elif Path(dataset).suffix in (".zip", ".tar", ".gz"): + file = check_file(dataset) + dataset = safe_download(file, dir=DATASETS_DIR, unzip=True, delete=False) dataset = Path(dataset) data_dir = (dataset if dataset.is_dir() else (DATASETS_DIR / dataset)).resolve() diff --git a/ultralytics/engine/exporter.py b/ultralytics/engine/exporter.py index 68892958..75f7a0f9 100644 --- a/ultralytics/engine/exporter.py +++ b/ultralytics/engine/exporter.py @@ -514,12 +514,12 @@ class Exporter: "https://github.com/pnnx/pnnx/.\nNote PNNX Binary file must be placed in current working directory " f"or in {ROOT}. See PNNX repo for full installation instructions." ) - system = ["macos"] if MACOS else ["windows"] if WINDOWS else ["ubuntu", "linux"] # operating system + system = "macos" if MACOS else "windows" if WINDOWS else "linux-aarch64" if ARM64 else "linux" try: _, assets = get_github_assets(repo="pnnx/pnnx", retry=True) - url = [x for x in assets if any(s in x for s in system)][0] + url = [x for x in assets if f"{system}.zip" in x][0] except Exception as e: - url = f"https://github.com/pnnx/pnnx/releases/download/20231127/pnnx-20231127-{system[0]}.zip" + url = f"https://github.com/pnnx/pnnx/releases/download/20240226/pnnx-20240226-{system}.zip" LOGGER.warning(f"{prefix} WARNING ⚠️ PNNX GitHub assets not found: {e}, using default {url}") asset = attempt_download_asset(url, repo="pnnx/pnnx", release="latest") if check_is_path_safe(Path.cwd(), asset): # avoid path traversal security vulnerability diff --git a/ultralytics/utils/ops.py b/ultralytics/utils/ops.py index 4a835160..fb346a96 100644 --- a/ultralytics/utils/ops.py +++ b/ultralytics/utils/ops.py @@ -638,7 +638,7 @@ def crop_mask(masks, boxes): Returns: (torch.Tensor): The masks are being cropped to the bounding box. """ - n, h, w = masks.shape + _, h, w = masks.shape x1, y1, x2, y2 = torch.chunk(boxes[:, :, None], 4, 1) # x1 shape(n,1,1) r = torch.arange(w, device=masks.device, dtype=x1.dtype)[None, None, :] # rows shape(1,1,w) c = torch.arange(h, device=masks.device, dtype=x1.dtype)[None, :, None] # cols shape(1,h,1) @@ -686,12 +686,14 @@ def process_mask(protos, masks_in, bboxes, shape, upsample=False): c, mh, mw = protos.shape # CHW ih, iw = shape masks = (masks_in @ protos.float().view(c, -1)).sigmoid().view(-1, mh, mw) # CHW + width_ratio = mw / iw + height_ratio = mh / ih downsampled_bboxes = bboxes.clone() - downsampled_bboxes[:, 0] *= mw / iw - downsampled_bboxes[:, 2] *= mw / iw - downsampled_bboxes[:, 3] *= mh / ih - downsampled_bboxes[:, 1] *= mh / ih + downsampled_bboxes[:, 0] *= width_ratio + downsampled_bboxes[:, 2] *= width_ratio + downsampled_bboxes[:, 3] *= height_ratio + downsampled_bboxes[:, 1] *= height_ratio masks = crop_mask(masks, downsampled_bboxes) # CHW if upsample: