-
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 SimSiam Example to Keras-3 #1697
Conversation
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!
examples/vision/simsiam.py
Outdated
@@ -41,15 +41,19 @@ | |||
4. We then train our encoder to maximize the cosine similarity between the two different | |||
versions of our dataset. | |||
|
|||
This example requires TensorFlow 2.4 or higher. | |||
This example requires TensorFlow 2.15 or higher. |
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.
You can remove this line.
examples/vision/simsiam.py
Outdated
return x | ||
|
||
|
||
def random_apply(func, x, p): | ||
if tf.random.uniform([], minval=0, maxval=1) < p: | ||
if keras.random.uniform([], minval=0, maxval=1,seed=152) < p: |
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.
Remove the seed
argument, otherwise you'll get the same output at every call
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.
Sure, I have made the necessary changes!
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!
* Migrating SimSiam Example to Keras-3 * Removed Seed and Updated Formatting
This PR migrates the
simsiam
example to Keras 3.0 as requested in this GitHub issue and includes the following changes:keras_cv.layers.RandomSaturation
layer to ensure they fall within the range [0.0, 1.0].