ultralytics 8.1.44 add IS_RASPBERRYPI and constants refactor (#9827)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
3f34a7c3af
commit
7d891a4aa4
43 changed files with 146 additions and 141 deletions
|
|
@ -1,19 +1,14 @@
|
|||
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
||||
|
||||
from .base import BaseDataset
|
||||
from .build import (
|
||||
build_dataloader,
|
||||
build_yolo_dataset,
|
||||
build_grounding,
|
||||
load_inference_source,
|
||||
)
|
||||
from .build import build_dataloader, build_grounding, build_yolo_dataset, load_inference_source
|
||||
from .dataset import (
|
||||
ClassificationDataset,
|
||||
GroundingDataset,
|
||||
SemanticDataset,
|
||||
YOLOConcatDataset,
|
||||
YOLODataset,
|
||||
YOLOMultiModalDataset,
|
||||
GroundingDataset,
|
||||
YOLOConcatDataset,
|
||||
)
|
||||
|
||||
__all__ = (
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ from .utils import polygons2masks, polygons2masks_overlap
|
|||
|
||||
DEFAULT_MEAN = (0.0, 0.0, 0.0)
|
||||
DEFAULT_STD = (1.0, 1.0, 1.0)
|
||||
DEFAULT_CROP_FTACTION = 1.0
|
||||
DEFAULT_CROP_FRACTION = 1.0
|
||||
|
||||
|
||||
# TODO: we might need a BaseTransform to make all these augments be compatible with both classification and semantic
|
||||
|
|
@ -1134,7 +1134,7 @@ def classify_transforms(
|
|||
mean=DEFAULT_MEAN,
|
||||
std=DEFAULT_STD,
|
||||
interpolation=Image.BILINEAR,
|
||||
crop_fraction: float = DEFAULT_CROP_FTACTION,
|
||||
crop_fraction: float = DEFAULT_CROP_FRACTION,
|
||||
):
|
||||
"""
|
||||
Classification transforms for evaluation/inference. Inspired by timm/data/transforms_factory.py.
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import psutil
|
|||
from torch.utils.data import Dataset
|
||||
|
||||
from ultralytics.utils import DEFAULT_CFG, LOCAL_RANK, LOGGER, NUM_THREADS, TQDM
|
||||
from .utils import HELP_URL, FORMATS_HELP_MSG, IMG_FORMATS
|
||||
from .utils import FORMATS_HELP_MSG, HELP_URL, IMG_FORMATS
|
||||
|
||||
|
||||
class BaseDataset(Dataset):
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ from ultralytics.data.loaders import (
|
|||
from ultralytics.data.utils import IMG_FORMATS, VID_FORMATS
|
||||
from ultralytics.utils import RANK, colorstr
|
||||
from ultralytics.utils.checks import check_file
|
||||
from .dataset import YOLODataset, YOLOMultiModalDataset, GroundingDataset
|
||||
from .dataset import GroundingDataset, YOLODataset, YOLOMultiModalDataset
|
||||
from .utils import PIN_MEMORY
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -519,12 +519,13 @@ def yolo_bbox2segment(im_dir, save_dir=None, sam_model="sam_b.pt"):
|
|||
├─ ..
|
||||
└─ NNN.txt
|
||||
"""
|
||||
from ultralytics.data import YOLODataset
|
||||
from ultralytics.utils.ops import xywh2xyxy
|
||||
from ultralytics.utils import LOGGER
|
||||
from ultralytics import SAM
|
||||
from tqdm import tqdm
|
||||
|
||||
from ultralytics import SAM
|
||||
from ultralytics.data import YOLODataset
|
||||
from ultralytics.utils import LOGGER
|
||||
from ultralytics.utils.ops import xywh2xyxy
|
||||
|
||||
# NOTE: add placeholder to pass class index check
|
||||
dataset = YOLODataset(im_dir, data=dict(names=list(range(1000))))
|
||||
if len(dataset.labels[0]["segments"]) > 0: # if it's segment data
|
||||
|
|
|
|||
|
|
@ -30,10 +30,10 @@ from .utils import (
|
|||
LOGGER,
|
||||
get_hash,
|
||||
img2label_paths,
|
||||
verify_image,
|
||||
verify_image_label,
|
||||
load_dataset_cache_file,
|
||||
save_dataset_cache_file,
|
||||
verify_image,
|
||||
verify_image_label,
|
||||
)
|
||||
|
||||
# Ultralytics dataset *.cache version, >= 1.0.0 for YOLOv8
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ from ultralytics.data.augment import Format
|
|||
from ultralytics.data.dataset import YOLODataset
|
||||
from ultralytics.data.utils import check_det_dataset
|
||||
from ultralytics.models.yolo.model import YOLO
|
||||
from ultralytics.utils import LOGGER, IterableSimpleNamespace, checks, USER_CONFIG_DIR
|
||||
from ultralytics.utils import LOGGER, USER_CONFIG_DIR, IterableSimpleNamespace, checks
|
||||
from .utils import get_sim_index_schema, get_table_schema, plot_query_result, prompt_sql_query, sanitize_batch
|
||||
|
||||
|
||||
|
|
@ -203,7 +203,8 @@ class Explorer:
|
|||
table = self.table.to_arrow() # noqa NOTE: Don't comment this. This line is used by DuckDB
|
||||
if not query.startswith("SELECT") and not query.startswith("WHERE"):
|
||||
raise ValueError(
|
||||
f"Query must start with SELECT or WHERE. You can either pass the entire query or just the WHERE clause. found {query}"
|
||||
f"Query must start with SELECT or WHERE. You can either pass the entire query or just the WHERE "
|
||||
f"clause. found {query}"
|
||||
)
|
||||
if query.startswith("WHERE"):
|
||||
query = f"SELECT * FROM 'table' {query}"
|
||||
|
|
@ -318,13 +319,13 @@ class Explorer:
|
|||
|
||||
Args:
|
||||
max_dist (float): maximum L2 distance between the embeddings to consider. Defaults to 0.2.
|
||||
top_k (float): Percentage of the closest data points to consider when counting. Used to apply limit when running
|
||||
top_k (float): Percentage of the closest data points to consider when counting. Used to apply limit.
|
||||
vector search. Defaults: None.
|
||||
force (bool): Whether to overwrite the existing similarity index or not. Defaults to True.
|
||||
|
||||
Returns:
|
||||
(pandas.DataFrame): A dataframe containing the similarity index. Each row corresponds to an image, and columns
|
||||
include indices of similar images and their respective distances.
|
||||
(pandas.DataFrame): A dataframe containing the similarity index. Each row corresponds to an image,
|
||||
and columns include indices of similar images and their respective distances.
|
||||
|
||||
Example:
|
||||
```python
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ import requests
|
|||
import torch
|
||||
from PIL import Image
|
||||
|
||||
from ultralytics.data.utils import IMG_FORMATS, VID_FORMATS, FORMATS_HELP_MSG
|
||||
from ultralytics.utils import LOGGER, is_colab, is_kaggle, ops
|
||||
from ultralytics.data.utils import FORMATS_HELP_MSG, IMG_FORMATS, VID_FORMATS
|
||||
from ultralytics.utils import IS_COLAB, IS_KAGGLE, LOGGER, ops
|
||||
from ultralytics.utils.checks import check_requirements
|
||||
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ class LoadStreams:
|
|||
# YouTube format i.e. 'https://www.youtube.com/watch?v=Zgi9g1ksQHc' or 'https://youtu.be/LNwODJXcvt4'
|
||||
s = get_best_youtube_url(s)
|
||||
s = eval(s) if s.isnumeric() else s # i.e. s = '0' local webcam
|
||||
if s == 0 and (is_colab() or is_kaggle()):
|
||||
if s == 0 and (IS_COLAB or IS_KAGGLE):
|
||||
raise NotImplementedError(
|
||||
"'source=0' webcam not supported in Colab and Kaggle notebooks. "
|
||||
"Try running 'source=0' in a local environment."
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ from ultralytics.utils import (
|
|||
clean_url,
|
||||
colorstr,
|
||||
emojis,
|
||||
is_dir_writeable,
|
||||
yaml_load,
|
||||
yaml_save,
|
||||
is_dir_writeable,
|
||||
)
|
||||
from ultralytics.utils.checks import check_file, check_font, is_ascii
|
||||
from ultralytics.utils.downloads import download, safe_download, unzip_file
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue