YOLO-World is an all-in-one platform designed to streamline the development, training, and deployment of YOLO (You Only Look Once) models. Whether you are a researcher, developer, or data scientist, YOLO-World provides a unified environment to experiment with various YOLO architectures, optimize model performance, and deploy models across different hardware platforms
Versatile Model Architectures: YOLO-World supports a wide range of YOLO variants, including YOLOv3, YOLOv4, YOLOv5, and YOLOv8. Each variant comes with its own set of optimizations and enhancements, allowing you to choose the best model for your specific use case.
Integrated Development Environment: The platform offers an intuitive and user-friendly interface for model development. You can easily configure model parameters, visualize training progress, and analyze performance metrics all within a single dashboard.
Automated Training Pipelines: YOLO-World automates the training process, enabling you to train models with minimal manual intervention. It supports distributed training across multiple GPUs, ensuring faster convergence and better resource utilization.
Model Optimization: The platform includes advanced optimization techniques such as quantization, pruning, and knowledge distillation. These techniques help reduce model size and improve inference speed without compromising accuracy.
Cross-Platform Deployment: YOLO-World supports deployment on a variety of hardware platforms, including CPUs, GPUs, and specialized AI accelerators like NVIDIA TensorRT, Intel OpenVINO, and Huawei Ascend. This ensures that your models can run efficiently on the hardware available in your environment.
Real-Time Inference: With YOLO-World, you can deploy models for real-time object detection tasks. The platform provides tools for benchmarking inference speed and optimizing models for low-latency applications.
Community and Collaboration: YOLO-World fosters a vibrant community of developers and researchers. You can share your models, collaborate on projects, and access a wealth of resources, including tutorials, documentation, and pre-trained models.
Modification for NPU
Pip install the ultralytics package including all requirements in a Python>=3.9 environment with PyTorch==2.1.0
pip install -r examples/requirements.txtpython3 pth2onnx.py --pt models/yolov8s-worldv2.pt
source /usr/local/Ascend/ascend-toolkit/set_env.sh
atc --framework=5 \
--model=./models/yolov8s-worldv2.onnx \
--input_format=NCHW \
--input_shape='images:1,3,640,640'\
--output_type=FP32 \
--output=./models/yolov8s-worldv2 \
--log=error \
--soc_version=Ascend910B2import argparse
import torch
import numpy as np
from ais_bench.infer.interface import InferSession
from ultralytics.models.yolo.detect import DetectionPredictor
from ultralytics import YOLO
### patch cpu lettebox begin #####
def patch_pre_transform(self, im):
same_shapes = len({x.shape for x in im}) == 1
self.model.pt = False
letterbox = LetterBox(self.imgsz, auto=same_shapes and self.model.pt, stride=self.model.stride)
return [letterbox(image=x) for x in im]
from ultralytics.data.augment import LetterBox
from ultralytics.engine.predictor import BasePredictor
BasePredictor.pre_transform = patch_pre_transform
### patch cpu lettebox end #####
class OM_Model():
def __init__(self):
self.pt=False
self.stride = 32
self.fp16 = False
self.names = {0: 'person', 1: 'bicycle', 2: 'car', 3: 'motorcycle', 4: 'airplane', 5: 'bus', 6: 'train', 7: 'truck', 8: 'boat', 9: 'traffic light', 10: 'fire hydrant', 11: 'stop sign', 12: 'parking meter', 13: 'bench', 14: 'bird', 15: 'cat', 16: 'dog', 17: 'horse', 18: 'sheep', 19: 'cow', 20: 'elephant', 21: 'bear', 22: 'zebra', 23: 'giraffe', 24: 'backpack', 25: 'umbrella', 26: 'handbag', 27: 'tie', 28: 'suitcase', 29: 'frisbee', 30: 'skis', 31: 'snowboard', 32: 'sports ball', 33: 'kite', 34: 'baseball bat', 35: 'baseball glove', 36: 'skateboard', 37: 'surfboard', 38: 'tennis racket', 39: 'bottle', 40: 'wine glass', 41: 'cup', 42: 'fork', 43: 'knife', 44: 'spoon', 45: 'bowl', 46: 'banana', 47: 'apple', 48: 'sandwich', 49: 'orange', 50: 'broccoli', 51: 'carrot', 52: 'hot dog', 53: 'pizza', 54: 'donut', 55: 'cake', 56: 'chair', 57: 'couch', 58: 'potted plant', 59: 'bed', 60: 'dining table', 61: 'toilet', 62: 'tv', 63: 'laptop', 64: 'mouse', 65: 'remote', 66: 'keyboard', 67: 'cell phone', 68: 'microwave', 69: 'oven', 70: 'toaster', 71: 'sink', 72: 'refrigerator', 73: 'book', 74: 'clock', 75: 'vase', 76: 'scissors', 77: 'teddy bear', 78: 'hair drier', 79: 'toothbrush'}
def pt_detect(input_args):
model = YOLO(input_args.pt)
output = model(source=input_args.data, save=True, save_txt=True) # ndarray
for i in output:
print("pt result:", i.boxes.data)
def om_detect(input_args):
om_model = InferSession(int(input_args.device_id), input_args.om)
#data
dp = DetectionPredictor()
dp.model = OM_Model()
dp.setup_source(input_args.data)
for dp.batch in dp.dataset:
paths, im0s, s = dp.batch
# Preprocess
im = dp.preprocess(im0s)
# Inference
im = np.ascontiguousarray(im).astype(np.float32) # contiguous
preds = om_model.infer([im])
preds_tensor = torch.from_numpy(preds[0])
#torch.save(preds_tensor,"om_tensor.pt")
#print("om result:",preds_tensor, preds_tensor.shape)
# Postprocess
output = dp.postprocess(preds_tensor, im, im0s)
print("om result:", output[0].boxes.data)
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--data', default='./data', help='data path')
parser.add_argument('--pt', default='./models/yolov8s-worldv2.pt', help='pt model path')
parser.add_argument('--om', default='./models/yolov8s-worldv2.om', help='om model path')
parser.add_argument('--device_id', default='0', help='device id')
parser.add_argument('--model_name_or_path', default='Jinan_AICC/YOLO-World', help='Path to model')
input_args = parser.parse_args()
pt_detect(input_args)
om_detect(input_args)
if __name__ == '__main__':
main()