Pythonでインスタンスセグメンテーション

$ sudo apt -y install python3-six python3-wheel python3-numpy python3-grpcio python3-protobuf python3-termcolor python3-typing-extensions python3-h5py python3-markdown python3-werkzeug python3-requests-oauthlib python3-rsa python3-cachetools python3-google-auth
$ sudo apt -y install python3-numpy python3-sklearn python3-matplotlib python3-seaborn
$ sudo pip3 install -U tensorflow tensorflow_datasets
$ pip3 install pixellib
$ curl -LO https://github.com/ayoolaolafenwa/PixelLib/releases/download/1.2/mask_rcnn_coco.h5

sample2.jpegをDLしてdataフォルダに格納
https://pixellib.readthedocs.io/en/latest/Image_instance.html

import pixellib
from pixellib.instance import instance_segmentation

segment_image = instance_segmentation()
segment_image.load_model("data/mask_rcnn_coco.h5")
segment_image.segmentImage("data/sample2.jpeg", output_image_name = "image_new.jpg")

どういう仕組みなのかは理解したが、イマイチ上手くいかんな…
環境のせいか…