ultralytics 8.0.93 HUB docs and JSON2YOLO converter (#2431)

Co-authored-by: Ayush Chaurasia <ayush.chaurarsia@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: 李际朝 <tubkninght@gmail.com>
Co-authored-by: Danny Kim <imbird0312@gmail.com>
This commit is contained in:
Glenn Jocher
2023-05-06 01:12:43 +02:00
committed by GitHub
parent 0ebd3f2959
commit ddb354ce5e
34 changed files with 1107 additions and 759 deletions

View File

@ -3,6 +3,7 @@
import contextlib
import glob
import os
import shutil
from datetime import datetime
from pathlib import Path
@ -87,3 +88,13 @@ def get_latest_run(search_dir='.'):
"""Return path to most recent 'last.pt' in /runs (i.e. to --resume from)."""
last_list = glob.glob(f'{search_dir}/**/last*.pt', recursive=True)
return max(last_list, key=os.path.getctime) if last_list else ''
def make_dirs(dir='new_dir/'):
# Create folders
dir = Path(dir)
if dir.exists():
shutil.rmtree(dir) # delete dir
for p in dir, dir / 'labels', dir / 'images':
p.mkdir(parents=True, exist_ok=True) # make dir
return dir