Merge pull request #245 from yxNONG/patch-2

Unify the check point of single and multi GPU
This commit is contained in:
Glenn Jocher authored and GitHub committed 2020-07-02 12:05:46 -07:00
commit e02a189a3a
2 files changed
+15 -9

No files matched your search

+2 -2
View File
@@ -79,7 +79,6 @@ def train(hyp):
# Create model
model = Model(opt.cfg).to(device)
assert model.md['nc'] == nc, '%s nc=%g classes but %s nc=%g classes' % (opt.data, nc, opt.cfg, model.md['nc'])
model.names = data_dict['names']
# Image sizes
gs = int(max(model.stride)) # grid size (max stride)
@@ -178,6 +177,7 @@ def train(hyp):
model.hyp = hyp # attach hyperparameters to model
model.gr = 1.0 # giou loss ratio (obj_loss = 1.0 or giou)
model.class_weights = labels_to_class_weights(dataset.labels, nc).to(device) # attach class weights
model.names = data_dict['names']
# Class frequency
labels = np.concatenate(dataset.labels, 0)
@@ -294,7 +294,7 @@ def train(hyp):
batch_size=batch_size,
imgsz=imgsz_test,
save_json=final_epoch and opt.data.endswith(os.sep + 'coco.yaml'),
model=ema.ema,
model=ema.ema.module if hasattr(model, 'module') else ema.ema,
single_cls=opt.single_cls,
dataloader=testloader)