-
Notifications
You must be signed in to change notification settings - Fork 330
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
[Object_Detection] Add BoxCoder for SSD and FasterRCNN #4
Conversation
Just as reminder we have a boxcoder in official/vision |
We do, this is to "graduate" that API, but as a Keras object |
Ok I suppose that this "graduation" could be not API compatible with This just to understand the level of duplicates minimization that we are aspiring and future merging policy for models by an user/contributor point of view. |
So this is exactly being mentioned in: The tentative proposal is to have them in keras-CV, not addons, and can be contributed by model-garden team as well, so we wouldn't be having duplicating low-level APIs such as this in vision/. The proposal is that they will directly make a dependency on this, which is lightweight enough. |
Yes but you have not replied on who is in charge of this process? In a similar case it seems to me more clear tensorflow/community#260 (comment) |
We will probably release the finalized plan soon, which should answer your question. Stay tuned :-) |
kerascv/layers/ssd_box_coder.py
Outdated
$ \hat{width_gt} = log(width_gt / width_a) | ||
$ \hat{height_gt} = log(height_gt / height_a) | ||
|
||
where cx, cy, width, height represents center of width, center of height, width, height respectively, |
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.
Do you have a coding style setting up? It looks this line is too long.
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.
We should follow usual conventions and keep line length below 85 char. Note that black
will not format comments/docstrings.
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.
All that's why :-) Done
from kerascv.layers.ssd_box_coder import SSDBoxCoder | ||
|
||
|
||
def test_encode_decode_variance(): |
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.
Do we want to test all modes (e.g. graph, eager) of keras?
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.
Is that testing util exposed?
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.
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 PR. Let's get a review from the model garden team as well so we can make sure we have a path forward for how this block will be used in the model garden codebase.
kerascv/layers/ssd_box_coder.py
Outdated
$ \hat{width_gt} = log(width_gt / width_a) | ||
$ \hat{height_gt} = log(height_gt / height_a) | ||
|
||
where cx, cy, width, height represents center of width, center of height, width, height respectively, |
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.
We should follow usual conventions and keep line length below 85 char. Note that black
will not format comments/docstrings.
kerascv/layers/ssd_box_coder.py
Outdated
class SSDBoxCoder(tf.keras.layers.Layer): | ||
"""Defines a SSDBoxEncoder that converts encodes the ground_truth_boxes using anchors. | ||
|
||
Mathematically, the encoding is: |
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.
In general, don't use LaTeX in docstrings, as it is hard to read before rendering (and for many people even after rendering). Prefer using Python-like pseudocode.
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.
Done
kerascv/layers/ssd_box_coder.py
Outdated
`ground_truth_boxes` to anchors based on a certain matching strategy (argmax, bipartite) | ||
|
||
# Attributes: | ||
variances: The 1-D scaling factor with 4 floats. This is used to represent the variance of |
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.
It may be preferable to have 4 keyword arguments instead (or potentially 2 tuple arguments, one for the centers and one for the height/width), as it would avoid confusion regarding the order of the 4 floats
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.
Done
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 for API
…d update iou losses (#1296) * first attempt at introducing YoloX * formatted and fixed bugs * cast fix #1 * cast fix #2 * cast fix #3 * cast fix #4 * adding ensure shape for support * reverting and removing ensure_shape * fixed another bug * updated train.py * updated docs, tests and added support for loss strings * first attempt at introducing YoloX * formatted and fixed bugs * adding ensure shape for support * reverting and removing ensure_shape * reformatted by black * fixed a linting issue * finally rebased atop the recent changes * finally rebased atop the new changes * fixed linting issues * reverted rebasing issues with iou loss * fixing rebased errors part 2 * fixed more linting issues * TPU testing changes * linting fixes * updated with implementation details from paper * updated based on review comments and api changes * first attempt at introducing YoloX * updated docs, tests and added support for loss strings * fixed linting issues * reverted rebasing issues with iou loss * review comments * removed examples * linting fix * fixed rebasing error * updated no_reduction warning * review comments * revert version and linting fixes
Port CSPDarkNet and DarkNet to Keras Core
…d update iou losses (keras-team#1296) * first attempt at introducing YoloX * formatted and fixed bugs * cast fix keras-team#1 * cast fix keras-team#2 * cast fix keras-team#3 * cast fix keras-team#4 * adding ensure shape for support * reverting and removing ensure_shape * fixed another bug * updated train.py * updated docs, tests and added support for loss strings * first attempt at introducing YoloX * formatted and fixed bugs * adding ensure shape for support * reverting and removing ensure_shape * reformatted by black * fixed a linting issue * finally rebased atop the recent changes * finally rebased atop the new changes * fixed linting issues * reverted rebasing issues with iou loss * fixing rebased errors part 2 * fixed more linting issues * TPU testing changes * linting fixes * updated with implementation details from paper * updated based on review comments and api changes * first attempt at introducing YoloX * updated docs, tests and added support for loss strings * fixed linting issues * reverted rebasing issues with iou loss * review comments * removed examples * linting fix * fixed rebasing error * updated no_reduction warning * review comments * revert version and linting fixes
Add BoxCoder for SSD and FasterRCNN.