Improved FLOPS computation
diff --git a/models/yolo.py b/models/yolo.py
index 0080056a444..2ef1574a8b7 100644
--- a/models/yolo.py
+++ b/models/yolo.py
@@ -192,8 +192,8 @@ def autoshape(self):  # add autoShape module
         copy_attr(m, self, include=('yaml', 'nc', 'hyp', 'names', 'stride'), exclude=())  # copy attributes
         return m
 
-    def info(self, verbose=False):  # print model information
-        model_info(self, verbose)
+    def info(self, verbose=False, img_size=640):  # print model information
+        model_info(self, verbose, img_size)
 
 
 def parse_model(d, ch):  # model_dict, input_channels(3)
diff --git a/utils/torch_utils.py b/utils/torch_utils.py
index cdd21b519d6..e5ef2607a8c 100644
--- a/utils/torch_utils.py
+++ b/utils/torch_utils.py
@@ -139,8 +139,8 @@ def fuse_conv_and_bn(conv, bn):
     return fusedconv
 
 
-def model_info(model, verbose=False):
-    # Plots a line-by-line description of a PyTorch model
+def model_info(model, verbose=False, img_size=640):
+    # Model information. img_size may be int or list, i.e. img_size=640 or img_size=[640, 320]
     n_p = sum(x.numel() for x in model.parameters())  # number parameters
     n_g = sum(x.numel() for x in model.parameters() if x.requires_grad)  # number gradients
     if verbose:
@@ -152,8 +152,10 @@ def model_info(model, verbose=False):
 
     try:  # FLOPS
         from thop import profile
-        flops = profile(deepcopy(model), inputs=(torch.zeros(1, 3, 64, 64),), verbose=False)[0] / 1E9 * 2
-        fs = ', %.1f GFLOPS' % (flops * 100)  # 640x640 FLOPS
+        stride = int(model.stride.max())
+        flops = profile(deepcopy(model), inputs=(torch.zeros(1, 3, stride, stride),), verbose=False)[0] / 1E9 * 2
+        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
     except ImportError:
         fs = ''
 

This PR improves FLOPS computation, and allows passing an `img_size` argument for the first time (previous FLOPS computations were fixed at 640, 640 img-size.

To view model FLOPS, `pip install thop` and then run any normal command:
<img width="1259" alt="Screenshot 2020-11-14 at 14 25 24" src="https://user-images.githubusercontent.com/26833433/99147975-509e7580-2685-11eb-924d-04e3d9d797d0.png">


Or call the model.info() method directly with an optional `img_size` argument:
```python
import torch

model = torch.hub.load('ultralytics/yolov5', 'yolov5s', pretrained=True)

model.info()
model.info(img_size=320)
model.info(img_size=[320, 640])

# OUTPUT
# Model Summary: 232 layers, 7459581 parameters, 0 gradients, 17.5 GFLOPS
# Model Summary: 232 layers, 7459581 parameters, 0 gradients, 4.4 GFLOPS
# Model Summary: 232 layers, 7459581 parameters, 0 gradients, 8.7 GFLOPS
```


## 🛠️ PR Summary

<sub>Made with ❤️ by [Ultralytics Actions](https://github.com/ultralytics/actions)<sub>

### 🌟 Summary
Updated YOLOv5 model and utility functions to provide more detailed information including FLOPS based on varying image sizes.

### 📊 Key Changes
- The `info` method in `models/yolo.py` now takes an additional `img_size` argument.
- The `model_info` function in `utils/torch_utils.py` has been updated to:
    - Accept `img_size` as an argument, which can be an integer or a list.
    - Use `img_size` to calculate FLOPS correctly for different input image dimensions.
    - Compute FLOPS based on provided stride and image dimensions for greater accuracy.

### 🎯 Purpose & Impact
- **Purpose**: To offer users a more accurate calculation of FLOPS that reflects the model's complexity based on different input resolutions, rather than a fixed size.
- **Impact**: Users now can get precise model information pertinent to their specific use case, leading to better understanding of the model's computational demand for different image sizes. This could be particularly useful for optimizing performance or ensuring compatibility with hardware constraints. 🚀💡