-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_trajnet.py
57 lines (30 loc) · 1.09 KB
/
test_trajnet.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import pandas as pd
import yaml
import argparse
import torch
from model import TrajCoordAE
name = 'zara2'
CONFIG_FILE_PATH = 'config/sdd_trajnet.yaml'
EXPERIMENT_NAME = f'{name}_trajnet'
DATASET_NAME = "eth"
TEST_DATA_PATH = f'data/eth_ucy/{name}_test.pkl'
TEST_IMAGE_PATH = 'data/eth_ucy'
OBS_LEN = 8 # in timesteps
PRED_LEN = 12 # in timesteps
NUM_GOALS = 5 # K_e
NUM_TRAJ = 1 # K_a
ROUNDS = 1
BATCH_SIZE = 48
with open(CONFIG_FILE_PATH) as file:
params = yaml.load(file, Loader=yaml.FullLoader)
# experiment_name = CONFIG_FILE_PATH.split('.yaml')[0].split('config/')[1]
#### Load preprocessed Data
df_test = pd.read_pickle(TEST_DATA_PATH)
df_test.head()
#### Initiate model and load pretrained weights
model = TrajCoordAE(obs_len=OBS_LEN, pred_len=PRED_LEN, params=params)
model.load(f'save_model/{EXPERIMENT_NAME}_weights.pt')
#### Evaluate model
model.evaluate(df_test, params, image_path=TEST_IMAGE_PATH,
batch_size=BATCH_SIZE, rounds=ROUNDS,exp_name=EXPERIMENT_NAME,
num_goals=NUM_GOALS, num_traj=NUM_TRAJ, device=None, dataset_name=DATASET_NAME)