From a2d392b5c35f8af564975c4a68823f855e3b9425 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Wed, 12 Jun 2019 11:25:56 +0200 Subject: [PATCH] updates --- train.py | 8 ++++---- utils/utils.py | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/train.py b/train.py index 77a5d434..c0880862 100644 --- a/train.py +++ b/train.py @@ -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): diff --git a/utils/utils.py b/utils/utils.py index 6a4e90e0..83f7fdf9 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -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