Display model information. This method provides an overview or detailed information about the model, depending on the arguments passed. It can control the verbosity of the output. Args: detailed (bool): If True, shows detailed information about the model layers
(self, detailed: bool = False, verbose: bool = True, imgsz: int | list[int, int] = 640)
| 404 | torch.save({**self.ckpt, **updates}, filename) |
| 405 | |
| 406 | def info(self, detailed: bool = False, verbose: bool = True, imgsz: int | list[int, int] = 640): |
| 407 | """Display model information. |
| 408 | |
| 409 | This method provides an overview or detailed information about the model, depending on the arguments |
| 410 | passed. It can control the verbosity of the output. |
| 411 | |
| 412 | Args: |
| 413 | detailed (bool): If True, shows detailed information about the model layers and parameters. |
| 414 | verbose (bool): If True, prints the information and returns model summary. If False, returns None. |
| 415 | imgsz (int | list[int, int]): Input image size used for FLOPs calculation. |
| 416 | |
| 417 | Returns: |
| 418 | (tuple): A tuple containing the number of layers (int), number of parameters (int), number of gradients |
| 419 | (int), and GFLOPs (float). Returns None if verbose is False. |
| 420 | |
| 421 | Examples: |
| 422 | >>> model = Model("yolo26n.pt") |
| 423 | >>> model.info() # Prints model summary and returns tuple |
| 424 | >>> model.info(detailed=True) # Prints detailed info and returns tuple |
| 425 | """ |
| 426 | self._check_is_pytorch_model() |
| 427 | return self.model.info(detailed=detailed, verbose=verbose, imgsz=imgsz) |
| 428 | |
| 429 | def fuse(self) -> Model: |
| 430 | """Fuse Conv2d and BatchNorm2d layers in the model for optimized inference. |