Skip to content

Commit 4d3680c

Browse files
authored
Minor import and spelling updates (#1133)
1 parent 4346b13 commit 4d3680c

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

detect.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import argparse
22
import os
3-
import platform
43
import shutil
54
import time
65
from pathlib import Path

train.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import argparse
22
import logging
3-
import math
43
import os
54
import random
65
import shutil
76
import time
87
from pathlib import Path
98

9+
import math
1010
import numpy as np
1111
import torch.distributed as dist
1212
import torch.nn.functional as F

utils/general.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def check_dataset(dict):
143143
if val and len(val):
144144
val = [os.path.abspath(x) for x in (val if isinstance(val, list) else [val])] # val path
145145
if not all(os.path.exists(x) for x in val):
146-
print('\nWARNING: Dataset not found, nonexistant paths: %s' % [*val])
146+
print('\nWARNING: Dataset not found, nonexistent paths: %s' % [*val])
147147
if s and len(s): # download script
148148
print('Downloading %s ...' % s)
149149
if s.startswith('http') and s.endswith('.zip'): # URL
@@ -158,7 +158,7 @@ def check_dataset(dict):
158158

159159

160160
def make_divisible(x, divisor):
161-
# Returns x evenly divisble by divisor
161+
# Returns x evenly divisible by divisor
162162
return math.ceil(x / divisor) * divisor
163163

164164

@@ -169,9 +169,9 @@ def labels_to_class_weights(labels, nc=80):
169169

170170
labels = np.concatenate(labels, 0) # labels.shape = (866643, 5) for COCO
171171
classes = labels[:, 0].astype(np.int) # labels = [class xywh]
172-
weights = np.bincount(classes, minlength=nc) # occurences per class
172+
weights = np.bincount(classes, minlength=nc) # occurrences per class
173173

174-
# Prepend gridpoint count (for uCE trianing)
174+
# Prepend gridpoint count (for uCE training)
175175
# gpi = ((320 / 32 * np.array([1, 2, 4])) ** 2 * 3).sum() # gridpoints per image
176176
# weights = np.hstack([gpi * len(labels) - weights.sum() * 9, weights * 9]) ** 0.5 # prepend gridpoints to start
177177

@@ -820,7 +820,7 @@ def print_results(k):
820820
k, dist = kmeans(wh / s, n, iter=30) # points, mean distance
821821
k *= s
822822
wh = torch.tensor(wh, dtype=torch.float32) # filtered
823-
wh0 = torch.tensor(wh0, dtype=torch.float32) # unflitered
823+
wh0 = torch.tensor(wh0, dtype=torch.float32) # unfiltered
824824
k = print_results(k)
825825

826826
# Plot
@@ -1281,7 +1281,7 @@ def plot_results(start=0, stop=0, bucket='', id=(), labels=(), save_dir=''):
12811281
for i in range(10):
12821282
y = results[i, x]
12831283
if i in [0, 1, 2, 5, 6, 7]:
1284-
y[y == 0] = np.nan # dont show zero loss values
1284+
y[y == 0] = np.nan # don't show zero loss values
12851285
# y /= y[0] # normalize
12861286
label = labels[fi] if len(labels) else Path(f).stem
12871287
ax[i].plot(x, y, marker='.', label=label, linewidth=1, markersize=6)

0 commit comments

Comments
 (0)