ultralytics 8.0.168 save Tuner results every iteration (#4680)

This commit is contained in:
Glenn Jocher 2023-08-31 23:40:42 +02:00 committed by GitHub
parent 4b6147dd6f
commit 263bfd1e93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 16 deletions

View file

@ -286,13 +286,14 @@ class ThreadingLocked:
return decorated
def yaml_save(file='data.yaml', data=None):
def yaml_save(file='data.yaml', data=None, header=''):
"""
Save YAML data to a file.
Args:
file (str, optional): File name. Default is 'data.yaml'.
data (dict): Data to save in YAML format.
header (str, optional): YAML header to add.
Returns:
(None): Data is saved to the specified file.
@ -311,6 +312,8 @@ def yaml_save(file='data.yaml', data=None):
# Dump data to file in YAML format
with open(file, 'w') as f:
if header:
f.write(header)
yaml.safe_dump(data, f, sort_keys=False, allow_unicode=True)

View file

@ -29,7 +29,7 @@ def check_train_batch_size(model, imgsz=640, amp=True):
return autobatch(deepcopy(model).train(), imgsz) # compute optimal batch size
def autobatch(model, imgsz=640, fraction=0.67, batch_size=DEFAULT_CFG.batch):
def autobatch(model, imgsz=640, fraction=0.60, batch_size=DEFAULT_CFG.batch):
"""
Automatically estimate the best YOLO batch size to use a fraction of the available CUDA memory.