|
62 | 62 |
|
63 | 63 | class Trainer(object): |
64 | 64 | def __init__(self, cfg, mode='train'): |
65 | | - self.cfg = cfg |
| 65 | + self.cfg = cfg.copy() |
66 | 66 | assert mode.lower() in ['train', 'eval', 'test'], \ |
67 | 67 | "mode should be 'train', 'eval' or 'test'" |
68 | 68 | self.mode = mode.lower() |
@@ -99,12 +99,12 @@ def __init__(self, cfg, mode='train'): |
99 | 99 | self.dataset, cfg.worker_num) |
100 | 100 |
|
101 | 101 | if cfg.architecture == 'JDE' and self.mode == 'train': |
102 | | - cfg['JDEEmbeddingHead'][ |
| 102 | + self.cfg['JDEEmbeddingHead'][ |
103 | 103 | 'num_identities'] = self.dataset.num_identities_dict[0] |
104 | 104 | # JDE only support single class MOT now. |
105 | 105 |
|
106 | 106 | if cfg.architecture == 'FairMOT' and self.mode == 'train': |
107 | | - cfg['FairMOTEmbeddingHead'][ |
| 107 | + self.cfg['FairMOTEmbeddingHead'][ |
108 | 108 | 'num_identities_dict'] = self.dataset.num_identities_dict |
109 | 109 | # FairMOT support single class and multi-class MOT now. |
110 | 110 |
|
@@ -149,7 +149,7 @@ def __init__(self, cfg, mode='train'): |
149 | 149 | reader_name = '{}Reader'.format(self.mode.capitalize()) |
150 | 150 | # If metric is VOC, need to be set collate_batch=False. |
151 | 151 | if cfg.metric == 'VOC': |
152 | | - cfg[reader_name]['collate_batch'] = False |
| 152 | + self.cfg[reader_name]['collate_batch'] = False |
153 | 153 | self.loader = create(reader_name)(self.dataset, cfg.worker_num, |
154 | 154 | self._eval_batch_sampler) |
155 | 155 | # TestDataset build after user set images, skip loader creation here |
|
0 commit comments