Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -247,7 +247,7 @@ def load_models(model_paths):
|
|
247 |
# Load Cargo Vessel model
|
248 |
logging.info("Loading Cargo Vessel model...")
|
249 |
# Cargo Vessel model input dimension
|
250 |
-
cargo_in_dim =
|
251 |
cargo_model = LSTMModelTeacher(in_dim=cargo_in_dim, hidden_dim=200, forecast_horizon=1, n_layers=10, dropout=0.2)
|
252 |
cargo_model.load_state_dict(torch.load(model_paths['cargo_vessel'], map_location=torch.device('cpu')))
|
253 |
cargo_model.eval()
|
@@ -440,8 +440,7 @@ def classical_prediction(file_path, model_choice, min_mmsi, max_mmsi, models, lo
|
|
440 |
# Adjust features_to_scale based on the selected model
|
441 |
if selected_model_name == 'Cargo_Vessel':
|
442 |
features_to_scale = [
|
443 |
-
"mmsi", "
|
444 |
-
"dimension_a_m", "dimension_b_m", "dimension_c_m", "dimension_d_m",
|
445 |
"day", "month", "time_decimal" # Removed 'ship_type'
|
446 |
]
|
447 |
future_features = ['day', 'month', 'time_decimal']
|
@@ -703,7 +702,7 @@ def main():
|
|
703 |
'student_north': 'LSTM_whole_atlantic_horizon1_with_time_decimal_input_batch256_KD_North/horizon1_data_LSTM_whole_atlantic_horizon1_with_time_decimal_input_batch256_KD_North_seq_24/run_1/best_model.pth',
|
704 |
'student_mid': 'LSTM_whole_atlantic_horizon1_with_time_decimal_input_batch256_KD_Mid/horizon1_data_LSTM_whole_atlantic_horizon1_with_time_decimal_input_batch256_KD_Mid_seq_24/run_1/best_model.pth',
|
705 |
'student_south': 'LSTM_whole_atlantic_horizon1_with_time_decimal_input_batch256_KD_South/horizon1_data_LSTM_whole_atlantic_horizon1_with_time_decimal_input_batch256_KD_South_seq_24/run_1/best_model.pth',
|
706 |
-
'cargo_vessel': '
|
707 |
}
|
708 |
|
709 |
scaler_paths = {
|
@@ -711,7 +710,7 @@ def main():
|
|
711 |
'Student_North': 'scaler_train_North_up.joblib',
|
712 |
'Student_Mid': 'scaler_train_Mid_up.joblib',
|
713 |
'Student_South': 'scaler_train_South_up.joblib',
|
714 |
-
'Cargo_Vessel': '
|
715 |
}
|
716 |
|
717 |
|
|
|
247 |
# Load Cargo Vessel model
|
248 |
logging.info("Loading Cargo Vessel model...")
|
249 |
# Cargo Vessel model input dimension
|
250 |
+
cargo_in_dim = 6 + 3 # + 3 future features ('day', 'month', 'time_decimal')
|
251 |
cargo_model = LSTMModelTeacher(in_dim=cargo_in_dim, hidden_dim=200, forecast_horizon=1, n_layers=10, dropout=0.2)
|
252 |
cargo_model.load_state_dict(torch.load(model_paths['cargo_vessel'], map_location=torch.device('cpu')))
|
253 |
cargo_model.eval()
|
|
|
440 |
# Adjust features_to_scale based on the selected model
|
441 |
if selected_model_name == 'Cargo_Vessel':
|
442 |
features_to_scale = [
|
443 |
+
"mmsi", "latitude_degrees", "longitude_degrees",
|
|
|
444 |
"day", "month", "time_decimal" # Removed 'ship_type'
|
445 |
]
|
446 |
future_features = ['day', 'month', 'time_decimal']
|
|
|
702 |
'student_north': 'LSTM_whole_atlantic_horizon1_with_time_decimal_input_batch256_KD_North/horizon1_data_LSTM_whole_atlantic_horizon1_with_time_decimal_input_batch256_KD_North_seq_24/run_1/best_model.pth',
|
703 |
'student_mid': 'LSTM_whole_atlantic_horizon1_with_time_decimal_input_batch256_KD_Mid/horizon1_data_LSTM_whole_atlantic_horizon1_with_time_decimal_input_batch256_KD_Mid_seq_24/run_1/best_model.pth',
|
704 |
'student_south': 'LSTM_whole_atlantic_horizon1_with_time_decimal_input_batch256_KD_South/horizon1_data_LSTM_whole_atlantic_horizon1_with_time_decimal_input_batch256_KD_South_seq_24/run_1/best_model.pth',
|
705 |
+
'cargo_vessel': 'LSTMModel_cargo_horizon1_with_month_day_time_input_batch256_cleaned/horizon_data_LSTMModel_cargo_horizon1_with_month_day_time_input_batch256_cleaned_seq_24/run_1/best_model.pth'
|
706 |
}
|
707 |
|
708 |
scaler_paths = {
|
|
|
710 |
'Student_North': 'scaler_train_North_up.joblib',
|
711 |
'Student_Mid': 'scaler_train_Mid_up.joblib',
|
712 |
'Student_South': 'scaler_train_South_up.joblib',
|
713 |
+
'Cargo_Vessel': 'scaler_features_cargo_cleaned.joblib'
|
714 |
}
|
715 |
|
716 |
|