MCPcopy
hub / github.com/ultralytics/ultralytics / info

Method info

ultralytics/engine/model.py:406–427  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 15

safe_uploadFunction · 0.45
select_deviceFunction · 0.45
model_infoFunction · 0.45
strip_optimizerFunction · 0.45
profile_opsFunction · 0.45
__call__Method · 0.45
attempt_compileFunction · 0.45
plot_labelsFunction · 0.45
_save_one_fileFunction · 0.45
feature_visualizationFunction · 0.45
update_modelsFunction · 0.45
printMethod · 0.45

Calls 1

Tested by 6

test_model_methodsFunction · 0.36
cache_weightsFunction · 0.36
cache_datasetsFunction · 0.36
cache_solution_assetsFunction · 0.36
cache_clip_modelFunction · 0.36
mainFunction · 0.36