-
Notifications
You must be signed in to change notification settings - Fork 242
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
Adding Differential Binarization model from PaddleOCR to Keras3 #1739
base: master
Are you sure you want to change the base?
Conversation
Let's split this up. Start with ResNetVD backbone? Some notes...
|
1826dce
to
753047d
Compare
753047d
to
a5e5d8f
Compare
@gowthamkpr is the PR ready for review? |
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! I have left a reorganization comment.
example for structuring the code - https://github.com/keras-team/keras-hub/tree/master/keras_hub/src/models/sam
@@ -0,0 +1,243 @@ | |||
# Copyright 2024 The KerasNLP Authors |
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.
rename folder to differential_binarization
and file to differential_binarization.py
backbone = backbone | ||
|
||
inputs = backbone.input | ||
x = backbone.pyramid_outputs |
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.
please create a file differential_binarization_backbone.py
and move the diffbin_fpn_model
and backbone code into that. You can rename the backbone
you are using in this file to image_encoder
in the differential_binarization_backbone
file. The task model should contain the preprocessor, backbone and the task head
.
from keras import ops | ||
|
||
|
||
class DiceLoss: |
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.
add test coverage for the losses here
Hi @gowthamkpr! can you please refactor the code to KerasHub style?
|
I've refactored using SAM as example.
I've added
I've subclassed
Done. The model is not yet in Kaggle, so I've disabled the presets test for now.
Done. Not sure if there are additional standard test routines other than the ones used in SAM that should be run. |
This adds the Differntial Binarization model for text detection.
Implemented the architecture based on ResNet50_vd from PaddleOCR and ported the weights.