-
Notifications
You must be signed in to change notification settings - Fork 2
/
experiment.py
40 lines (28 loc) · 1.28 KB
/
experiment.py
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
from lib.dataset import DrivingDataset
trainDataset = DrivingDataset(videoName='ALL', split='train')
testDataset = DrivingDataset(videoName='ALL', split='test')
devDataset = DrivingDataset(videoName='ALL', split='dev')
from lib.models.pipeline import CombinerModel
model = model = CombinerModel(trainDataset.data.iloc[0, 0].num_features,
sceneGraphEmbeddingSize=64,
imgEmbeddingSize=trainDataset.imageEmbeddingSize,
reducedImgEmbeddingSize=trainDataset.imageEmbeddingSize,
encoderHiddenLayers=[],
numClasses=trainDataset.numClasses,
n_peripheralInputs=trainDataset.peripheralInputSize,
feedForwardHiddenLayers=[128])
model.train(trainDataset, devDataset, epochs=100, lr=0.0005)
import pickle as pkl
import os
def load_metrics(epoch) -> dict:
path = f'./cache'
metricsFileName = os.path.join(path, f'metrics_{epoch}.pkl')
with open(metricsFileName, 'rb') as f:
metrics = pkl.load(f)
return metrics
epoch = 10
metrics = load_metrics(epoch)
accuracy = metrics[10]['devMetrics']['accuracy']
report = metrics[10]['devMetrics']['report']
print(accuracy)
print(report)