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

@ -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