summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJordan Gong <jordan.gong@protonmail.com>2021-01-12 14:19:30 +0800
committerJordan Gong <jordan.gong@protonmail.com>2021-01-12 14:19:30 +0800
commite3ffe09d3b509b718aa5093481a496a8cbf38187 (patch)
tree81e18b724d8b008765f0d7122f2aa3d93efa8742 /test
parent9bd6908ed77410e2efa439d26ebd1f9b60519f53 (diff)
Some changes in hyperparameter config
1. Separate hyperparameter configs in model, optimizer and scheduler 2. Add more tunable hyperparameters in optimizer and scheduler
Diffstat (limited to 'test')
-rw-r--r--test/model.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/test/model.py b/test/model.py
index f679908..5d60475 100644
--- a/test/model.py
+++ b/test/model.py
@@ -2,20 +2,39 @@ import os
from config import config
from models.model import Model
+from utils.dataset import ClipConditions
conf = config
+os.chdir('..')
def test_default_signature():
- os.chdir('..')
model = Model(conf['system'], conf['model'], conf['hyperparameter'])
casiab = model._parse_dataset_config(conf['dataset'])
model._parse_dataloader_config(casiab, conf['dataloader'])
assert model._log_name == os.path.join(
'runs', 'logs', 'RGB-GaitPart_80000_64_128_128_64_1_2_4_True_True_32_5_'
'3_3_3_3_3_2_1_1_1_1_1_0_2_3_4_16_256_0.2_0.0001_0.9_'
- '0.999_CASIA-B_74_30_15_3_64_32_8_16')
+ '0.999_0.001_500_0.9_CASIA-B_74_30_15_3_64_32_8_16')
assert model._signature == ('RGB-GaitPart_80000_0_64_128_128_64_1_2_4_True_'
- 'True_32_5_3_3_3_3_3_2_1_1_1_1_1_0_2_3_4_16_256_'
- '0.2_0.0001_0.9_0.999_CASIA-B_74_30_15_3_64_32_'
- '8_16')
+ 'True_32_5_3_3_3_3_3_2_1_1_1_1_1_0_2_3_4_16_'
+ '256_0.2_0.0001_0.9_0.999_0.001_500_0.9_CASIA-B'
+ '_74_30_15_3_64_32_8_16')
+
+
+def test_default_signature_with_selector():
+ model = Model(conf['system'], conf['model'], conf['hyperparameter'])
+ casiab = model._parse_dataset_config(dict(
+ **conf['dataset'],
+ **{'selector': {'conditions': ClipConditions({r'nm-0\d', r'bg-0\d'})}}
+ ))
+ model._parse_dataloader_config(casiab, conf['dataloader'])
+ assert model._log_name == os.path.join(
+ 'runs', 'logs', 'RGB-GaitPart_80000_64_128_128_64_1_2_4_True_True_32_5_'
+ '3_3_3_3_3_2_1_1_1_1_1_0_2_3_4_16_256_0.2_0.0001_0.9_'
+ '0.999_0.001_500_0.9_CASIA-B_74_30_15_3_64_32_bg-0\\d_'
+ 'nm-0\\d_8_16')
+ assert model._signature == ('RGB-GaitPart_80000_0_64_128_128_64_1_2_4_True_'
+ 'True_32_5_3_3_3_3_3_2_1_1_1_1_1_0_2_3_4_16_'
+ '256_0.2_0.0001_0.9_0.999_0.001_500_0.9_CASIA-B'
+ '_74_30_15_3_64_32_bg-0\\d_nm-0\\d_8_16')