karolmajek/maxdeeplab
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 common.py."""17import tensorflow as tf18 19from deeplab2 import common20 21 22class CommonTest(tf.test.TestCase):23 24 def test_constants_keys(self):25 self.assertEqual(common.PRED_PANOPTIC_KEY, 'panoptic_pred')26 self.assertEqual(common.PRED_SEMANTIC_KEY, 'semantic_pred')27 self.assertEqual(common.PRED_INSTANCE_CENTER_KEY, 'instance_center_pred')28 self.assertEqual(common.PRED_INSTANCE_KEY, 'instance_pred')29 30 self.assertEqual(common.PRED_SEMANTIC_LOGITS_KEY, 'semantic_logits')31 self.assertEqual(common.PRED_CENTER_HEATMAP_KEY, 'center_heatmap')32 self.assertEqual(common.PRED_OFFSET_MAP_KEY, 'offset_map')33 self.assertEqual(common.PRED_FRAME_OFFSET_MAP_KEY, 'frame_offset_map')34 35 self.assertEqual(common.GT_PANOPTIC_KEY, 'panoptic_gt')36 self.assertEqual(common.GT_SEMANTIC_KEY, 'semantic_gt')37 self.assertEqual(common.GT_INSTANCE_CENTER_KEY, 'instance_center_gt')38 self.assertEqual(common.GT_FRAME_OFFSET_KEY, 'frame_offset_gt')39 self.assertEqual(common.GT_INSTANCE_REGRESSION_KEY,40 'instance_regression_gt')41 self.assertEqual(common.GT_PANOPTIC_RAW, 'panoptic_raw')42 self.assertEqual(common.GT_SEMANTIC_RAW, 'semantic_raw')43 self.assertEqual(common.GT_SIZE_RAW, 'size_raw')44 45 self.assertEqual(common.SEMANTIC_LOSS_WEIGHT_KEY, 'semantic_loss_weight')46 self.assertEqual(common.CENTER_LOSS_WEIGHT_KEY, 'center_loss_weight')47 self.assertEqual(common.REGRESSION_LOSS_WEIGHT_KEY,48 'regression_loss_weight')49 self.assertEqual(common.FRAME_REGRESSION_LOSS_WEIGHT_KEY,50 'frame_regression_loss_weight')51 52 self.assertEqual(common.RESIZED_IMAGE, 'resized_image')53 self.assertEqual(common.IMAGE, 'image')54 self.assertEqual(common.IMAGE_NAME, 'image_name')55 self.assertEqual(common.SEQUENCE_ID, 'sequence_id')56 57 self.assertEqual(common.KEY_FRAME_ID, 'video/frame_id')58 self.assertEqual(common.KEY_SEQUENCE_ID, 'video/sequence_id')59 self.assertEqual(common.KEY_LABEL_FORMAT, 'image/segmentation/class/format')60 self.assertEqual(common.KEY_ENCODED_PREV_LABEL,61 'prev_image/segmentation/class/encoded')62 self.assertEqual(common.KEY_ENCODED_LABEL,63 'image/segmentation/class/encoded')64 self.assertEqual(common.KEY_IMAGE_CHANNELS, 'image/channels')65 self.assertEqual(common.KEY_IMAGE_WIDTH, 'image/width')66 self.assertEqual(common.KEY_IMAGE_HEIGHT, 'image/height')67 self.assertEqual(common.KEY_IMAGE_FORMAT, 'image/format')68 self.assertEqual(common.KEY_IMAGE_FILENAME, 'image/filename')69 self.assertEqual(common.KEY_ENCODED_PREV_IMAGE, 'prev_image/encoded')70 self.assertEqual(common.KEY_ENCODED_IMAGE, 'image/encoded')71 72 73if __name__ == '__main__':74 tf.test.main()75 