val.py 689 B

1234567891011121314
  1. # Ultralytics YOLO 🚀, AGPL-3.0 license
  2. from ultralytics.models.yolo.segment import SegmentationValidator
  3. from ultralytics.utils.metrics import SegmentMetrics
  4. class FastSAMValidator(SegmentationValidator):
  5. def __init__(self, dataloader=None, save_dir=None, pbar=None, args=None, _callbacks=None):
  6. """Initialize SegmentationValidator and set task to 'segment', metrics to SegmentMetrics."""
  7. super().__init__(dataloader, save_dir, pbar, args, _callbacks)
  8. self.args.task = 'segment'
  9. self.args.plots = False # disable ConfusionMatrix and other plots to avoid errors
  10. self.metrics = SegmentMetrics(save_dir=self.save_dir, on_plot=self.on_plot)