forked from keras-team/keras-cv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into segformer_tf
- Loading branch information
Showing
179 changed files
with
3,555 additions
and
2,096 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
name: Bug | ||
about: File a bug/issue | ||
title: '' | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
<!-- | ||
Note: Please search to see if an issue already exists for the bug you encountered. | ||
--> | ||
|
||
### Current Behavior: | ||
<!-- A concise description of what you're experiencing. --> | ||
|
||
### Expected Behavior: | ||
<!-- A concise description of what you expected to happen. --> | ||
|
||
### Steps To Reproduce: | ||
<!-- | ||
Please include a minimal colab gist replicating the issue you encountered. | ||
THIS IS CRITICAL FOR US TO HELP YOU. It is very difficult to fix an issue from a | ||
stack trace alone. | ||
To save a gist, choose "File > Save a copy as Github Gist" in colab. This | ||
ensures that your colab is accessible to all users. | ||
Exception: Any issues related to installation outside of colab or where | ||
replication is not important to addressing your concern. | ||
--> | ||
|
||
### Version: | ||
<!-- | ||
Example: | ||
- HEAD | ||
- 0.6.1 | ||
--> | ||
|
||
### Anything else: | ||
<!-- | ||
Links? References? Anything that will give us more context about the issue that | ||
you are encountering! | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
examples/layers/preprocessing/segmentation/aug_mix_demo.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright 2023 The KerasCV Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# 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. | ||
"""aug_mix_demo.py shows how to use the AugMix preprocessing layer. | ||
Uses the oxford iiit pet_dataset. In this script the pets | ||
are loaded, then are passed through the preprocessing layers. | ||
Finally, they are shown using matplotlib. | ||
""" | ||
import demo_utils | ||
import tensorflow as tf | ||
|
||
from keras_cv.layers import preprocessing | ||
|
||
|
||
def main(): | ||
ds = demo_utils.load_oxford_iiit_pet_dataset() | ||
augmix = preprocessing.AugMix([0, 255]) | ||
ds = ds.map(augmix, num_parallel_calls=tf.data.AUTOTUNE) | ||
demo_utils.visualize_dataset(ds) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
examples/layers/preprocessing/segmentation/fourier_mix_demo.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright 2023 The KerasCV Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# 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. | ||
"""fourier_mix_demo.py shows how to use the FourierMix preprocessing layer. | ||
Uses the oxford iiit pet_dataset. In this script the pets | ||
are loaded, then are passed through the preprocessing layers. | ||
Finally, they are shown using matplotlib. | ||
""" | ||
import demo_utils | ||
import tensorflow as tf | ||
|
||
from keras_cv.layers import preprocessing | ||
|
||
|
||
def main(): | ||
ds = demo_utils.load_oxford_iiit_pet_dataset() | ||
fouriermix = preprocessing.FourierMix(alpha=0.8) | ||
ds = ds.map(fouriermix, num_parallel_calls=tf.data.AUTOTUNE) | ||
demo_utils.visualize_dataset(ds) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
33 changes: 33 additions & 0 deletions
33
examples/layers/preprocessing/segmentation/random_translation_demo.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright 2023 The KerasCV Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# 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. | ||
"""random_translation_demo.py shows how to use the RandomTranslation | ||
preprocessing layer. Uses the oxford iiit pet_dataset. In this | ||
script the pets are loaded, then are passed through the | ||
preprocessing layers. Finally, they are shown using matplotlib. | ||
""" | ||
import demo_utils | ||
import tensorflow as tf | ||
|
||
from keras_cv.layers import preprocessing | ||
|
||
|
||
def main(): | ||
ds = demo_utils.load_oxford_iiit_pet_dataset() | ||
randomcutout = preprocessing.RandomTranslation(0.5, 0.5) | ||
ds = ds.map(randomcutout, num_parallel_calls=tf.data.AUTOTUNE) | ||
demo_utils.visualize_dataset(ds) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Copyright 2023 The KerasCV Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# 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 types | ||
|
||
from keras_cv.backend import keras | ||
|
||
try: | ||
import namex | ||
except ImportError: | ||
namex = None | ||
|
||
|
||
def maybe_register_serializable(symbol, package): | ||
if isinstance(symbol, types.FunctionType) or hasattr(symbol, "get_config"): | ||
keras.saving.register_keras_serializable(package=package)(symbol) | ||
|
||
|
||
if namex: | ||
|
||
class keras_cv_export(namex.export): | ||
def __init__(self, path, package="keras_cv"): | ||
super().__init__(package="keras_cv", path=path) | ||
self.package = package | ||
|
||
def __call__(self, symbol): | ||
maybe_register_serializable(symbol, self.package) | ||
return super().__call__(symbol) | ||
|
||
else: | ||
|
||
class keras_cv_export: | ||
def __init__(self, path, package="keras_cv"): | ||
self.package = package | ||
|
||
def __call__(self, symbol): | ||
maybe_register_serializable(symbol, self.package) | ||
return symbol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.