mirror of
https://github.com/ultralytics/yolov5.git
synced 2025-06-03 14:49:29 +08:00
FLOPS min stride 32 (#2276)
Signed-off-by: xiaowo1996 <429740343@qq.com>
This commit is contained in:
parent
cc79f3a9ea
commit
83dc1b4484
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user