Reference for ultralytics/models/yolo/world/train_world.py
Note
This file is available at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/models/yolo/world/train_world.py. If you spot a problem please help fix it by contributing a Pull Request 🛠️. Thank you 🙏!
ultralytics.models.yolo.world.train_world.WorldTrainerFromScratch
Bases: WorldTrainer
A class extending the WorldTrainer class for training a world model from scratch on open-set dataset.
Example
from ultralytics.models.yolo.world.train_world import WorldTrainerFromScratch
from ultralytics import YOLOWorld
data = dict(
train=dict(
yolo_data=["Objects365.yaml"],
grounding_data=[
dict(
img_path="../datasets/flickr30k/images",
json_file="../datasets/flickr30k/final_flickr_separateGT_train.json",
),
dict(
img_path="../datasets/GQA/images",
json_file="../datasets/GQA/final_mixed_train_no_coco.json",
),
],
),
val=dict(yolo_data=["lvis.yaml"]),
)
model = YOLOWorld("yolov8s-worldv2.yaml")
model.train(data=data, trainer=WorldTrainerFromScratch)
Source code in ultralytics/models/yolo/world/train_world.py
build_dataset
Build YOLO Dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img_path
|
List[str] | 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_world.py
final_eval
Performs final evaluation and validation for object detection YOLO-World model.
Source code in ultralytics/models/yolo/world/train_world.py
get_dataset
Get train, val path from data dict if it exists.
Returns None if data format is not recognized.
Source code in ultralytics/models/yolo/world/train_world.py
📅 Created 8 months ago
✏️ Updated 3 months ago