Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #153 from arraiyopensource/feat/denormalize_points
Feat/denormalize points
- Loading branch information
Showing
30 changed files
with
237 additions
and
252 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
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
Empty file.
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 |
---|---|---|
@@ -1,35 +1,35 @@ | ||
import pytest | ||
|
||
import kornia | ||
import kornia.testing as utils # test utils | ||
from test.common import device_type | ||
|
||
import torch | ||
from torch.autograd import gradcheck | ||
from torch.testing import assert_allclose | ||
from common import device_type | ||
|
||
import kornia as K | ||
import kornia.color as color | ||
import utils | ||
|
||
|
||
class TestRgbToGrayscale: | ||
def test_rgb_to_grayscale(self): | ||
channels, height, width = 3, 4, 5 | ||
img = torch.ones(channels, height, width) | ||
assert K.rgb_to_grayscale(img).shape == (1, height, width) | ||
assert kornia.rgb_to_grayscale(img).shape == (1, height, width) | ||
|
||
def test_rgb_to_grayscale_batch(self): | ||
batch_size, channels, height, width = 2, 3, 4, 5 | ||
img = torch.ones(batch_size, channels, height, width) | ||
assert K.rgb_to_grayscale(img).shape == \ | ||
assert kornia.rgb_to_grayscale(img).shape == \ | ||
(batch_size, 1, height, width) | ||
|
||
def test_gradcheck(self): | ||
batch_size, channels, height, width = 2, 3, 4, 5 | ||
img = torch.ones(batch_size, channels, height, width) | ||
img = utils.tensor_to_gradcheck_var(img) # to var | ||
assert gradcheck(K.rgb_to_grayscale, (img,), raise_exception=True) | ||
assert gradcheck(kornia.rgb_to_grayscale, (img,), raise_exception=True) | ||
|
||
def test_jit(self): | ||
batch_size, channels, height, width = 2, 3, 64, 64 | ||
img = torch.ones(batch_size, channels, height, width) | ||
gray = color.RgbToGrayscale() | ||
gray_traced = torch.jit.trace(color.RgbToGrayscale(), img) | ||
gray = kornia.color.RgbToGrayscale() | ||
gray_traced = torch.jit.trace(kornia.color.RgbToGrayscale(), img) | ||
assert_allclose(gray(img), gray_traced(img)) |
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.