Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 24, 2021
1 parent 582d5e5 commit ce91bce
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
6 changes: 3 additions & 3 deletions yolort/v5/utils/autoanchor.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ def print_results(k):
print(f"{prefix}Running kmeans for {n} anchors on {len(wh)} points...")
s = wh.std(0) # sigmas for whitening
k, dist = kmeans(wh / s, n, iter=30) # points, mean distance
assert len(k) == n, (
f"{prefix}ERROR: scipy.cluster.vq.kmeans requested {n} points but returned only {len(k)}"
)
assert (
len(k) == n
), f"{prefix}ERROR: scipy.cluster.vq.kmeans requested {n} points but returned only {len(k)}"
k *= s
wh = torch.tensor(wh, dtype=torch.float32) # filtered
wh0 = torch.tensor(wh0, dtype=torch.float32) # unfiltered
Expand Down
6 changes: 3 additions & 3 deletions yolort/v5/utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,9 @@ def __init__(
tqdm(None, desc=prefix + d, total=n, initial=n) # display cache results
if cache["msgs"]:
logging.info("\n".join(cache["msgs"])) # display warnings
assert nf > 0 or not augment, (
f"{prefix}No labels in {cache_path}. Can not train without labels. See {HELP_URL}"
)
assert (
nf > 0 or not augment
), f"{prefix}No labels in {cache_path}. Can not train without labels. See {HELP_URL}"

# Read cache
[cache.pop(k) for k in ("hash", "version", "msgs")] # remove items
Expand Down
6 changes: 3 additions & 3 deletions yolort/v5/utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,9 @@ def non_max_suppression(
xc = prediction[..., 4] > conf_thres # candidates

# Checks
assert 0 <= conf_thres <= 1, (
f"Invalid Confidence threshold {conf_thres}, valid values are between 0.0 and 1.0"
)
assert (
0 <= conf_thres <= 1
), f"Invalid Confidence threshold {conf_thres}, valid values are between 0.0 and 1.0"
assert 0 <= iou_thres <= 1, f"Invalid IoU {iou_thres}, valid values are between 0.0 and 1.0"

# Settings
Expand Down
4 changes: 1 addition & 3 deletions yolort/v5/utils/torch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,7 @@ def model_info(model, verbose=False, img_size=640):
except (ImportError, Exception):
fs = ""

LOGGER.info(
f"Model Summary: {len(list(model.modules()))} layers, {n_p} parameters, {n_g} gradients{fs}"
)
LOGGER.info(f"Model Summary: {len(list(model.modules()))} layers, {n_p} parameters, {n_g} gradients{fs}")


def load_classifier(name="resnet101", n=2):
Expand Down

0 comments on commit ce91bce

Please sign in to comment.