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

Migrating Fully Convolutional Network example to Keras 3 #1691

Merged
merged 3 commits into from
Dec 25, 2023

Conversation

aditya02shah
Copy link
Contributor

This PR migrates the fully_convolutional_network example to keras 3.0[TF-Only Example] as requested in keras-team/keras-cv#2211

Copy link

google-cla bot commented Dec 21, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Member

@fchollet fchollet left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

@@ -48,14 +48,17 @@
## Setup Imports
"""

import os
os.environ["KERAS_BACKEND"] = "tensorflow"
Copy link
Member

Choose a reason for hiding this comment

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

Does the code work with all backends, or just TF? If it works with all backends, there is no need to hardcode a backend.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is a TF-only example.

@@ -147,10 +150,10 @@ def unpack_resize_data(section):
# for Matplotlib visualization.

images, masks = next(iter(test_ds))
random_idx = tf.random.uniform([], minval=0, maxval=BATCH_SIZE, dtype=tf.int32)
random_idx = keras.random.uniform([], minval=0, maxval=BATCH_SIZE, seed=seed_generator)
Copy link
Member

Choose a reason for hiding this comment

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

Outside of a layer, you can just use an integer seed value, it's simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the suggestion! I've updated the code to use an integer seed value as recommended.

@@ -556,13 +559,13 @@ def preprocess_data(image, segmentation_mask):
"""

images, masks = next(iter(test_ds))
random_idx = tf.random.uniform([], minval=0, maxval=BATCH_SIZE, dtype=tf.int32)
random_idx = keras.random.uniform([], minval=0, maxval=BATCH_SIZE,seed=seed_generator)
Copy link
Member

Choose a reason for hiding this comment

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

Same here

Copy link
Member

@fchollet fchollet left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@fchollet fchollet merged commit 4338f59 into keras-team:master Dec 25, 2023
1 check passed
SuryanarayanaY pushed a commit to SuryanarayanaY/keras-io that referenced this pull request Jan 19, 2024
…1691)

* Migrated fully_convolutional_network example to Keras 3

* Initialised seed to integer values
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.

3 participants