Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] U-Net #126

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft

[WIP] U-Net #126

wants to merge 12 commits into from

Conversation

alexander-g
Copy link
Contributor

@alexander-g alexander-g commented Dec 17, 2020

  • U-Net architecture for image segmentation

  • MeanIoU metric

  • class_weight and ignore_index parameters for SparseCategoricalCrossentropy

  • Backboned U-Net

  • Training examples

  • Pretrained model parameters

  • mkdocs

@cgarciae
Copy link
Collaborator

Looking good! Hey I am working on making Elegy layers numerically equivalent with Flax layers in #128, I am just starting with Linear tho, but eventually this could lead to us being able to reuse their pre-trained models and vice-versa.

@alexander-g alexander-g mentioned this pull request Dec 23, 2020
@cgarciae cgarciae changed the title U-Net [WIP] U-Net Dec 25, 2020
@cgarciae cgarciae changed the title [WIP] U-Net U-Net Dec 25, 2020
@alexander-g alexander-g changed the title U-Net [WIP] U-Net Dec 26, 2020
@alexander-g
Copy link
Contributor Author

  • This PR is finished but depends on PR Module Slicing #115 so I'm not marking it as ready yet
  • Includes UNets with ResNet18 and ResNet50 backbones pretrained on COCO with 384px resolution. Not entirely happy with it yet but if I go up the resolution I need to reduce the batch size and the performance drops. I will try again some time later.
  • @cgarciae Please take a look at module.py:171 whether or not this breaks anything
fname,_  = urllib.request.urlretrieve('https://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/Take_ours%21.jpg/800px-Take_ours%21.jpg')
x        = np.array(PIL.Image.open(fname).resize([384,384])) / np.float32(255)
unet_r18 = elegy.nets.unet.UNet_R18(weights='coco')
y        = elegy.Model(unet_r18).predict(x[np.newaxis])[0]
i        = elegy.nets.unet.COCO_CLASSNAMES_TO_CHANNELS['sheep']

figure(0, (10,4))
subplot(121); imshow(x);               axis('off');
subplot(122); imshow(y.argmax(-1)==i); axis('off');

Output for the above code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants