Added ReflectionPadding Layer In Response To Issue Number: #766 #768
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addressed Issue #766 (Feature Request)
Changes Made
ReflectionPadding1D
,ReflectionPadding2D
andReflectionPadding3D
to support Reflection Padding Layer in Tensorflow's Keras APIReflectionPadding
Functionality inBUILD
fileFiles Modified And Added
tf-keras
|
|_______tf-keras
|
|________layers
|
|________convolutional
|
|_______________base_reflection_padding.py (New File Added)
|
|_______________reflection_padding1d.py (New File Added)
|
|_______________reflection_padding2d.py (New File Added)
|
|_______________reflection_padding3d.py (New File Added)
|
|_______________reflection_padding_test.py (New File Added)
|
|_______________BUILD (Modified File)
Usage
Benefits
Preservation of Spatial Information: Reflection padding preserves spatial information along the borders of the input data by reflecting the values from the interior to the exterior. This helps in retaining the original spatial dimensions of the input.
Reduction of Boundary Artifacts: By reflecting values from inside to outside, reflection padding helps in reducing boundary artifacts that may occur during convolution operations, such as checkerboard artifacts or edge effects.
Improved Performance: Reflection padding can lead to improved performance in tasks where preserving spatial information is crucial, such as image processing or semantic segmentation. It ensures that the features extracted by convolutional layers near the borders are not biased by boundary effects.
Symmetry: Reflection padding maintains symmetry around the borders of the input data, which can be beneficial in tasks where symmetry is important, such as object detection or recognition.
Compatibility with Convolution Operations: Reflection padding seamlessly integrates with standard convolutional operations, requiring minimal modification to existing convolutional neural network architectures.
Flexibility in Padding Size: Reflection padding allows for flexible specification of padding sizes, enabling users to adapt the padding to different input sizes and network architectures easily.
Reduction of Information Loss: Unlike zero padding, which introduces constant values at the borders, reflection padding retains more information from the original input, thereby reducing information loss during convolution operations.
Naturalness in Padding: Reflection padding mimics the natural behavior of light reflections, making it more suitable for tasks involving image processing or computer vision, where preserving naturalness is desired.