top of page

News to help your R&D in artificial intelligence, machine learning, robotics, computer vision, smart hardware

As an Amazon Associate I earn

from qualifying purchases

Use PixelLib to extract objects in images and videos with 5 lines of code

Use PixelLib to extract objects in images and videos with 5 Lines of code


For example, first do the following:


pip3 install pixellib


Then run the following Python code:


import pixellib

from pixellib.instance import instance_segmentation

segment_image=instance_segmentation()

segment_image.load_model("mask_rcnn_coco.h5")


segment_image.segmentImage("input.jpg", extract_segmented_objects=True,save_extracted_objects=True, show_bboxes=True, output_image_name="output.jpg")


NOTE:

1. You can get the model "mask_rcnn_coco.h5" by using the "wget" command: wget https://github.com/ayoolaolafenwa/PixelLib/releases/download/1.2/mask_rcnn_coco.h5

2. "input.jpg" is an input image

3. "output.jpg" is the input image with the objects marked


"ouptut.jpg" will then contain:

Photo by Han Le on Unsplash


PixelLib Extracts Objects In Images and Videos with 5 Lines of Code


PixelLib PyPI registry https://pypi.org/project/pixellib

Please like and share this post if you enjoyed it using the buttons at the bottom!


Stay up to date. Subscribe to my posts https://morrislee1234.wixsite.com/website/contact

Web site with my other posts by category https://morrislee1234.wixsite.com/website

112 views0 comments

ClickBank paid link

bottom of page