Skip to content

Commit 459dd49

Browse files
Update setup.cfg (ultralytics#11814)
* Update setup.cfg Signed-off-by: Glenn Jocher <[email protected]> * [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 <[email protected]> * Update export.py Signed-off-by: Glenn Jocher <[email protected]> * Update downloads.py Signed-off-by: Glenn Jocher <[email protected]> * Update yolo.py Signed-off-by: Glenn Jocher <[email protected]> --------- Signed-off-by: Glenn Jocher <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 0b3f751 commit 459dd49

File tree

14 files changed

+46
-41
lines changed

14 files changed

+46
-41
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ repos:
1616
- id: end-of-file-fixer
1717
- id: trailing-whitespace
1818
- id: check-case-conflict
19-
- id: check-yaml
19+
# - id: check-yaml
2020
- id: check-docstring-first
2121
- id: double-quote-string-fixer
2222
- id: detect-private-key
@@ -26,7 +26,6 @@ repos:
2626
hooks:
2727
- id: pyupgrade
2828
name: Upgrade code
29-
args: [--py37-plus]
3029

3130
- repo: https://github.com/PyCQA/isort
3231
rev: 5.12.0
@@ -63,7 +62,12 @@ repos:
6362
args:
6463
- --ignore-words-list=crate,nd,strack,dota
6564

66-
#- repo: https://github.com/asottile/yesqa
67-
# rev: v1.4.0
68-
# hooks:
69-
# - id: yesqa
65+
# - repo: https://github.com/asottile/yesqa
66+
# rev: v1.4.0
67+
# hooks:
68+
# - id: yesqa
69+
70+
# - repo: https://github.com/asottile/dead
71+
# rev: v1.5.0
72+
# hooks:
73+
# - id: dead

export.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def export_formats():
110110
['TensorFlow Lite', 'tflite', '.tflite', True, False],
111111
['TensorFlow Edge TPU', 'edgetpu', '_edgetpu.tflite', False, False],
112112
['TensorFlow.js', 'tfjs', '_web_model', False, False],
113-
['PaddlePaddle', 'paddle', '_paddle_model', True, True],]
113+
['PaddlePaddle', 'paddle', '_paddle_model', True, True], ]
114114
return pd.DataFrame(x, columns=['Format', 'Argument', 'Suffix', 'CPU', 'GPU'])
115115

116116

@@ -221,7 +221,7 @@ def export_openvino(file, metadata, half, int8, data, prefix=colorstr('OpenVINO:
221221
import numpy as np
222222
from openvino.runtime import Core
223223

224-
from utils.dataloaders import create_dataloader, letterbox
224+
from utils.dataloaders import create_dataloader
225225
core = Core()
226226
onnx_model = core.read_model(f_onnx) # export
227227

@@ -501,7 +501,7 @@ def export_edgetpu(file, prefix=colorstr('Edge TPU:')):
501501
'10',
502502
'--out_dir',
503503
str(file.parent),
504-
f_tfl,], check=True)
504+
f_tfl, ], check=True)
505505
return f, None
506506

507507

@@ -522,7 +522,7 @@ def export_tfjs(file, int8, prefix=colorstr('TensorFlow.js:')):
522522
'--quantize_uint8' if int8 else '',
523523
'--output_node_names=Identity,Identity_1,Identity_2,Identity_3',
524524
str(f_pb),
525-
str(f),]
525+
str(f), ]
526526
subprocess.run([arg for arg in args if arg], check=True)
527527

528528
json = Path(f_json).read_text()

models/tf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def call(self, inputs):
310310
y = tf.concat([xy, wh, tf.sigmoid(y[..., 4:5 + self.nc]), y[..., 5 + self.nc:]], -1)
311311
z.append(tf.reshape(y, [-1, self.na * ny * nx, self.no]))
312312

313-
return tf.transpose(x, [0, 2, 1, 3]) if self.training else (tf.concat(z, 1),)
313+
return tf.transpose(x, [0, 2, 1, 3]) if self.training else (tf.concat(z, 1), )
314314

315315
@staticmethod
316316
def _make_grid(nx=20, ny=20):
@@ -486,7 +486,7 @@ def predict(self,
486486
iou_thres,
487487
conf_thres,
488488
clip_boxes=False)
489-
return (nms,)
489+
return (nms, )
490490
return x # output [1,6300,85] = [xywh, conf, class0, class1, ...]
491491
# x = x[0] # [x(1,6300,85), ...] to x(6300,85)
492492
# xywh = x[..., :4] # x(6300,4) boxes

models/yolo.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
if platform.system() != 'Windows':
2222
ROOT = Path(os.path.relpath(ROOT, Path.cwd())) # relative
2323

24-
from models.common import *
25-
from models.experimental import *
24+
from models.common import * # noqa
25+
from models.experimental import * # noqa
2626
from utils.autoanchor import check_anchor_order
2727
from utils.general import LOGGER, check_version, check_yaml, make_divisible, print_args
2828
from utils.plots import feature_visualization
@@ -76,7 +76,7 @@ def forward(self, x):
7676
y = torch.cat((xy, wh, conf), 4)
7777
z.append(y.view(bs, self.na * nx * ny, self.no))
7878

79-
return x if self.training else (torch.cat(z, 1),) if self.export else (torch.cat(z, 1), x)
79+
return x if self.training else (torch.cat(z, 1), ) if self.export else (torch.cat(z, 1), x)
8080

8181
def _make_grid(self, nx=20, ny=20, i=0, torch_1_10=check_version(torch.__version__, '1.10.0')):
8282
d = self.anchors[i].device
@@ -126,7 +126,7 @@ def _forward_once(self, x, profile=False, visualize=False):
126126

127127
def _profile_one_layer(self, m, x, dt):
128128
c = m == self.model[-1] # is final layer, copy input as inplace fix
129-
o = thop.profile(m, inputs=(x.copy() if c else x,), verbose=False)[0] / 1E9 * 2 if thop else 0 # FLOPs
129+
o = thop.profile(m, inputs=(x.copy() if c else x, ), verbose=False)[0] / 1E9 * 2 if thop else 0 # FLOPs
130130
t = time_sync()
131131
for _ in range(10):
132132
m(x.copy() if c else x)

segment/train.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ def main(opt, callbacks=Callbacks()):
605605
'gsutil',
606606
'cp',
607607
f'gs://{opt.bucket}/evolve.csv',
608-
str(evolve_csv),])
608+
str(evolve_csv), ])
609609

610610
for _ in range(opt.evolve): # generations to evolve
611611
if evolve_csv.exists(): # if evolve.csv exists: select best hyps and mutate

setup.cfg

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Local usage: pip install pre-commit, pre-commit run --all-files
44

55
[metadata]
6-
license_file = LICENSE
6+
license_files = LICENSE
77
description_file = README.md
88

99
[tool:pytest]
@@ -25,17 +25,19 @@ verbose = 2
2525
# https://pep8.readthedocs.io/en/latest/intro.html#error-codes
2626
format = pylint
2727
# see: https://www.flake8rules.com/
28-
ignore = E731,F405,E402,F401,W504,E127,E231,E501,F403
28+
ignore = E731,F405,E402,W504,E501
2929
# E731: Do not assign a lambda expression, use a def
3030
# F405: name may be undefined, or defined from star imports: module
3131
# E402: module level import not at top of file
32-
# F401: module imported but unused
3332
# W504: line break after binary operator
34-
# E127: continuation line over-indented for visual indent
35-
# E231: missing whitespace after ‘,’, ‘;’, or ‘:’
3633
# E501: line too long
34+
# removed:
35+
# F401: module imported but unused
36+
# E231: missing whitespace after ‘,’, ‘;’, or ‘:’
37+
# E127: continuation line over-indented for visual indent
3738
# F403: ‘from module import *’ used; unable to detect undefined names
3839

40+
3941
[isort]
4042
# https://pycqa.github.io/isort/docs/configuration/options.html
4143
line_length = 120
@@ -48,7 +50,7 @@ spaces_before_comment = 2
4850
COLUMN_LIMIT = 120
4951
COALESCE_BRACKETS = True
5052
SPACES_AROUND_POWER_OPERATOR = True
51-
SPACE_BETWEEN_ENDING_COMMA_AND_CLOSING_BRACKET = False
53+
SPACE_BETWEEN_ENDING_COMMA_AND_CLOSING_BRACKET = True
5254
SPLIT_BEFORE_CLOSING_BRACKET = False
5355
SPLIT_BEFORE_FIRST_ARGUMENT = False
5456
# EACH_DICT_ENTRY_ON_SEPARATE_LINE = False

train.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ def main(opt, callbacks=Callbacks()):
584584
'gsutil',
585585
'cp',
586586
f'gs://{opt.bucket}/evolve.csv',
587-
str(evolve_csv),])
587+
str(evolve_csv), ])
588588

589589
for _ in range(opt.evolve): # generations to evolve
590590
if evolve_csv.exists(): # if evolve.csv exists: select best hyps and mutate

utils/augmentations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ def classify_albumentations(
330330
if vflip > 0:
331331
T += [A.VerticalFlip(p=vflip)]
332332
if jitter > 0:
333-
color_jitter = (float(jitter),) * 3 # repeat value for brightness, contrast, satuaration, 0 hue
333+
color_jitter = (float(jitter), ) * 3 # repeat value for brightness, contrast, satuaration, 0 hue
334334
T += [A.ColorJitter(*color_jitter, 0)]
335335
else: # Use fixed crop for eval set (reproducibility)
336336
T = [A.SmallestMaxSize(max_size=size), A.CenterCrop(height=size, width=size)]

utils/callbacks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(self):
3232
'on_model_save': [],
3333
'on_train_end': [],
3434
'on_params_update': [],
35-
'teardown': [],}
35+
'teardown': [], }
3636
self.stop_training = False # set True to interrupt training
3737

3838
def register_action(self, hook, name='', callback=None):

utils/downloads.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"""
55

66
import logging
7-
import os
87
import subprocess
98
import urllib
109
from pathlib import Path
@@ -53,7 +52,7 @@ def curl_download(url, filename, *, silent: bool = False) -> bool:
5352
'--retry',
5453
'9',
5554
'-C',
56-
'-',])
55+
'-', ])
5756
return proc.returncode == 0
5857

5958

0 commit comments

Comments
 (0)