Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kalen Michael <kalenmike@gmail.com>
This commit is contained in:
Glenn Jocher
2023-01-09 23:22:33 +01:00
committed by GitHub
co-authored by pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Kalen Michael
parent 6feba17760
commit 422c49d439
97 changed files with 224 additions and 757 deletions
+2
View File
@@ -1,3 +1,5 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
import contextlib
import inspect
import logging.config
+1 -1
View File
@@ -1,4 +1,4 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
# Ultralytics YOLO 🚀, GPL-3.0 license
"""
Auto-batch utils
"""
+4 -1
View File
@@ -1,4 +1,7 @@
# Ultralytics YOLO base callbacks
# Ultralytics YOLO 🚀, GPL-3.0 license
"""
Base callbacks
"""
# Trainer callbacks ----------------------------------------------------------------------------------------------------
@@ -1,3 +1,5 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
from ultralytics.yolo.utils.torch_utils import get_flops, get_num_params
try:
@@ -1,3 +1,5 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
from ultralytics.yolo.utils.torch_utils import get_flops, get_num_params
try:
+2
View File
@@ -1,3 +1,5 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
import json
from time import time
@@ -1,3 +1,5 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
from torch.utils.tensorboard import SummaryWriter
writer = None # TensorBoard SummaryWriter instance
+2
View File
@@ -1,3 +1,5 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
from ultralytics.yolo.utils.torch_utils import get_flops, get_num_params
try:
+3 -2
View File
@@ -1,3 +1,5 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
import glob
import inspect
import math
@@ -62,8 +64,7 @@ def check_imgsz(imgsz, stride=32, min_dim=1, floor=0):
LOGGER.warning(f'WARNING ⚠️ --img-size {imgsz} must be multiple of max stride {stride}, updating to {sz}')
# Add missing dimensions if necessary
if min_dim == 2 and len(sz) == 1:
sz = [sz[0], sz[0]]
sz = [sz[0], sz[0]] if min_dim == 2 and len(sz) == 1 else sz[0] if min_dim == 1 and len(sz) == 1 else sz
return sz
+2
View File
@@ -1,3 +1,5 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
import os
import shutil
import socket
+2
View File
@@ -1,3 +1,5 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
import logging
import os
import subprocess
+2
View File
@@ -1,3 +1,5 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
import contextlib
import glob
import os
+2
View File
@@ -1,3 +1,5 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
from collections import abc
from itertools import repeat
from numbers import Number
+2
View File
@@ -1,3 +1,5 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
import torch
import torch.nn as nn
import torch.nn.functional as F
+1 -1
View File
@@ -1,4 +1,4 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
# Ultralytics YOLO 🚀, GPL-3.0 license
"""
Model validation metrics
"""
+2
View File
@@ -1,3 +1,5 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
import contextlib
import math
import re
+2
View File
@@ -1,3 +1,5 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
import contextlib
import math
from pathlib import Path
+2
View File
@@ -1,3 +1,5 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
import torch
import torch.nn as nn
import torch.nn.functional as F
+3 -1
View File
@@ -1,3 +1,5 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
import math
import os
import platform
@@ -59,7 +61,7 @@ def DDP_model(model):
def select_device(device='', batch_size=0, newline=False):
# device = None or 'cpu' or 0 or '0' or '0,1,2,3'
ver = git_describe() or ultralytics.__version__ # git commit or pip package version
s = f'Ultralytics YOLO 🚀 {ver} Python-{platform.python_version()} torch-{torch.__version__} '
s = f'Ultralytics YOLOv{ver} 🚀 Python-{platform.python_version()} torch-{torch.__version__} '
device = str(device).strip().lower().replace('cuda:', '').replace('none', '') # to string, 'cuda:0' to '0'
cpu = device == 'cpu'
mps = device == 'mps' # Apple Metal Performance Shaders (MPS)