pip install ikomia
About
Infer Detectron2 instance segmentation models
Run Detectron2 instance segmentation models. It can detect and segment objects in image.
🚀 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.
2. Create your workflow
[Change the sample image URL to fit algorithm purpose]
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_detectron2_instance_segmentation", auto_connect=True)
# Run on your image
wf.run_on(url="https://cdn.nba.com/teams/legacy/www.nba.com/bulls/sites/bulls/files/jordan_vs_indiana.jpg")
# Display the results
display(algo.get_image_with_mask_and_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 "COCO-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_3x": Name of the pretrained model.
Should be one of:
- COCO-InstanceSegmentation/mask_rcnn_R_101_DC5_3x
- COCO-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_3x
- COCO-InstanceSegmentation/mask_rcnn_R_101_C4_3x
- COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x
- COCO-InstanceSegmentation/mask_rcnn_R_50_C4_1x
- COCO-InstanceSegmentation/mask_rcnn_R_101_FPN_3x
- COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x
- COCO-InstanceSegmentation/mask_rcnn_R_50_DC5_3x
- COCO-InstanceSegmentation/mask_rcnn_R_50_C4_3x
- COCO-InstanceSegmentation/mask_rcnn_R_50_DC5_1x
- LVISv0.5-InstanceSegmentation/mask_rcnn_R_101_FPN_1x
- LVISv0.5-InstanceSegmentation/mask_rcnn_R_50_FPN_1x
- LVISv0.5-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_1x
- Cityscapes/mask_rcnn_R_50_FPN
- conf_thres (float) - Default 0.5: Box threshold for the prediction [0,1].
- cuda (bool) - Default True: If True, CUDA-based inference (GPU). If False, run on CPU.
- config_file (str): Path to the .yaml config file. Overwrite model_name if both are provided.
- model_weight_file (str): Path to the .pth weight file. Overwrite model_name if both are provided.
Note: parameter key and value should be in string 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_detectron2_instance_segmentation", auto_connect=True)
# Set parameters
algo.set_parameters({
"model_name": "COCO-InstanceSegmentation/mask_rcnn_R_50_C4_1x",
})
# Run on your image
wf.run_on(url="https://cdn.nba.com/teams/legacy/www.nba.com/bulls/sites/bulls/files/jordan_vs_indiana.jpg")
# Display the results
display(algo.get_image_with_mask_and_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.
import ikomia
from ikomia.dataprocess.workflow import Workflow
# Init your workflow
wf = Workflow()
# Add algorithm
algo = wf.add_task(name="infer_detectron2_instance_segmentation", auto_connect=True)
# Run on your image
wf.run_on(url="example_image.png")
# Iterate over outputs
for output in algo.get_outputs()
# Print information
print(output)
# Export it to JSON
output.to_json()
Developer
Ikomia
License
Apache License 2.0
A permissive license whose main conditions require preservation of copyright and license notices. Contributors provide an express grant of patent rights. Licensed works, modifications, and larger works may be distributed under different terms and without source code.
Permissions | Conditions | Limitations |
---|---|---|
Commercial use | License and copyright notice | Trademark use |
Modification | State changes | Liability |
Distribution | Warranty | |
Patent use | ||
Private use |
This is not legal advice: this description is for informational purposes only and does not constitute the license itself. Provided by choosealicense.com.