This commit is contained in:
Glenn Jocher 2019-06-12 11:25:56 +02:00
parent d7a28bd9f7
commit a2d392b5c3
2 changed files with 4 additions and 5 deletions

View File

@ -193,10 +193,10 @@ def train(
if int(name.split('.')[1]) < cutoff: # if layer < 75
p.requires_grad = False if epoch == 0 else True
# Update image weights (optional)
w = model.class_weights.cpu().numpy() * (1 - maps) # class weights
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
# # Update image weights (optional)
# w = model.class_weights.cpu().numpy() * (1 - maps) # class weights
# 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
mloss = torch.zeros(5).to(device) # mean losses
for i, (imgs, targets, _, _) in enumerate(dataloader):

View File

@ -543,7 +543,6 @@ def kmeans_targets(path='./data/coco_64img.txt'): # from utils.utils import *;
# Plotting functions ---------------------------------------------------------------------------------------------------
def plot_one_box(x, img, color=None, label=None, line_thickness=None):
# Plots one bounding box on image img
tl = line_thickness or round(0.002 * max(img.shape[0:2])) + 1 # line thickness