Reference for ultralytics/models/yolo/world/train.py
Note
This file is available at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/models/yolo/world/train.py. If you spot a problem please help fix it by contributing a Pull Request 🛠️. Thank you 🙏!
ultralytics.models.yolo.world.train.WorldTrainer
Bases: DetectionTrainer
A class to fine-tune a world model on a close-set dataset.
Example
Source code in ultralytics/models/yolo/world/train.py
__init__(cfg=DEFAULT_CFG, overrides=None, _callbacks=None)
Initialize a WorldTrainer object with given arguments.
Source code in ultralytics/models/yolo/world/train.py
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/models/yolo/world/train.py
get_model(cfg=None, weights=None, verbose=True)
Return WorldModel initialized with specified config and weights.
Source code in ultralytics/models/yolo/world/train.py
preprocess_batch(batch)
Preprocesses a batch of images for YOLOWorld training, adjusting formatting and dimensions as needed.
Source code in ultralytics/models/yolo/world/train.py
ultralytics.models.yolo.world.train.on_pretrain_routine_end(trainer)
Callback.