12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import copy
- import paddlers.transforms as T
- from testing_utils import CpuCommonTest
- from data import build_input_from_file
- __all__ = ['TestMatchHistograms', 'TestMatchByRegression']
- class TestMatchHistograms(CpuCommonTest):
- def setUp(self):
- self.inputs = [
- build_input_from_file(
- "data/ssmt/test_mixed_binary.txt", prefix="./data/ssmt")
- ]
- def test_output_shape(self):
- decoder = T.DecodeImg()
- for input in copy.deepcopy(self.inputs):
- for sample in input:
- sample = decoder(sample)
- im_out = T.functions.match_histograms(sample['image'],
- sample['image2'])
- self.check_output_equal(im_out.shape, sample['image2'].shape)
- im_out = T.functions.match_histograms(sample['image2'],
- sample['image'])
- self.check_output_equal(im_out.shape, sample['image'].shape)
- class TestMatchByRegression(CpuCommonTest):
- def setUp(self):
- self.inputs = [
- build_input_from_file(
- "data/ssmt/test_mixed_binary.txt", prefix="./data/ssmt")
- ]
- def test_output_shape(self):
- decoder = T.DecodeImg()
- for input in copy.deepcopy(self.inputs):
- for sample in input:
- sample = decoder(sample)
- im_out = T.functions.match_by_regression(sample['image'],
- sample['image2'])
- self.check_output_equal(im_out.shape, sample['image2'].shape)
- im_out = T.functions.match_by_regression(sample['image2'],
- sample['image'])
- self.check_output_equal(im_out.shape, sample['image'].shape)
|