Skip to content

Ikomia-hub/infer_yolo_world

Repository files navigation

Algorithm icon

infer_yolo_world


Stars Website GitHub
Discord community

YOLO-World is a state-of-the-art real-time object detection model that leverages the power of open-vocabulary learning to recognize and localize a wide range of objects in images.

illustration1

illustration

🚀 Use with Ikomia API

1. Install Ikomia API

We strongly recommend using a virtual environment. If you're not sure where to start, we offer a tutorial here.

pip install ikomia

2. Create your workflow

from ikomia.dataprocess.workflow import Workflow
from ikomia.utils.displayIO import display

# Init your workflow
wf = Workflow()

# Add algorithm
algo = wf.add_task(name="infer_yolo_world", auto_connect=True)

# Run on your image
wf.run_on(url="https://images.pexels.com/photos/745045/pexels-photo-745045.jpeg?cs=srgb&dl=pexels-helena-lopes-745045.jpg&fm=jpg&w=1280&h=869")

# Display your image
display(algo.get_image_with_graphics())

☀️ Use with Ikomia Studio

Ikomia Studio offers a friendly UI with the same features as the API.

  • If you haven't started using Ikomia Studio yet, download and install it from this page.
  • For additional guidance on getting started with Ikomia Studio, check out this blog post.

📝 Set algorithm parameters

  • model_name (str) - default 'yolo_world_m': Name of the YOLO_WORLD pre-trained model. Other model available:
    • yolo_world_s
    • yolo_world_v2_s
    • yolo_world_m
    • yolo_world_v2_m
    • yolo_world_l
    • yolo_world_v2_l
    • yolo_world_l_plus
    • yolo_world_v2_l_plus
    • yolo_world_l_x
    • yolo_world_v2_l_x
  • conf_thres (float) default '0.1': Box threshold for the prediction [0,1].
  • iou_thres (float) - default '0.25': Intersection over Union, degree of overlap between two boxes [0,1].
  • max_dets (int) - default '100': The maximum number of bounding boxes that can be retained across all classes after NMS (Non-Maximum Suppression). This parameter limits the total number of detections returned by the model, ensuring that only the most confident detections are retained.
  • cuda (bool): If True, CUDA-based inference (GPU). If False, run on CPU. If using a custom model:
  • model_weight_file (str, optional): Path to model weights file .pth.
  • config_file (str, optional): Path to model config file .py.

Parameters should be in strings format when added to the dictionary.

from ikomia.dataprocess.workflow import Workflow
from ikomia.utils.displayIO import display

# Init your workflow
wf = Workflow()

# Add algorithm
algo = wf.add_task(name="infer_yolo_world", auto_connect=True)

algo.set_parameters({
        "model_name": "yolo_world_m",
        "prompt": "person, dog, cup",
        "max_dets": "100",
        "conf_thres": "0.07"
        })

# Run on your image
wf.run_on(url="https://images.pexels.com/photos/745045/pexels-photo-745045.jpeg?cs=srgb&dl=pexels-helena-lopes-745045.jpg&fm=jpg&w=1280&h=869")

# Display your image
display(algo.get_image_with_graphics())

🔍 Explore algorithm outputs

Every algorithm produces specific outputs, yet they can be explored them the same way using the Ikomia API. For a more in-depth understanding of managing algorithm outputs, please refer to the documentation.

from ikomia.dataprocess.workflow import Workflow

# Init your workflow
wf = Workflow()

# Add algorithm
algo = wf.add_task(name="infer_yolo_world", auto_connect=True)

# Run on your image  
wf.run_on(url="https://images.pexels.com/photos/745045/pexels-photo-745045.jpeg?cs=srgb&dl=pexels-helena-lopes-745045.jpg&fm=jpg&w=1280&h=869")

# Iterate over outputs
for output in algo.get_outputs():
    # Print information
    print(output)
    # Export it to JSON
    output.to_json()

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published