updates
This commit is contained in:
parent
d7a28bd9f7
commit
a2d392b5c3
8
train.py
8
train.py
|
@ -193,10 +193,10 @@ def train(
|
||||||
if int(name.split('.')[1]) < cutoff: # if layer < 75
|
if int(name.split('.')[1]) < cutoff: # if layer < 75
|
||||||
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) # 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
|
||||||
|
|
||||||
mloss = torch.zeros(5).to(device) # mean losses
|
mloss = torch.zeros(5).to(device) # mean losses
|
||||||
for i, (imgs, targets, _, _) in enumerate(dataloader):
|
for i, (imgs, targets, _, _) in enumerate(dataloader):
|
||||||
|
|
|
@ -543,7 +543,6 @@ def kmeans_targets(path='./data/coco_64img.txt'): # from utils.utils import *;
|
||||||
|
|
||||||
|
|
||||||
# Plotting functions ---------------------------------------------------------------------------------------------------
|
# Plotting functions ---------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
def plot_one_box(x, img, color=None, label=None, line_thickness=None):
|
def plot_one_box(x, img, color=None, label=None, line_thickness=None):
|
||||||
# Plots one bounding box on image img
|
# Plots one bounding box on image img
|
||||||
tl = line_thickness or round(0.002 * max(img.shape[0:2])) + 1 # line thickness
|
tl = line_thickness or round(0.002 * max(img.shape[0:2])) + 1 # line thickness
|
||||||
|
|
Loading…
Reference in New Issue