* call model.eval() when opt.train is False call model.eval() when opt.train is False * single-line if statement * cleanup Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>modifyDataloader
@@ -58,8 +58,7 @@ if __name__ == '__main__': | |||
# Update model | |||
if opt.half: | |||
img, model = img.half(), model.half() # to FP16 | |||
if opt.train: | |||
model.train() # training mode (no grid construction in Detect layer) | |||
model.train() if opt.train else model.eval() # training mode = no Detect() layer grid construction | |||
for k, m in model.named_modules(): | |||
m._non_persistent_buffers_set = set() # pytorch 1.6.0 compatibility | |||
if isinstance(m, models.common.Conv): # assign export-friendly activations |