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

[Object_Detection] Add MultiScaleAnchorGenerator and docstring for An… #2

Merged
merged 4 commits into from
Jun 16, 2020
Merged

Conversation

tanzhenyu
Copy link
Contributor

[Object_Detection] Add MultiScaleAnchorGenerator

@tanzhenyu tanzhenyu requested a review from fchollet June 15, 2020 18:13
@bhack
Copy link
Contributor

bhack commented Jun 15, 2020

Wow +611 -124 😄

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import tensorflow as tf


class AnchorGenerator(tf.keras.layers.Layer):
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this base class designed over the experience of https://github.com/tensorflow/models/blob/master/research/object_detection/core/anchor_generator.py? Or is this a from scratch design?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question!
This is mostly a scratch design for proof of concept at this moment. Francois and I will send out RFC for public comments and feedbacks later :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep and we intend to make them layers. Though the arguments are slightly different than this directory

from .anchor_generator import AnchorGenerator


class MultiScaleAnchorGenerator(tf.keras.layers.Layer):
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same above

@tanzhenyu
Copy link
Contributor Author

Wow +611 -124 😄

Just moving files and adding comprehensive tests :-)

feature map cell when `anchor_stride=None`, or center of anchor stride otherwise.
clip_boxes: Boolean to represents whether the anchor coordinates should be clipped to the image size.
Defaults to `True`.
norm_coords: Boolean to represents whether the anchor coordinates should be normalized to [0., 1.]
Copy link
Contributor

Choose a reason for hiding this comment

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

In general, prefer fully-spelled out argument names, e.g. normalize_coordinates

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

from .anchor_generator import AnchorGenerator


class MultiScaleAnchorGenerator(tf.keras.layers.Layer):
Copy link
Contributor

Choose a reason for hiding this comment

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

Given the similarity with AnchorGenerator why not subclass it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the class that accepts a list of things and then apply to each one of the anchor generator?

**Must** have the same length as `scales`. For example, if `image_size=(300, 200)`, `scales=[.1]`,
and `aspect_ratios=[.64]`, the base anchor size is 20, then anchor height is 25 and anchor width is 16.
The anchor aspect ratio is independent to the original aspect ratio of image size.
anchor_stride: A list/tuple of 2 ints or floats representing the distance between anchor points.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: why anchor_stride and anchor_offset rather than just stride and offset? It's an anchor generator, after all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Done.

@tanzhenyu tanzhenyu requested a review from fchollet June 15, 2020 23:02
@fchollet
Copy link
Contributor

LGTM!

@tanzhenyu tanzhenyu merged commit bf00322 into keras-team:master Jun 16, 2020
quantumalaviya added a commit to quantumalaviya/keras-cv that referenced this pull request Apr 13, 2022
LukeWood added a commit that referenced this pull request Apr 20, 2022
* add fmix init commit

* fix issues try #1

* fix issues try #2

* change random generator to normal from uniform to support negative values

* add support for variable channels attempt 1

* update fftfreq description

* add changes

* add support for variable label shapes

* add changes

* fix errors

* remove newline

* change name to FourierMix attempt 1

* fixed lint issue

* remove edge softening

* Final pass

Co-authored-by: Luke Wood <lukewoodcs@gmail.com>
ianstenbit referenced this pull request in ianstenbit/keras-cv Aug 6, 2022
* add fmix init commit

* fix issues try #1

* fix issues try #2

* change random generator to normal from uniform to support negative values

* add support for variable channels attempt 1

* update fftfreq description

* add changes

* add support for variable label shapes

* add changes

* fix errors

* remove newline

* change name to FourierMix attempt 1

* fixed lint issue

* remove edge softening

* Final pass

Co-authored-by: Luke Wood <lukewoodcs@gmail.com>
adhadse pushed a commit to adhadse/keras-cv that referenced this pull request Sep 17, 2022
* add fmix init commit

* fix issues try keras-team#1

* fix issues try keras-team#2

* change random generator to normal from uniform to support negative values

* add support for variable channels attempt 1

* update fftfreq description

* add changes

* add support for variable label shapes

* add changes

* fix errors

* remove newline

* change name to FourierMix attempt 1

* fixed lint issue

* remove edge softening

* Final pass

Co-authored-by: Luke Wood <lukewoodcs@gmail.com>
@martin-gorner martin-gorner mentioned this pull request Sep 28, 2022
quantumalaviya added a commit to quantumalaviya/keras-cv that referenced this pull request Oct 30, 2022
quantumalaviya added a commit to quantumalaviya/keras-cv that referenced this pull request Nov 3, 2022
quantumalaviya added a commit to quantumalaviya/keras-cv that referenced this pull request Jan 20, 2023
quantumalaviya added a commit to quantumalaviya/keras-cv that referenced this pull request Jan 29, 2023
quantumalaviya added a commit to quantumalaviya/keras-cv that referenced this pull request Feb 8, 2023
quantumalaviya added a commit to quantumalaviya/keras-cv that referenced this pull request Mar 22, 2023
quantumalaviya added a commit to quantumalaviya/keras-cv that referenced this pull request Mar 22, 2023
quantumalaviya added a commit to quantumalaviya/keras-cv that referenced this pull request Mar 27, 2023
quantumalaviya added a commit to quantumalaviya/keras-cv that referenced this pull request Mar 29, 2023
LukeWood pushed a commit that referenced this pull request Apr 11, 2023
…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
quantumalaviya added a commit to quantumalaviya/keras-cv that referenced this pull request Apr 24, 2023
tirthasheshpatel pushed a commit to tirthasheshpatel/keras-cv that referenced this pull request Jun 5, 2023
…sifier

Port `ResNetV2Backbone`, `EfficientNetV2Backbone`, and `ImageClassifier` to Keras Core
freedomtan pushed a commit to freedomtan/keras-cv that referenced this pull request Jul 20, 2023
Add RandomNormal and RandomUniform Initializers
freedomtan pushed a commit to freedomtan/keras-cv that referenced this pull request Jul 20, 2023
ghost pushed a commit to y-vectorfield/keras-cv that referenced this pull request Nov 16, 2023
…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
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.

3 participants