ultralytics 8.0.136 refactor and simplify package (#3748)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
8ebe94d1e9
commit
620f3eb218
383 changed files with 4213 additions and 4646 deletions
|
|
@ -16,10 +16,10 @@ import torch
|
|||
import torch.nn as nn
|
||||
from PIL import Image
|
||||
|
||||
from ultralytics.yolo.utils import ARM64, LINUX, LOGGER, ROOT, yaml_load
|
||||
from ultralytics.yolo.utils.checks import check_requirements, check_suffix, check_version, check_yaml
|
||||
from ultralytics.yolo.utils.downloads import attempt_download_asset, is_url
|
||||
from ultralytics.yolo.utils.ops import xywh2xyxy
|
||||
from ultralytics.utils import ARM64, LINUX, LOGGER, ROOT, yaml_load
|
||||
from ultralytics.utils.checks import check_requirements, check_suffix, check_version, check_yaml
|
||||
from ultralytics.utils.downloads import attempt_download_asset, is_url
|
||||
from ultralytics.utils.ops import xywh2xyxy
|
||||
|
||||
|
||||
def check_class_names(names):
|
||||
|
|
@ -34,7 +34,7 @@ def check_class_names(names):
|
|||
raise KeyError(f'{n}-class dataset requires class indices 0-{n - 1}, but you have invalid class indices '
|
||||
f'{min(names.keys())}-{max(names.keys())} defined in your dataset YAML.')
|
||||
if isinstance(names[0], str) and names[0].startswith('n0'): # imagenet class codes, i.e. 'n01440764'
|
||||
map = yaml_load(ROOT / 'datasets/ImageNet.yaml')['map'] # human-readable names
|
||||
map = yaml_load(ROOT / 'cfg/datasets/ImageNet.yaml')['map'] # human-readable names
|
||||
names = {k: map[v] for k, v in names.items()}
|
||||
return names
|
||||
|
||||
|
|
@ -210,7 +210,7 @@ class AutoBackend(nn.Module):
|
|||
LOGGER.info(f'Loading {w} for TensorFlow GraphDef inference...')
|
||||
import tensorflow as tf
|
||||
|
||||
from ultralytics.yolo.engine.exporter import gd_outputs
|
||||
from ultralytics.engine.exporter import gd_outputs
|
||||
|
||||
def wrap_frozen_graph(gd, inputs, outputs):
|
||||
"""Wrap frozen graphs for deployment."""
|
||||
|
|
@ -284,7 +284,7 @@ class AutoBackend(nn.Module):
|
|||
"""
|
||||
raise NotImplementedError('Triton Inference Server is not currently supported.')
|
||||
else:
|
||||
from ultralytics.yolo.engine.exporter import export_formats
|
||||
from ultralytics.engine.exporter import export_formats
|
||||
raise TypeError(f"model='{w}' is not a supported model format. "
|
||||
'See https://docs.ultralytics.com/modes/predict for help.'
|
||||
f'\n\n{export_formats()}')
|
||||
|
|
@ -476,7 +476,7 @@ class AutoBackend(nn.Module):
|
|||
"""
|
||||
# Return model type from model path, i.e. path='path/to/model.onnx' -> type=onnx
|
||||
# types = [pt, jit, onnx, xml, engine, coreml, saved_model, pb, tflite, edgetpu, tfjs, paddle]
|
||||
from ultralytics.yolo.engine.exporter import export_formats
|
||||
from ultralytics.engine.exporter import export_formats
|
||||
sf = list(export_formats().Suffix) # export suffixes
|
||||
if not is_url(p, check=False) and not isinstance(p, str):
|
||||
check_suffix(p, sf) # checks
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue