xiaowo1996
commited on
Commit
•
83dc1b4
1
Parent(s):
cc79f3a
FLOPS min stride 32 (#2276)
Browse filesSigned-off-by: xiaowo1996 <429740343@qq.com>
- utils/torch_utils.py +1 -1
utils/torch_utils.py
CHANGED
@@ -205,7 +205,7 @@ def model_info(model, verbose=False, img_size=640):
|
|
205 |
|
206 |
try: # FLOPS
|
207 |
from thop import profile
|
208 |
-
stride = int(model.stride.max()) if hasattr(model, 'stride') else 32
|
209 |
img = torch.zeros((1, model.yaml.get('ch', 3), stride, stride), device=next(model.parameters()).device) # input
|
210 |
flops = profile(deepcopy(model), inputs=(img,), verbose=False)[0] / 1E9 * 2 # stride GFLOPS
|
211 |
img_size = img_size if isinstance(img_size, list) else [img_size, img_size] # expand if int/float
|
|
|
205 |
|
206 |
try: # FLOPS
|
207 |
from thop import profile
|
208 |
+
stride = max(int(model.stride.max()), 32) if hasattr(model, 'stride') else 32
|
209 |
img = torch.zeros((1, model.yaml.get('ch', 3), stride, stride), device=next(model.parameters()).device) # input
|
210 |
flops = profile(deepcopy(model), inputs=(img,), verbose=False)[0] / 1E9 * 2 # stride GFLOPS
|
211 |
img_size = img_size if isinstance(img_size, list) else [img_size, img_size] # expand if int/float
|