This commit is contained in:
Glenn Jocher 2019-05-10 17:08:00 +02:00
parent 9ffb40b0be
commit c45cdc4fa3
1 changed files with 1 additions and 1 deletions

View File

@ -167,7 +167,7 @@ def train(
p.requires_grad = False if epoch == 0 else True p.requires_grad = False if epoch == 0 else True
# Update image weights (optional) # Update image weights (optional)
w = model.class_weights.cpu().numpy() * (1 - maps) ** 2 # class weights w = model.class_weights.cpu().numpy() * (1 - maps) # class weights
image_weights = labels_to_image_weights(dataset.labels, nc=nc, class_weights=w) image_weights = labels_to_image_weights(dataset.labels, nc=nc, class_weights=w)
dataset.indices = random.choices(range(dataset.n), weights=image_weights, k=dataset.n) # random weighted index dataset.indices = random.choices(range(dataset.n), weights=image_weights, k=dataset.n) # random weighted index