test_architectures.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. from __future__ import absolute_import
  15. from __future__ import division
  16. from __future__ import print_function
  17. import unittest
  18. import ppdet
  19. class TestFasterRCNN(unittest.TestCase):
  20. def setUp(self):
  21. self.set_config()
  22. def set_config(self):
  23. self.cfg_file = 'configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.yml'
  24. def test_trainer(self):
  25. # Trainer __init__ will build model and DataLoader
  26. # 'train' and 'eval' mode include dataset loading
  27. # use 'test' mode to simplify tests
  28. cfg = ppdet.core.workspace.load_config(self.cfg_file)
  29. trainer = ppdet.engine.Trainer(cfg, mode='test')
  30. class TestMaskRCNN(TestFasterRCNN):
  31. def set_config(self):
  32. self.cfg_file = 'configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco.yml'
  33. class TestCascadeRCNN(TestFasterRCNN):
  34. def set_config(self):
  35. self.cfg_file = 'configs/cascade_rcnn/cascade_rcnn_r50_fpn_1x_coco.yml'
  36. class TestYolov3(TestFasterRCNN):
  37. def set_config(self):
  38. self.cfg_file = 'configs/yolov3/yolov3_darknet53_270e_coco.yml'
  39. class TestSSD(TestFasterRCNN):
  40. def set_config(self):
  41. self.cfg_file = 'configs/ssd/ssd_vgg16_300_240e_voc.yml'
  42. class TestGFL(TestFasterRCNN):
  43. def set_config(self):
  44. self.cfg_file = 'configs/gfl/gfl_r50_fpn_1x_coco.yml'
  45. class TestPicoDet(TestFasterRCNN):
  46. def set_config(self):
  47. self.cfg_file = 'configs/picodet/picodet_s_320_coco_lcnet.yml'
  48. if __name__ == '__main__':
  49. unittest.main()