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

Add DeepLab example #1534

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aaudevart
Copy link

Add a new example using DeepLabV3+ pretrained model for semantic segmentation in healthcare

Google colab : https://colab.research.google.com/drive/17UQr7-UM_Et0A7g7638Gq7Vb-e1171kC?usp=sharing

@qlzh727
Copy link
Member

qlzh727 commented Sep 21, 2023

Adding Ian as reviewer and Jon for visibility.

Copy link
Contributor

@ianstenbit ianstenbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good to me -- thanks for turning this into an example!
Just a few mostly minor comments

"""
Title: Semantic segmentation using DeepLabV3+
Author: [Alexia Audevart](https://github.com/aaudevart)
Date created: 2023/13/04
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this meant to be September 13? (13/09)?

Either way -- YYYY/MM/DD format is the standard here so let's use that.


"""shell
!pip install keras-core --upgrade
!pip uninstall -y keras-cv
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should need this uninstall for the example

Detect hardware, return appropriate distribution strategy
"""

try:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the example, I think we can exclude this bit and forego a strategy altogether. TF will just default to using the GPU in this case so we don't need to worry about distribution

train_gen = tf.data.Dataset.from_generator(
generator=gen_pairs(train_img_list),
output_signature=(
tf.TensorSpec(shape=(IMG_WIDTH, IMG_HEIGHT, 3), dtype=tf.uint8),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not critical here, since images are square, but this should be IMG_HEIGHT, IMG_WIDTH (order reversed)

val_gen = tf.data.Dataset.from_generator(
generator=gen_pairs(val_img_list),
output_signature=(
tf.TensorSpec(shape=(IMG_WIDTH, IMG_HEIGHT, 3), dtype=tf.uint8),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Same here re: height,width)

Adam as the optimizer.
"""

EPOCHS = 16
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For examples, we often try to keep the number of epochs low -- how long does this take to train?
If it's possible to get decent results with fewer epochs we should do that.

@divyashreepathihalli divyashreepathihalli requested review from divyashreepathihalli and removed request for jbischof December 1, 2023 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants