Browse Source

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

modifyDataloader
Glenn Jocher GitHub 3 years ago
parent
commit
90e60b403d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      utils/autoanchor.py

+ 3
- 1
utils/autoanchor.py 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:

Loading…
Cancel
Save