ultralytics 8.0.185 dependencies and tests fixes (#5046)

Co-authored-by: Zlobin Vladimir <vladimir.zlobin@intel.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Glenn Jocher 2023-09-24 17:17:04 +02:00 committed by GitHub
parent 92753ebd84
commit a9033118cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 149 additions and 23 deletions

View file

@ -1,6 +1,6 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license
__version__ = '8.0.184'
__version__ = '8.0.185'
from ultralytics.models import RTDETR, SAM, YOLO
from ultralytics.models.fastsam import FastSAM

View file

@ -571,8 +571,6 @@ class LetterBox:
if self.center:
dw /= 2 # divide padding into 2 sides
dh /= 2
if labels.get('ratio_pad'):
labels['ratio_pad'] = (labels['ratio_pad'], (dw, dh)) # for evaluation
if shape[::-1] != new_unpad: # resize
img = cv2.resize(img, new_unpad, interpolation=cv2.INTER_LINEAR)
@ -580,6 +578,8 @@ class LetterBox:
left, right = int(round(dw - 0.1)) if self.center else 0, int(round(dw + 0.1))
img = cv2.copyMakeBorder(img, top, bottom, left, right, cv2.BORDER_CONSTANT,
value=(114, 114, 114)) # add border
if labels.get('ratio_pad'):
labels['ratio_pad'] = (labels['ratio_pad'], (left, top)) # for evaluation
if len(labels):
labels = self._update_labels(labels, ratio, dw, dh)

View file

@ -507,7 +507,7 @@ class Exporter:
def export_coreml(self, prefix=colorstr('CoreML:')):
"""YOLOv8 CoreML export."""
mlmodel = self.args.format.lower() == 'mlmodel' # legacy *.mlmodel export format requested
check_requirements('coremltools>=6.0,<=6.2' if mlmodel else 'coremltools>=7.0.b1')
check_requirements('coremltools>=6.0,<=6.2' if mlmodel else 'coremltools>=7.0')
import coremltools as ct # noqa
LOGGER.info(f'\n{prefix} starting export with coremltools {ct.__version__}...')
@ -648,7 +648,7 @@ class Exporter:
check_requirements(f"tensorflow{'-macos' if MACOS else '-aarch64' if ARM64 else '' if cuda else '-cpu'}")
import tensorflow as tf # noqa
check_requirements(
('onnx', 'onnx2tf>=1.15.4', 'sng4onnx>=1.0.1', 'onnxsim>=0.4.33', 'onnx_graphsurgeon>=0.3.26',
('onnx', 'onnx2tf>=1.15.4,<=1.17.5', 'sng4onnx>=1.0.1', 'onnxsim>=0.4.33', 'onnx_graphsurgeon>=0.3.26',
'tflite_support', 'onnxruntime-gpu' if cuda else 'onnxruntime'),
cmds='--extra-index-url https://pypi.ngc.nvidia.com') # onnx_graphsurgeon only on NVIDIA

View file

@ -61,9 +61,7 @@ def parse_version(version='0.0.0') -> tuple:
(tuple): Tuple of integers representing the numeric part of the version and the extra string, i.e. (2, 0, 1)
"""
try:
correct = [True if x == '.' else x.isdigit() for x in version] # first non-number index
v = version[:correct.index(False)] if False in correct else version
return tuple(map(int, v.split('.'))) # '2.0.1+cpu' -> (2, 0, 1)
return tuple(map(int, re.findall(r'\d+', version)[:3])) # '2.0.1+cpu' -> (2, 0, 1)
except Exception as e:
LOGGER.warning(f'WARNING ⚠️ failure for parse_version({version}), reverting to deprecated pkg_resources: {e}')
import pkg_resources
@ -166,9 +164,12 @@ def check_version(current: str = '0.0.0',
# check if current version is between 20.04 (inclusive) and 22.04 (exclusive)
check_version(current='21.10', required='>20.04,<22.04')
"""
if not (current and required): # if any inputs missing
if not current: # if current is '' or None
LOGGER.warning(f'WARNING ⚠️ invalid check_version({current}, {required}) requested, please check values.')
return True # in case required is '' or None
return True
if not required: # if required is '' or None
return True
current = parse_version(current) # '1.2.3' -> (1, 2, 3)
constraints = re.findall(r'([<>!=]{1,2}\s*\d+\.\d+)', required) or [f'>={required}']
@ -492,9 +493,9 @@ def collect_system_info():
f"{'CPU':<20}{get_cpu_info()}\n"
f"{'CUDA':<20}{torch.version.cuda if torch and torch.cuda.is_available() else None}\n")
if (ROOT.parent / 'requirements.txt').exists(): # pip install
if (ROOT.parent / 'requirements.txt').exists(): # git install
requirements = parse_requirements()
else: # git install
else: # pip install
from pkg_resources import get_distribution
requirements = get_distribution('ultralytics').requires()

View file

@ -16,8 +16,8 @@ from ultralytics.utils import LOGGER, TQDM, checks, clean_url, emojis, is_online
# Define Ultralytics GitHub assets maintained at https://github.com/ultralytics/assets
GITHUB_ASSETS_REPO = 'ultralytics/assets'
GITHUB_ASSETS_NAMES = [f'yolov8{k}{suffix}.pt' for k in 'nsmlx' for suffix in ('', '6', '-cls', '-seg', '-pose')] + \
[f'yolov5{k}u.pt' for k in 'nsmlx'] + \
GITHUB_ASSETS_NAMES = [f'yolov8{k}{suffix}.pt' for k in 'nsmlx' for suffix in ('', '-cls', '-seg', '-pose')] + \
[f'yolov5{k}{resolution}u.pt' for k in 'nsmlx' for resolution in ('', '6')] + \
[f'yolov3{k}u.pt' for k in ('', '-spp', '-tiny')] + \
[f'yolo_nas_{k}.pt' for k in 'sml'] + \
[f'sam_{k}.pt' for k in 'bl'] + \
@ -176,10 +176,11 @@ def check_disk_space(url='https://ultralytics.com/assets/coco128.zip', sf=1.5, h
Returns:
(bool): True if there is sufficient disk space, False otherwise.
"""
r = requests.head(url) # response
# Check response
assert r.status_code < 400, f'URL error for {url}: {r.status_code} {r.reason}'
try:
r = requests.head(url) # response
assert r.status_code < 400, f'URL error for {url}: {r.status_code} {r.reason}' # check response
except Exception:
return True # requests issue, default to True
# Check file size
gib = 1 << 30 # bytes per GiB