Update np.random.random() to random.random() (#3967)

This commit is contained in:
Glenn Jocher authored and GitHub committed 2021-07-11 16:56:36 +02:00
1 parent 8298ce5e88
commit 90e60b403d
1 file changed
+3 -1
+3 -1
View File
@@ -1,5 +1,7 @@
# Auto-anchor utils
import random
import numpy as np
import torch
import yaml
@@ -149,7 +151,7 @@ def kmean_anchors(path='./data/coco128.yaml', n=9, img_size=640, thr=4.0, gen=10
for _ in pbar:
v = np.ones(sh)
while (v == 1).all(): # mutate until a change occurs (prevent duplicates)
v = ((npr.random(sh) < mp) * npr.random() * npr.randn(*sh) * s + 1).clip(0.3, 3.0)
v = ((npr.random(sh) < mp) * random.random() * npr.randn(*sh) * s + 1).clip(0.3, 3.0)
kg = (k.copy() * v).clip(min=2.0)
fg = anchor_fitness(kg)
if fg > f: