Docs updates: Add Explorer to tab, YOLOv5 in Guides and Usage in Quickstart (#7438)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: Haixuan Xavier Tao <tao.xavier@outlook.com>
This commit is contained in:
parent
53150a925b
commit
a92adf8231
30 changed files with 227 additions and 105 deletions
|
|
@ -87,6 +87,7 @@ class DetectionValidator(BaseValidator):
|
|||
max_det=self.args.max_det)
|
||||
|
||||
def _prepare_batch(self, si, batch):
|
||||
"""Prepares a batch of images and annotations for validation."""
|
||||
idx = batch['batch_idx'] == si
|
||||
cls = batch['cls'][idx].squeeze(-1)
|
||||
bbox = batch['bboxes'][idx]
|
||||
|
|
@ -100,6 +101,7 @@ class DetectionValidator(BaseValidator):
|
|||
return prepared_batch
|
||||
|
||||
def _prepare_pred(self, pred, pbatch):
|
||||
"""Prepares a batch of images and annotations for validation."""
|
||||
predn = pred.clone()
|
||||
ops.scale_boxes(pbatch['imgsz'], predn[:, :4], pbatch['ori_shape'],
|
||||
ratio_pad=pbatch['ratio_pad']) # native-space pred
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ class OBBPredictor(DetectionPredictor):
|
|||
"""
|
||||
|
||||
def __init__(self, cfg=DEFAULT_CFG, overrides=None, _callbacks=None):
|
||||
"""Initializes OBBPredictor with optional model and data configuration overrides."""
|
||||
super().__init__(cfg, overrides, _callbacks)
|
||||
self.args.task = 'obb'
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ class OBBValidator(DetectionValidator):
|
|||
return self.match_predictions(detections[:, 5], gt_cls, iou)
|
||||
|
||||
def _prepare_batch(self, si, batch):
|
||||
"""Prepares and returns a batch for OBB validation."""
|
||||
idx = batch['batch_idx'] == si
|
||||
cls = batch['cls'][idx].squeeze(-1)
|
||||
bbox = batch['bboxes'][idx]
|
||||
|
|
@ -78,6 +79,7 @@ class OBBValidator(DetectionValidator):
|
|||
return prepared_batch
|
||||
|
||||
def _prepare_pred(self, pred, pbatch):
|
||||
"""Prepares and returns a batch for OBB validation with scaled and padded bounding boxes."""
|
||||
predn = pred.clone()
|
||||
ops.scale_boxes(pbatch['imgsz'], predn[:, :4], pbatch['ori_shape'], ratio_pad=pbatch['ratio_pad'],
|
||||
xywh=True) # native-space pred
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ class PoseValidator(DetectionValidator):
|
|||
self.stats = dict(tp_p=[], tp=[], conf=[], pred_cls=[], target_cls=[])
|
||||
|
||||
def _prepare_batch(self, si, batch):
|
||||
"""Prepares a batch for processing by converting keypoints to float and moving to device."""
|
||||
pbatch = super()._prepare_batch(si, batch)
|
||||
kpts = batch['keypoints'][batch['batch_idx'] == si]
|
||||
h, w = pbatch['imgsz']
|
||||
|
|
@ -80,6 +81,7 @@ class PoseValidator(DetectionValidator):
|
|||
return pbatch
|
||||
|
||||
def _prepare_pred(self, pred, pbatch):
|
||||
"""Prepares and scales keypoints in a batch for pose processing."""
|
||||
predn = super()._prepare_pred(pred, pbatch)
|
||||
nk = pbatch['kpts'].shape[1]
|
||||
pred_kpts = predn[:, 6:].view(len(predn), nk, -1)
|
||||
|
|
|
|||
|
|
@ -72,12 +72,14 @@ class SegmentationValidator(DetectionValidator):
|
|||
return p, proto
|
||||
|
||||
def _prepare_batch(self, si, batch):
|
||||
"""Prepares a batch for training or inference by processing images and targets."""
|
||||
prepared_batch = super()._prepare_batch(si, batch)
|
||||
midx = [si] if self.args.overlap_mask else batch['batch_idx'] == si
|
||||
prepared_batch['masks'] = batch['masks'][midx]
|
||||
return prepared_batch
|
||||
|
||||
def _prepare_pred(self, pred, pbatch, proto):
|
||||
"""Prepares a batch for training or inference by processing images and targets."""
|
||||
predn = super()._prepare_pred(pred, pbatch)
|
||||
pred_masks = self.process(proto, pred[:, 6:], pred[:, :4], shape=pbatch['imgsz'])
|
||||
return predn, pred_masks
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue