diff --git a/tests/experimental_tests/links_tests/model_tests/fcis_tests/test_fcis_resnet101.py b/tests/experimental_tests/links_tests/model_tests/fcis_tests/test_fcis_resnet101.py index ed437005ba..243ccd3476 100644 --- a/tests/experimental_tests/links_tests/model_tests/fcis_tests/test_fcis_resnet101.py +++ b/tests/experimental_tests/links_tests/model_tests/fcis_tests/test_fcis_resnet101.py @@ -1,3 +1,4 @@ +import copy import numpy as np import unittest @@ -28,7 +29,7 @@ class TestFCISResNet101(unittest.TestCase): n_test_post_nms = 8 def setUp(self): - params = FCISResNet101.preset_params['sbd'].copy() + params = copy.deepcopy(FCISResNet101.preset_params['sbd']) params['n_fg_class'] = self.n_fg_class proposal_creator_params = params['proposal_creator_params'] proposal_creator_params['n_train_post_nms'] = self.n_train_post_nms @@ -94,7 +95,7 @@ class TestFCISResNet101Loss(unittest.TestCase): n_test_post_nms = 8 def setUp(self): - params = FCISResNet101.preset_params['sbd'].copy() + params = copy.deepcopy(FCISResNet101.preset_params['sbd']) params['n_fg_class'] = self.n_fg_class proposal_creator_params = params['proposal_creator_params'] proposal_creator_params['n_train_post_nms'] = self.n_train_post_nms @@ -136,9 +137,9 @@ class TestFCISResNet101Pretrained(unittest.TestCase): @attr.slow def test_pretrained(self): if self.pretrained_model.startswith('sbd'): - params = FCISResNet101.preset_params['sbd'].copy() + params = copy.deepcopy(FCISResNet101.preset_params['sbd']) elif self.pretrained_model.startswith('coco'): - params = FCISResNet101.preset_params['coco'].copy() + params = copy.deepcopy(FCISResNet101.preset_params['coco']) params['n_fg_class'] = self.n_fg_class params['anchor_scales'] = self.anchor_scales diff --git a/tests/experimental_tests/links_tests/model_tests/pspnet_tests/test_pspnet.py b/tests/experimental_tests/links_tests/model_tests/pspnet_tests/test_pspnet.py index 4e73b83bf8..e0d803e5fc 100644 --- a/tests/experimental_tests/links_tests/model_tests/pspnet_tests/test_pspnet.py +++ b/tests/experimental_tests/links_tests/model_tests/pspnet_tests/test_pspnet.py @@ -1,3 +1,4 @@ +import copy import numpy as np import unittest @@ -19,7 +20,7 @@ class TestPSPNetResNet(unittest.TestCase): def setUp(self): self.n_class = 10 self.input_size = (120, 160) - params = self.model.preset_params['cityscapes'].copy() + params = copy.deepcopy(self.model.preset_params['cityscapes']) params['n_class'] = self.n_class params['input_size'] = self.input_size self.link = self.model(**params) @@ -66,7 +67,7 @@ class TestPSPNetResNetPretrained(unittest.TestCase): @attr.slow def test_pretrained(self): - params = self.model.preset_params['cityscapes'].copy() + params = copy.deepcopy(self.model.preset_params['cityscapes']) params['n_class'] = self.n_class if self.pretrained_model == 'cityscapes': diff --git a/tests/experimental_tests/links_tests/model_tests/yolo_tests/test_yolo_v2_tiny.py b/tests/experimental_tests/links_tests/model_tests/yolo_tests/test_yolo_v2_tiny.py index 19cf8b3153..f79d8bd2bc 100644 --- a/tests/experimental_tests/links_tests/model_tests/yolo_tests/test_yolo_v2_tiny.py +++ b/tests/experimental_tests/links_tests/model_tests/yolo_tests/test_yolo_v2_tiny.py @@ -1,3 +1,4 @@ +import copy import numpy as np import unittest @@ -14,7 +15,7 @@ class TestYOLOv2Tiny(unittest.TestCase): def setUp(self): - params = YOLOv2Tiny.preset_params['voc'].copy() + params = copy.deepcopy(YOLOv2Tiny.preset_params['voc']) params['n_fg_class'] = self.n_fg_class self.link = YOLOv2Tiny(**params) self.insize = 416 @@ -58,7 +59,7 @@ class TestYOLOv2TinyPretrained(unittest.TestCase): @attr.slow def test_pretrained(self): - params = YOLOv2Tiny.preset_params['voc'].copy() + params = copy.deepcopy(YOLOv2Tiny.preset_params['voc']) params['n_fg_class'] = self.n_fg_class if self.pretrained_model == 'voc0712': diff --git a/tests/links_tests/model_tests/deeplab_tests/test_deeplab_v3_plus.py b/tests/links_tests/model_tests/deeplab_tests/test_deeplab_v3_plus.py index 621f7020d0..8e26b02140 100644 --- a/tests/links_tests/model_tests/deeplab_tests/test_deeplab_v3_plus.py +++ b/tests/links_tests/model_tests/deeplab_tests/test_deeplab_v3_plus.py @@ -1,3 +1,4 @@ +import copy import unittest import chainer @@ -17,7 +18,7 @@ class TestDeepLabV3plusXception65(unittest.TestCase): def setUp(self): self.n_class = 10 - params = self.model.preset_params['voc'].copy() + params = copy.deepcopy(self.model.preset_params['voc']) params['n_class'] = self.n_class self.link = self.model(**params) @@ -62,7 +63,7 @@ class TestDeepLabV3plusXception65Pretrained(unittest.TestCase): @attr.slow def test_pretrained(self): - params = self.model.preset_params[self.pretrained_model].copy() + params = copy.deepcopy(self.model.preset_params[self.pretrained_model]) params['n_class'] = self.n_class if self.pretrained_model == 'cityscapes': diff --git a/tests/links_tests/model_tests/faster_rcnn_tests/test_faster_rcnn_vgg.py b/tests/links_tests/model_tests/faster_rcnn_tests/test_faster_rcnn_vgg.py index 59aa2fb5cb..662922f57a 100644 --- a/tests/links_tests/model_tests/faster_rcnn_tests/test_faster_rcnn_vgg.py +++ b/tests/links_tests/model_tests/faster_rcnn_tests/test_faster_rcnn_vgg.py @@ -1,3 +1,4 @@ +import copy import numpy as np import unittest @@ -25,7 +26,7 @@ class TestFasterRCNNVGG16(unittest.TestCase): n_conv5_3_channel = 512 def setUp(self): - params = FasterRCNNVGG16.preset_params['voc'].copy() + params = copy.deepcopy(FasterRCNNVGG16.preset_params['voc']) params['n_fg_class'] = self.n_fg_class proposal_creator_params = params['proposal_creator_params'] proposal_creator_params['n_train_post_nms'] = self.n_train_post_nms @@ -78,7 +79,7 @@ class TestFasterRCNNVGG16Loss(unittest.TestCase): n_fg_class = 20 def setUp(self): - params = FasterRCNNVGG16.preset_params['voc'].copy() + params = copy.deepcopy(FasterRCNNVGG16.preset_params['voc']) params['n_fg_class'] = self.n_fg_class faster_rcnn = FasterRCNNVGG16(pretrained_model=None, **params) self.link = FasterRCNNTrainChain(faster_rcnn) diff --git a/tests/links_tests/model_tests/fpn_tests/test_faster_rcnn_fpn_resnet.py b/tests/links_tests/model_tests/fpn_tests/test_faster_rcnn_fpn_resnet.py index 73886d828a..88d9475779 100644 --- a/tests/links_tests/model_tests/fpn_tests/test_faster_rcnn_fpn_resnet.py +++ b/tests/links_tests/model_tests/fpn_tests/test_faster_rcnn_fpn_resnet.py @@ -1,3 +1,4 @@ +import copy import numpy as np import unittest @@ -19,7 +20,7 @@ class TestFasterRCNNFPNResNet(unittest.TestCase): def setUp(self): - params = self.model.preset_params['coco'].copy() + params = copy.deepcopy(self.model.preset_params['coco']) params['n_fg_class'] = self.n_fg_class params['min_size'] = 66 self.link = self.model(**params) @@ -55,7 +56,7 @@ class TestFasterRCNNFPNResNetPretrained(unittest.TestCase): @attr.slow def test_pretrained(self): - params = self.model.preset_params['coco'].copy() + params = copy.deepcopy(self.model.preset_params['coco']) params['n_fg_class'] = self.n_fg_class if self.pretrained_model == 'coco': diff --git a/tests/links_tests/model_tests/resnet_tests/test_resnet.py b/tests/links_tests/model_tests/resnet_tests/test_resnet.py index 67fb807e80..34e9f99d46 100644 --- a/tests/links_tests/model_tests/resnet_tests/test_resnet.py +++ b/tests/links_tests/model_tests/resnet_tests/test_resnet.py @@ -1,5 +1,6 @@ import unittest +import copy import numpy as np from chainer.testing import attr @@ -34,7 +35,7 @@ class TestResNetCall(unittest.TestCase): def setUp(self): - params = self.model_class.preset_params['imagenet'].copy() + params = copy.deepcopy(self.model_class.preset_params['imagenet']) params['n_class'] = self.n_class self.link = self.model_class( pretrained_model=None, arch=self.arch, **params) @@ -75,7 +76,7 @@ class TestResNetPretrained(unittest.TestCase): @attr.slow def test_pretrained(self): - params = self.model.preset_params[self.pretrained_model].copy() + params = copy.deepcopy(self.model.preset_params[self.pretrained_model]) params['n_class'] = self.n_class params['mean'] = self.mean diff --git a/tests/links_tests/model_tests/segnet_tests/test_segnet_basic.py b/tests/links_tests/model_tests/segnet_tests/test_segnet_basic.py index 182892a763..160cbc3f3e 100644 --- a/tests/links_tests/model_tests/segnet_tests/test_segnet_basic.py +++ b/tests/links_tests/model_tests/segnet_tests/test_segnet_basic.py @@ -1,3 +1,4 @@ +import copy import numpy as np import unittest @@ -17,7 +18,7 @@ class TestSegNetBasic(unittest.TestCase): def setUp(self): self.n_class = 10 - params = SegNetBasic.preset_params['camvid'].copy() + params = copy.deepcopy(SegNetBasic.preset_params['camvid']) params['n_class'] = self.n_class self.link = SegNetBasic(**params) @@ -60,7 +61,7 @@ class TestSegNetPretrained(unittest.TestCase): @attr.slow def test_pretrained(self): - params = SegNetBasic.preset_params['camvid'].copy() + params = copy.deepcopy(SegNetBasic.preset_params['camvid']) params['n_class'] = self.n_class if self.pretrained_model == 'camvid': diff --git a/tests/links_tests/model_tests/senet_tests/test_se_resnet.py b/tests/links_tests/model_tests/senet_tests/test_se_resnet.py index de17c57072..3d23679e0e 100644 --- a/tests/links_tests/model_tests/senet_tests/test_se_resnet.py +++ b/tests/links_tests/model_tests/senet_tests/test_se_resnet.py @@ -1,5 +1,6 @@ import unittest +import copy import numpy as np from chainer.testing import attr @@ -30,7 +31,7 @@ class TestSEResNetCall(unittest.TestCase): def setUp(self): - params = self.model_class.preset_params['imagenet'].copy() + params = copy.deepcopy(self.model_class.preset_params['imagenet']) params['n_class'] = self.n_class self.link = self.model_class( pretrained_model=None, **params) @@ -70,7 +71,7 @@ class TestSEResNetPretrained(unittest.TestCase): @attr.slow def test_pretrained(self): - params = self.model.preset_params[self.pretrained_model].copy() + params = copy.deepcopy(self.model.preset_params[self.pretrained_model]) params['n_class'] = self.n_class params['mean'] = self.mean diff --git a/tests/links_tests/model_tests/senet_tests/test_se_resnext.py b/tests/links_tests/model_tests/senet_tests/test_se_resnext.py index 1d63a67ae6..9013fbe1d6 100644 --- a/tests/links_tests/model_tests/senet_tests/test_se_resnext.py +++ b/tests/links_tests/model_tests/senet_tests/test_se_resnext.py @@ -1,5 +1,6 @@ import unittest +import copy import numpy as np from chainer.testing import attr @@ -28,7 +29,7 @@ class TestSEResNeXtCall(unittest.TestCase): def setUp(self): - params = self.model_class.preset_params['imagenet'].copy() + params = copy.deepcopy(self.model_class.preset_params['imagenet']) params['n_class'] = self.n_class self.link = self.model_class( pretrained_model=None, **params) @@ -68,7 +69,7 @@ class TestSEResNeXtPretrained(unittest.TestCase): @attr.slow def test_pretrained(self): - params = self.model.preset_params[self.pretrained_model].copy() + params = copy.deepcopy(self.model.preset_params[self.pretrained_model]) params['n_class'] = self.n_class params['mean'] = self.mean diff --git a/tests/links_tests/model_tests/ssd_tests/test_ssd_vgg16.py b/tests/links_tests/model_tests/ssd_tests/test_ssd_vgg16.py index 0bb88b3ea1..8882b6ed15 100644 --- a/tests/links_tests/model_tests/ssd_tests/test_ssd_vgg16.py +++ b/tests/links_tests/model_tests/ssd_tests/test_ssd_vgg16.py @@ -1,3 +1,4 @@ +import copy import numpy as np import unittest @@ -17,12 +18,12 @@ class TestSSDVGG16(unittest.TestCase): def setUp(self): if self.insize == 300: - params = SSD300.preset_params['voc'].copy() + params = copy.deepcopy(SSD300.preset_params['voc']) params['n_fg_class'] = self.n_fg_class self.link = SSD300(**params) self.n_bbox = 8732 elif self.insize == 512: - params = SSD300.preset_params['voc'].copy() + params = copy.deepcopy(SSD300.preset_params['voc']) params['n_fg_class'] = self.n_fg_class self.link = SSD512(**params) self.n_bbox = 24564 @@ -61,7 +62,7 @@ class TestSSDVGG16Pretrained(unittest.TestCase): @attr.slow def test_pretrained(self): - params = self.model.preset_params['voc'].copy() + params = copy.deepcopy(self.model.preset_params['voc']) params['n_fg_class'] = self.n_fg_class if self.pretrained_model == 'voc0712': diff --git a/tests/links_tests/model_tests/vgg_tests/test_vgg16.py b/tests/links_tests/model_tests/vgg_tests/test_vgg16.py index 004569cf0b..da852b8825 100644 --- a/tests/links_tests/model_tests/vgg_tests/test_vgg16.py +++ b/tests/links_tests/model_tests/vgg_tests/test_vgg16.py @@ -1,5 +1,6 @@ import unittest +import copy import numpy as np import chainer @@ -20,7 +21,7 @@ class TestVGG16Call(unittest.TestCase): def setUp(self): - params = VGG16.preset_params['imagenet'].copy() + params = copy.deepcopy(VGG16.preset_params['imagenet']) params['n_class'] = self.n_class self.link = VGG16( pretrained_model=None, initialW=Zero(), **params) @@ -60,7 +61,7 @@ class TestVGG16Pretrained(unittest.TestCase): @attr.slow def test_pretrained(self): - params = VGG16.preset_params[self.pretrained_model].copy() + params = copy.deepcopy(VGG16.preset_params[self.pretrained_model]) params['n_class'] = self.n_class params['mean'] = self.mean diff --git a/tests/links_tests/model_tests/yolo_tests/test_yolo_v2.py b/tests/links_tests/model_tests/yolo_tests/test_yolo_v2.py index 7ad7ebcfb2..3957d4501a 100644 --- a/tests/links_tests/model_tests/yolo_tests/test_yolo_v2.py +++ b/tests/links_tests/model_tests/yolo_tests/test_yolo_v2.py @@ -1,3 +1,4 @@ +import copy import numpy as np import unittest @@ -14,7 +15,7 @@ class TestYOLOv2(unittest.TestCase): def setUp(self): - params = YOLOv2.preset_params['voc'].copy() + params = copy.deepcopy(YOLOv2.preset_params['voc']) params['n_fg_class'] = self.n_fg_class self.link = YOLOv2(**params) self.insize = 416 @@ -58,7 +59,7 @@ class TestYOLOv2Pretrained(unittest.TestCase): @attr.slow def test_pretrained(self): - params = YOLOv2.preset_params['voc'].copy() + params = copy.deepcopy(YOLOv2.preset_params['voc']) params['n_fg_class'] = self.n_fg_class if self.pretrained_model == 'voc0712': diff --git a/tests/links_tests/model_tests/yolo_tests/test_yolo_v3.py b/tests/links_tests/model_tests/yolo_tests/test_yolo_v3.py index fd5225d9a7..c9784556ca 100644 --- a/tests/links_tests/model_tests/yolo_tests/test_yolo_v3.py +++ b/tests/links_tests/model_tests/yolo_tests/test_yolo_v3.py @@ -1,3 +1,4 @@ +import copy import numpy as np import unittest @@ -14,7 +15,7 @@ class TestYOLOv3(unittest.TestCase): def setUp(self): - params = YOLOv3.preset_params['voc'].copy() + params = copy.deepcopy(YOLOv3.preset_params['voc']) params['n_fg_class'] = self.n_fg_class self.link = YOLOv3(**params) self.insize = 416 @@ -58,7 +59,7 @@ class TestYOLOv3Pretrained(unittest.TestCase): @attr.slow def test_pretrained(self): - params = YOLOv3.preset_params['voc'].copy() + params = copy.deepcopy(YOLOv3.preset_params['voc']) params['n_fg_class'] = self.n_fg_class if self.pretrained_model == 'voc0712':