karolmajek/Axial-DeepLab-SWideRNet
0
1# coding=utf-82# Copyright 2021 The Deeplab2 Authors.3#4# Licensed under the Apache License, Version 2.0 (the "License");5# you may not use this file except in compliance with the License.6# You may obtain a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS,12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13# See the License for the specific language governing permissions and14# limitations under the License.15 16"""Tests for autoaugment_policy.py."""17 18import tensorflow as tf19 20from deeplab2.data.preprocessing import autoaugment_policy21 22 23class AutoaugmentPolicyTest(tf.test.TestCase):24 25 def testConvertPolicy(self):26 policy = [5, 1, 10, 5, 3, 4,27 6, 3, 7, 3, 3, 9,28 2, 2, 8, 8, 2, 8,29 1, 4, 9, 4, 5, 7,30 6, 4, 1, 1, 3, 4]31 expected = [32 [('Color', 0.2, 10), ('Color', 0.6, 4)],33 [('Contrast', 0.6, 7), ('Posterize', 0.6, 9)],34 [('Invert', 0.4, 8), ('Sharpness', 0.4, 8)],35 [('Equalize', 0.8, 9), ('Solarize', 1.0, 7)],36 [('Contrast', 0.8, 1), ('Equalize', 0.6, 4)],37 ]38 policy_list = autoaugment_policy.convert_policy(policy)39 self.assertAllEqual(policy_list, expected)40 41 42if __name__ == '__main__':43 tf.test.main()44 