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

May I use your UNET model as a example in a public presentation... #66

Open
aurotripathy opened this issue Feb 26, 2018 · 3 comments
Open

Comments

@aurotripathy
Copy link

Its at the embedded vision summit...and I will provide attribution to your github code.
I find it to be the cleanest and simplest expression of the model.
I would has expected the conv2d parameter to be 'valid' instead of 'same' as I suspect the original authors implemented it in Caffe. But that's OK.

Kindly indicate if you will support this.

@jocicmarko
Copy link
Owner

Of course, it's fine, I released this code with MIT license, so feel free to use it.

Good luck with your presentation!

@aurotripathy
Copy link
Author

Thank you! I'm using a variation that (I think) is closer to the paper (added bottom-of-U conv w/1024 feature maps, conv5_B). I also lined up the left convs with the right convs. You quick review would be appreciated (though not necessary)

def get_orig_unet():
inputs = Input((img_rows, img_cols, 1))                                                                                  
conv1_L = Conv2D(64, (3, 3), activation='relu', padding='same')(inputs)
conv1_L = Conv2D(64, (3, 3), activation='relu', padding='same')(conv1_L)
pool1 = MaxPooling2D(pool_size=(2, 2))(conv1_L)

conv2_L = Conv2D(128, (3, 3), activation='relu', padding='same')(pool1)
conv2_L = Conv2D(128, (3, 3), activation='relu', padding='same')(conv2_L)
pool2 = MaxPooling2D(pool_size=(2, 2))(conv2_L)  

conv3_L = Conv2D(256, (3, 3), activation='relu', padding='same')(pool2)
conv3_L = Conv2D(256, (3, 3), activation='relu', padding='same')(conv3_L) 
pool3 = MaxPooling2D(pool_size=(2, 2))(conv3_L)                                            

conv4_L = Conv2D(512, (3, 3), activation='relu', padding='same')(pool3)
conv4_L = Conv2D(512, (3, 3), activation='relu', padding='same')(conv4_L)  
pool4 = MaxPooling2D(pool_size=(2, 2))(conv4_L)

conv5_B = Conv2D(1024, (3, 3), activation='relu', padding='same')(pool4)  
conv5_B = Conv2D(512, (3,3), activation='relu', padding='same')(conv5_B)  

up1 = concatenate([Conv2DTranspose(512, (2, 2), strides=(2, 2), padding='same')(conv5_B), conv4_L], axis=3)                                                                          
conv3_R = Conv2D(512, (3, 3), activation='relu', padding='same')(up1)
conv3_R = Conv2D(512, (3, 3), activation='relu', padding='same')(conv3_R)

up2 = concatenate([Conv2DTranspose(256, (2, 2), strides=(2, 2), padding='same')(conv3_R), conv3_L], axis=3) # 24, 24                                                                                     
conv2_R = Conv2D(256, (3, 3), activation='relu', padding='same')(up2)
conv2_R = Conv2D(256, (3, 3), activation='relu', padding='same')(conv2_R)

up3 = concatenate([Conv2DTranspose(128, (2, 2), strides=(2, 2), padding='same')(conv2_R), conv2_L], axis=3) # 48, 48                                                                                     
conv1_R = Conv2D(128, (3, 3), activation='relu', padding='same')(up3)
conv1_R = Conv2D(128, (3, 3), activation='relu', padding='same')(conv1_R)

up4 = concatenate([Conv2DTranspose(64, (2, 2), strides=(2, 2), padding='same')(conv1_R), conv1_L], axis=3)                                                                                     
conv_out = Conv2D(64, (3, 3), activation='relu', padding='same')(up4)
conv_out = Conv2D(64, (3, 3), activation='relu', padding='same')(conv_out)

conv_out_final = Conv2D(1, (1, 1), activation='sigmoid')(conv_out)

model = Model(inputs=[inputs], outputs=[conv_out_final])

model.compile(optimizer=Adam(lr=1e-5), loss=dice_coef_loss, metrics=[dice_coef])

return model

@jocicmarko
Copy link
Owner

Looking good! The model I published was just inspired by U-Net, it doesn't represent exact implementation of it - personally, I find some things in the original U-Net confusing and unnecessary to have if you just want to get into image segmentation.

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

No branches or pull requests

2 participants