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 KerasHub classification guide #1948

Merged
merged 8 commits into from
Oct 15, 2024

Conversation

gowthamkpr
Copy link
Collaborator

Adds the KerasHub image classification guide.

The guide is copied from https://keras.io/guides/keras_cv/classification_with_keras_cv/ and adapted for KerasHub.

@divyashreepathihalli
Copy link
Contributor

divyashreepathihalli commented Oct 4, 2024

Thanks for the PR @gowthamkpr!!
You might want to follow the instruction here https://github.com/keras-team/keras-io?tab=readme-ov-file#adding-a-new-code-example
instead of add_example you would use add_guide
Once you do python tutobooks.py nb2py.... this will generate a .py file. Please add that file under this dir - guides/keras_hub

@fchollet
Copy link
Contributor

fchollet commented Oct 5, 2024

We'll need the Python and md files for the review!

Copy link
Contributor

@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! Quick round of simple comments.

guides/keras_hub/classification_with_keras_hub.py Outdated Show resolved Hide resolved
guides/keras_hub/classification_with_keras_hub.py Outdated Show resolved Hide resolved
guides/keras_hub/classification_with_keras_hub.py Outdated Show resolved Hide resolved
guides/keras_hub/classification_with_keras_hub.py Outdated Show resolved Hide resolved
guides/keras_hub/classification_with_keras_hub.py Outdated Show resolved Hide resolved
@gowthamkpr
Copy link
Collaborator Author

gowthamkpr commented Oct 10, 2024

I've addressed all comments. PTAL!!! Thank you!!

Copy link
Contributor

@divyashreepathihalli divyashreepathihalli left a comment

Choose a reason for hiding this comment

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

One nit comment.
LGTM

modern approaches still are built of several complex components.
Luckily, Keras provides APIs to construct commonly used components.

This guide demonstrates Keras' modular approach to solving image
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: Keras'->kerasHub's

@divyashreepathihalli
Copy link
Contributor

divyashreepathihalli commented Oct 10, 2024

@gowthamkpr, please make sure to run python autogen.py add_guide <.py file> to generate all the other files and you cannot edit anything else manually other than the .py file.

@gowthamkpr
Copy link
Collaborator Author

gowthamkpr commented Oct 11, 2024

@gowthamkpr, please make sure to run python autogen.py add_guide <.py file> to generate all the other files and you cannot edit anything else manually other than the .py file.

I already used autogen.py to generate the files. The issue is that autogen.py generates images but uses absolute paths for images. The only change I made to the .md file is to replace absolute image paths from my local file system to relative paths.

target_lr=self.target_lr,
hold=self.hold,
)

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove empty line

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

hold=self.hold,
)

return ops.where(step > self.total_steps, 0.0, lr)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why set the LR to 0? Should it not be a nonzero min_lr value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no, with cosine decay the lr decays to 0 at the end of training. Actually, we wouldn't need this conditional anyway, since training can't get past total_steps. I assume this was mainly for plotting purposes (it's been copied from the old version of this guide).

@fchollet fchollet merged commit 2daa95d into keras-team:master Oct 15, 2024
3 checks passed
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.

4 participants