Instance segmentation

Hi guys,

I was wondering if the fastai book (and course, either part 1 or part 2) will feature anything on instance segmentation?

I searched in the book repo and couldn’t find anything, but I don’t know if that’s a reliable indicator if the book isn’t ready yet.

Thanks

1 Like

It’s demonstrated the first notebook (under the heading “Deep learning is not just for image classification”). Extending this is suggested as “further research” in the 15_arch_details notebook.

The code is extremely simple because of Fastai’s formulaic construction of a DataBlock and creation of a u-net:

path = untar_data(URLs.CAMVID_TINY)
dls = SegmentationDataLoaders.from_label_func(
    path, 
    bs=8, 
    fnames=get_image_files(path/"images"),
    label_func=lambda o: path/'labels'/f'{o.stem}_P{o.suffix}',
    codes=np.loadtxt(path/'codes.txt', dtype=str)
)

learn = unet_learner(dls, resnet34)

That example is semantic segmentation, though, not instance segmentation. :wink:

1 Like

Oops, my mistake! I guess it’s not covered in the book or course, then. But @muellerzr put together a nice notebook for this: https://github.com/muellerzr/Practical-Deep-Learning-for-Coders-2.0/blob/master/Computer%20Vision/06_Object_Detection.ipynb

Thanks for the replies guys!

@jwuphysics I was aware of these examples, but as @machinethink said, these aren’t instance segmentation.

I’m also aware of @muellerzr’s notebook – It’s great!

I was just wondering if there’s any more depth on this anywhere.

3 Likes

Check out icevision library, it’s build on fastai with modern CV models, incl. instance segm.

3 Likes

Yes, Icevision is pretty good. Comes with features useful for out-of-the-box parsing of various data formats (object detection, instance segmentation). Using it with fastai is very straightforward (Icevision provides the model and data loaders, you do the rest with fastai).

It’s features are not very well-documented, so you’ll need to read the code. The code is well organised, so in practice it’s easy. Start with COCOMaskParser from icevision/coco_parser.py at master · airctic/icevision · GitHub

2 Likes