Skip to content

Commit

Permalink
FLOPS min stride 32 (#2276)
Browse files Browse the repository at this point in the history
Signed-off-by: xiaowo1996 <429740343@qq.com>
  • Loading branch information
xiaowo1996 committed Feb 23, 2021
1 parent cc79f3a commit 83dc1b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/torch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 83dc1b4

Please sign in to comment.