FLOPS min stride 32 (#2276)

Signed-off-by: xiaowo1996 <429740343@qq.com>
This commit is contained in:
xiaowo1996 authored and GitHub committed 2021-02-23 09:38:56 -08:00
1 parent cc79f3a9ea
commit 83dc1b4484
1 file changed
+1 -1
+1 -1
View File
@@ -205,7 +205,7 @@ def model_info(model, verbose=False, img_size=640):
try: # FLOPS
from thop import profile
stride = int(model.stride.max()) if hasattr(model, 'stride') else 32
stride = max(int(model.stride.max()), 32) if hasattr(model, 'stride') else 32
img = torch.zeros((1, model.yaml.get('ch', 3), stride, stride), device=next(model.parameters()).device) # input
flops = profile(deepcopy(model), inputs=(img,), verbose=False)[0] / 1E9 * 2 # stride GFLOPS
img_size = img_size if isinstance(img_size, list) else [img_size, img_size] # expand if int/float