diff --git a/models/export.py b/models/export.py index dc4a039d68bb..eed1e8e88a45 100644 --- a/models/export.py +++ b/models/export.py @@ -161,6 +161,8 @@ def load_state_dict(model, state_dict, train, exclude_anchors): img, model = img.half(), model.half() # to FP16 if opt.train: model.train() # training mode (no grid construction in Detect layer) + else: + model.eval() 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