Load data from scratch
This commit is contained in:
@@ -31,12 +31,29 @@ warm = 900
|
||||
pred = 1600
|
||||
start_offset = 30 * 60 - warm
|
||||
end_offset = 30 * 60 - pred
|
||||
base_ds = dataloader.SaveDataset(
|
||||
torch.load("long_dataset.pt"),
|
||||
step=step,
|
||||
start_offset=start_offset,
|
||||
end_offset=end_offset,
|
||||
)
|
||||
|
||||
def load_file_list(path: pathlib.Path):
|
||||
base = path.parent
|
||||
return [
|
||||
(base / f).resolve()
|
||||
for f in path.read_text().splitlines()
|
||||
if (base / f).exists()
|
||||
]
|
||||
|
||||
file_list_path = pathlib.Path("../../cpp/known_routes_and_aircraft.csv")
|
||||
file_list = load_file_list(file_list_path)
|
||||
|
||||
base_ds = dataloader.EvenlySpacedDataset(
|
||||
filepaths=file_list,
|
||||
n_input=30 * 60,
|
||||
n_output=30 * 60,
|
||||
n_windows_per_file=5,
|
||||
step=1,
|
||||
feature_columns=("lat", "lon", "alt", "ias"),
|
||||
context_columns=("last_lat", "last_lon", "last_alt", "last_ias", "last_timestamp"),
|
||||
time_columns=("timestamp", "dt"),
|
||||
target_columns=("lat", "lon", "alt"),
|
||||
)
|
||||
train_ds, val_ds = split_dataset(base_ds)
|
||||
model = cls(
|
||||
time_in=2,
|
||||
@@ -51,7 +68,7 @@ model = cls(
|
||||
device=DEVICE,
|
||||
)
|
||||
|
||||
model.load_state_dict(torch.load("LSTM_wu900_ps150_aw0.001.pt", map_location=torch.device('cpu')))
|
||||
model.load_state_dict(torch.load("LSTM_wu900_ps150_aw0.001.pt"))
|
||||
model.to(DEVICE)
|
||||
model.eval()
|
||||
with torch.no_grad():
|
||||
@@ -72,7 +89,7 @@ with torch.no_grad():
|
||||
lat_true = lat_true.flatten()
|
||||
lon_true = lon_true.flatten()
|
||||
alt_true = alt_true.flatten()
|
||||
results.append(torch.cat([lat_true, lon_true, alt_true, lat_pred, lon_pred, alt_pred], dim=1))
|
||||
results.append(torch.stack([lat_true, lon_true, alt_true, lat_pred, lon_pred, alt_pred], dim=1))
|
||||
|
||||
results_tensor = torch.cat(results, dim=0)
|
||||
np_y_all = results_tensor.cpu().numpy()
|
||||
|
||||
Reference in New Issue
Block a user