Update setup.cfg (#11814)

* Update setup.cfg

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update .pre-commit-config.yaml

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Update export.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Update downloads.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Update yolo.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

---------

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Glenn Jocherandpre-commit-ci[bot] authored and GitHub committed 2023-07-05 00:42:57 +02:00
1 parent 0b3f751a6f
commit 459dd49c02
14 files changed
+46 -41

No files matched your search

+1 -1
View File
@@ -330,7 +330,7 @@ def classify_albumentations(
if vflip > 0:
T += [A.VerticalFlip(p=vflip)]
if jitter > 0:
color_jitter = (float(jitter),) * 3 # repeat value for brightness, contrast, satuaration, 0 hue
color_jitter = (float(jitter), ) * 3 # repeat value for brightness, contrast, satuaration, 0 hue
T += [A.ColorJitter(*color_jitter, 0)]
else: # Use fixed crop for eval set (reproducibility)
T = [A.SmallestMaxSize(max_size=size), A.CenterCrop(height=size, width=size)]
+1 -1
View File
@@ -32,7 +32,7 @@ class Callbacks:
'on_model_save': [],
'on_train_end': [],
'on_params_update': [],
'teardown': [],}
'teardown': [], }
self.stop_training = False # set True to interrupt training
def register_action(self, hook, name='', callback=None):
+1 -2
View File
@@ -4,7 +4,6 @@ Download utils
"""
import logging
import os
import subprocess
import urllib
from pathlib import Path
@@ -53,7 +52,7 @@ def curl_download(url, filename, *, silent: bool = False) -> bool:
'--retry',
'9',
'-C',
'-',])
'-', ])
return proc.returncode == 0
+3 -3
View File
@@ -139,12 +139,12 @@ def set_logging(name=LOGGING_NAME, verbose=True):
name: {
'class': 'logging.StreamHandler',
'formatter': name,
'level': level,}},
'level': level, }},
'loggers': {
name: {
'level': level,
'handlers': [name],
'propagate': False,}}})
'propagate': False, }}})
set_logging(LOGGING_NAME) # run before defining LOGGER
@@ -416,7 +416,7 @@ def check_imshow(warn=False):
return False
def check_suffix(file='yolov5s.pt', suffix=('.pt',), msg=''):
def check_suffix(file='yolov5s.pt', suffix=('.pt', ), msg=''):
# Check file(s) for acceptable suffix
if file and suffix:
if isinstance(suffix, str):
+6 -6
View File
@@ -90,7 +90,7 @@ class CometLogger:
'log_code': False,
'log_env_gpu': True,
'log_env_cpu': True,
'project_name': COMET_PROJECT_NAME,}
'project_name': COMET_PROJECT_NAME, }
self.default_experiment_kwargs.update(experiment_kwargs)
self.experiment = self._get_experiment(self.comet_mode, run_id)
self.experiment.set_name(self.opt.name)
@@ -153,7 +153,7 @@ class CometLogger:
'comet_log_per_class_metrics': COMET_LOG_PER_CLASS_METRICS,
'comet_log_batch_metrics': COMET_LOG_BATCH_METRICS,
'comet_log_confusion_matrix': COMET_LOG_CONFUSION_MATRIX,
'comet_model_name': COMET_MODEL_NAME,})
'comet_model_name': COMET_MODEL_NAME, })
# Check if running the Experiment with the Comet Optimizer
if hasattr(self.opt, 'comet_optimizer_id'):
@@ -170,7 +170,7 @@ class CometLogger:
**self.default_experiment_kwargs,
)
return comet_ml.OfflineExperiment(**self.default_experiment_kwargs,)
return comet_ml.OfflineExperiment(**self.default_experiment_kwargs, )
else:
try:
@@ -214,7 +214,7 @@ class CometLogger:
'fitness_score': fitness_score[-1],
'epochs_trained': epoch + 1,
'save_period': opt.save_period,
'total_epochs': opt.epochs,}
'total_epochs': opt.epochs, }
model_files = glob.glob(f'{path}/*.pt')
for model_path in model_files:
@@ -270,7 +270,7 @@ class CometLogger:
'x': xyxy[0],
'y': xyxy[1],
'x2': xyxy[2],
'y2': xyxy[3]},})
'y2': xyxy[3]}, })
for *xyxy, conf, cls in filtered_detections.tolist():
metadata.append({
'label': f'{self.class_names[int(cls)]}',
@@ -279,7 +279,7 @@ class CometLogger:
'x': xyxy[0],
'y': xyxy[1],
'x2': xyxy[2],
'y2': xyxy[3]},})
'y2': xyxy[3]}, })
self.metadata_dict[image_name] = metadata
self.logged_images_count += 1
+2 -2
View File
@@ -196,7 +196,7 @@ KEYS = [
'val/cls_loss',
'x/lr0',
'x/lr1',
'x/lr2',]
'x/lr2', ]
BEST_KEYS = [
'best/epoch',
@@ -207,4 +207,4 @@ BEST_KEYS = [
'best/precision(M)',
'best/recall(M)',
'best/mAP_0.5(M)',
'best/mAP_0.5:0.95(M)',]
'best/mAP_0.5:0.95(M)', ]
+2 -2
View File
@@ -170,7 +170,7 @@ def profile(input, ops, n=10, device=None):
m = m.half() if hasattr(m, 'half') and isinstance(x, torch.Tensor) and x.dtype is torch.float16 else m
tf, tb, t = 0, 0, [0, 0, 0] # dt forward, backward
try:
flops = thop.profile(m, inputs=(x,), verbose=False)[0] / 1E9 * 2 # GFLOPs
flops = thop.profile(m, inputs=(x, ), verbose=False)[0] / 1E9 * 2 # GFLOPs
except Exception:
flops = 0
@@ -284,7 +284,7 @@ def model_info(model, verbose=False, imgsz=640):
p = next(model.parameters())
stride = max(int(model.stride.max()), 32) if hasattr(model, 'stride') else 32 # max stride
im = torch.empty((1, p.shape[1], stride, stride), device=p.device) # input image in BCHW format
flops = thop.profile(deepcopy(model), inputs=(im,), verbose=False)[0] / 1E9 * 2 # stride GFLOPs
flops = thop.profile(deepcopy(model), inputs=(im, ), verbose=False)[0] / 1E9 * 2 # stride GFLOPs
imgsz = imgsz if isinstance(imgsz, list) else [imgsz, imgsz] # expand if int/float
fs = f', {flops * imgsz[0] / stride * imgsz[1] / stride:.1f} GFLOPs' # 640x640 GFLOPs
except Exception: