From 96906e1828a36cd6a28627476bb37aa50edbbf5d Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sun, 3 Apr 2022 18:13:12 +0200 Subject: [PATCH 1/2] Update --- export.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/export.py b/export.py index cc7a74db9af2..e73715ea13e9 100644 --- a/export.py +++ b/export.py @@ -54,7 +54,6 @@ import pandas as pd import torch -import torch.nn as nn from torch.utils.mobile_optimizer import optimize_for_mobile FILE = Path(__file__).resolve() @@ -64,10 +63,8 @@ if platform.system() != 'Windows': ROOT = Path(os.path.relpath(ROOT, Path.cwd())) # relative -from models.common import Conv from models.experimental import attempt_load from models.yolo import Detect -from utils.activations import SiLU from utils.datasets import LoadImages from utils.general import (LOGGER, check_dataset, check_img_size, check_requirements, check_version, colorstr, file_size, print_args, url2file) @@ -474,10 +471,10 @@ def run( im, model = im.half(), model.half() # to FP16 model.train() if train else model.eval() # training mode = no Detect() layer grid construction for k, m in model.named_modules(): - if isinstance(m, Conv): # assign export-friendly activations - if isinstance(m.act, nn.SiLU): - m.act = SiLU() - elif isinstance(m, Detect): + # if isinstance(m, Conv): # assign export-friendly activations + # if isinstance(m.act, nn.SiLU): + # m.act = SiLU() + if isinstance(m, Detect): m.inplace = inplace m.onnx_dynamic = dynamic if hasattr(m, 'forward_export'): From a2723ee24d2a201b2073af2843828b0917e4d179 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sun, 3 Apr 2022 18:18:05 +0200 Subject: [PATCH 2/2] Update time_limit --- utils/general.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/general.py b/utils/general.py index 379e9e0f47a4..da7dbb6d3e55 100755 --- a/utils/general.py +++ b/utils/general.py @@ -738,7 +738,7 @@ def non_max_suppression(prediction, # min_wh = 2 # (pixels) minimum box width and height max_wh = 7680 # (pixels) maximum box width and height max_nms = 30000 # maximum number of boxes into torchvision.ops.nms() - time_limit = 0.030 * bs # seconds to quit after + time_limit = 0.1 + 0.03 * bs # seconds to quit after redundant = True # require redundant detections multi_label &= nc > 1 # multiple labels per box (adds 0.5ms/img) merge = False # use merge-NMS