Input channel yaml['ch'] addition (#1741)

This commit is contained in:
Glenn Jocher authored and GitHub committed 2020-12-19 10:54:01 -08:00
1 parent ab0db8d104
commit 394d1c89f3
2 files changed
+4 -3

No files matched your search

+1 -1
View File
@@ -196,7 +196,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
img = torch.zeros((1, 3, stride, stride), device=next(model.parameters()).device) # input
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 FLOPS
img_size = img_size if isinstance(img_size, list) else [img_size, img_size] # expand if int/float
fs = ', %.1f GFLOPS' % (flops * img_size[0] / stride * img_size[1] / stride) # 640x640 FLOPS