-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Conversation
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. |
There was a problem hiding this 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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
…1691) * Migrated fully_convolutional_network example to Keras 3 * Initialised seed to integer values
This PR migrates the fully_convolutional_network example to keras 3.0[TF-Only Example] as requested in keras-team/keras-cv#2211