-
Notifications
You must be signed in to change notification settings - Fork 19.6k
Added the mode "bilinear" in the upscaling2D layer. #10994
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
Merged
fchollet
merged 15 commits into
keras-team:master
from
gabrieldemarmiesse:upsampling_bilinear
Aug 30, 2018
Merged
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
0855745
bilinear upsampling initial implementation
ahundt 4b03e6a
bilinear interpolation docstrings added
ahundt b7c10bd
thano_backend.py fix bilinear interpolation ratio
ahundt 104f209
theano_backend.py pep8 & padding fix
ahundt 73f0311
theano_backend.py remove border_mode as per review
ahundt dcc9dfb
Merge branch 'bilinear_upsampling' of github.com:ahundt/keras into up…
gabrieldemarmiesse bd1b3b4
Added the mode "bilinear" in the upscaling2D layer. Theano only supports
gabrieldemarmiesse 2833ee4
Added some details about what was possible with bilinear interpolation.
gabrieldemarmiesse 8b6baf3
Made the lines shorted in the resize implementation of tensorflow.
gabrieldemarmiesse c4b781e
Added a more meaningful error message for bilinear and CNTK.
gabrieldemarmiesse 9d155e2
Used ' instead of " for consistency.
gabrieldemarmiesse 7770684
Parametrized the bilinear test.
2528906
Removed unused import.
70654da
Fix error messages.
fchollet dac12e9
Parametrized tests.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -862,6 +862,45 @@ def test_upsampling_2d(): | |
| assert_allclose(np_output, expected_out) | ||
|
|
||
|
|
||
| @pytest.mark.skipif((K.backend() == 'cntk'), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please make this test parameterized (see #10975) |
||
| reason='cntk does not support it yet') | ||
| def test_upsampling_2d_bilinear(): | ||
| num_samples = 2 | ||
| stack_size = 2 | ||
| input_num_row = 11 | ||
| input_num_col = 12 | ||
|
|
||
| for data_format in ['channels_first', 'channels_last']: | ||
| if data_format == 'channels_first': | ||
| inputs = np.random.rand(num_samples, stack_size, input_num_row, | ||
| input_num_col) | ||
| else: # tf | ||
| inputs = np.random.rand(num_samples, input_num_row, input_num_col, | ||
| stack_size) | ||
|
|
||
| # basic test | ||
| layer_test(convolutional.UpSampling2D, | ||
| kwargs={'size': (2, 2), | ||
| 'data_format': data_format, | ||
| 'interpolation': 'bilinear'}, | ||
| input_shape=inputs.shape) | ||
|
|
||
| for length_row in [2]: | ||
| for length_col in [2, 3]: | ||
| layer = convolutional.UpSampling2D( | ||
| size=(length_row, length_col), | ||
| data_format=data_format) | ||
| layer.build(inputs.shape) | ||
| outputs = layer(K.variable(inputs)) | ||
| np_output = K.eval(outputs) | ||
| if data_format == 'channels_first': | ||
| assert np_output.shape[2] == length_row * input_num_row | ||
| assert np_output.shape[3] == length_col * input_num_col | ||
| else: # tf | ||
| assert np_output.shape[1] == length_row * input_num_row | ||
| assert np_output.shape[2] == length_col * input_num_col | ||
|
|
||
|
|
||
| @pytest.mark.skipif((K.backend() == 'cntk'), | ||
| reason="cntk does not support it yet") | ||
| def test_upsampling_3d(): | ||
|
|
||
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.
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.
Not used?
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.
True. Let me remove that.