Add TensorBoard graph for model visualization (#4464)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Glenn Jocher
2023-08-21 01:22:29 +02:00
committed by GitHub
parent 87ce15d383
commit 3acead7e79
6 changed files with 29 additions and 36 deletions

View File

@ -56,14 +56,3 @@ class SegmentationTrainer(yolo.detect.DetectionTrainer):
def plot_metrics(self):
"""Plots training/val metrics."""
plot_results(file=self.csv, segment=True, on_plot=self.on_plot) # save results.png
def train(cfg=DEFAULT_CFG):
"""Train a YOLO segmentation model based on passed arguments."""
args = dict(model=cfg.model or 'yolov8n-seg.pt', data=cfg.data or 'coco8-seg.yaml')
trainer = SegmentationTrainer(overrides=args)
trainer.train()
if __name__ == '__main__':
train()

View File

@ -8,7 +8,7 @@ import torch
import torch.nn.functional as F
from ultralytics.models.yolo.detect import DetectionValidator
from ultralytics.utils import DEFAULT_CFG, LOGGER, NUM_THREADS, ops
from ultralytics.utils import LOGGER, NUM_THREADS, ops
from ultralytics.utils.checks import check_requirements
from ultralytics.utils.metrics import SegmentMetrics, box_iou, mask_iou
from ultralytics.utils.plotting import output_to_target, plot_images
@ -243,14 +243,3 @@ class SegmentationValidator(DetectionValidator):
except Exception as e:
LOGGER.warning(f'pycocotools unable to run: {e}')
return stats
def val(cfg=DEFAULT_CFG):
"""Validate trained YOLO model on validation data."""
args = dict(model=cfg.model or 'yolov8n-seg.pt', data=cfg.data or 'coco8-seg.yaml')
validator = SegmentationValidator(args=args)
validator(model=args['model'])
if __name__ == '__main__':
val()