-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexec_simplecnn.py
More file actions
60 lines (53 loc) · 1.49 KB
/
Copy pathexec_simplecnn.py
File metadata and controls
60 lines (53 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python3
from itertools import combinations_with_replacement
import subprocess
import os
# Sólo dos valores de num_conv
base_feats = [8, 16, 32, 64]
feature_sets = [
list(combo)
for r in range(2, 5)
for combo in combinations_with_replacement(base_feats, r)
]
# Directorio de resultados
exp = "SimpleCNN_no_pooling"
results_dir = f"results/{exp}"
os.makedirs(results_dir, exist_ok=True)
for feats in feature_sets:
k = [3 for _ in range(len(feats))]
# nombre de la corrida
feat_str = ",".join(str(f) for f in feats)
kernel_str = ",".join(str(k) for k in k)
run = f"scnn_k_3_f{'_'.join(str(f) for f in feats)}"
if os.path.exists(f"{results_dir}/{run}"):
print(f"→ SKIP: {run} already exists")
continue
# Training
train_cmd = [
"python3",
"-m",
"src.main",
"model=simplecnn",
f"model.features=[{feat_str}]",
f"model.kernels=[{kernel_str}]",
f"exp={exp}",
f"run={run}",
"command=train",
f"train.out_path={results_dir}/{run}",
]
print("→ TRAIN:", " ".join(train_cmd))
subprocess.run(train_cmd, check=True)
# Testing
test_cmd = [
"python3",
"-m",
"src.main",
f"exp={exp}",
f"run={run}",
"model=simplecnn",
f"model.features=[{feat_str}]",
f"model.kernels=[{kernel_str}]",
"command=test",
]
print("→ TEST: ", " ".join(test_cmd))
subprocess.run(test_cmd, check=True)