DetectionTrainer
Bases: BaseTrainer
Source code in ultralytics/yolo/v8/detect/train.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
build_dataset(img_path, mode='train', batch=None)
Build YOLO Dataset
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img_path |
str
|
Path to the folder containing images. |
required |
mode |
str
|
|
'train'
|
batch |
int
|
Size of batches, this is for |
None
|
Source code in ultralytics/yolo/v8/detect/train.py
get_dataloader(dataset_path, batch_size=16, rank=0, mode='train')
TODO: manage splits differently.
Source code in ultralytics/yolo/v8/detect/train.py
get_model(cfg=None, weights=None, verbose=True)
Return a YOLO detection model.
get_validator()
Returns a DetectionValidator for YOLO model validation.
Source code in ultralytics/yolo/v8/detect/train.py
label_loss_items(loss_items=None, prefix='train')
Returns a loss dict with labelled training loss items tensor
Source code in ultralytics/yolo/v8/detect/train.py
plot_metrics()
plot_training_labels()
Create a labeled training plot of the YOLO model.
Source code in ultralytics/yolo/v8/detect/train.py
plot_training_samples(batch, ni)
Plots training samples with their annotations.
Source code in ultralytics/yolo/v8/detect/train.py
preprocess_batch(batch)
Preprocesses a batch of images by scaling and converting to float.
progress_string()
Returns a formatted string of training progress with epoch, GPU memory, loss, instances and size.
Source code in ultralytics/yolo/v8/detect/train.py
set_model_attributes()
nl = de_parallel(self.model).model[-1].nl # number of detection layers (to scale hyps).
Source code in ultralytics/yolo/v8/detect/train.py
train
Train and optimize YOLO model given training data and device.
Source code in ultralytics/yolo/v8/detect/train.py
Created 2023-04-16, Updated 2023-05-30
Authors: Glenn Jocher (4)