Skip to content

Commit 97a7bc7

Browse files
committed
Update model inference
1 parent 9d31685 commit 97a7bc7

File tree

2 files changed

+41
-5
lines changed

2 files changed

+41
-5
lines changed

CrowdES/evaluate_synthetic_dataset.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
# Global settings
1010
TRIALS = 1 # Number of trials for each scene
11+
SCENE_LIST = ['synth_scurve',] # List of scenes to use for inference
1112
SCENARIO_LENGTH = 30 * 60 * 10 # Scenario length in frames (30fps * 60s * 10min)
1213
POSTFIX = 'crowdes-synthetic' # Postfix for generated files
1314
EXPORT_VIDEO = True # Export video for visualization
@@ -18,7 +19,7 @@ def main(config, seed=0):
1819
reproducibility_settings(seed=seed)
1920

2021
# Load dataset and framework
21-
dataset_test = SyntheticDataset(config, ['synth_scurve', ]) # ['synth_scurve', 'synth_maze', 'synth_bottleneck', 'cathedral', 'fernsehturm', 'park', 'manhattan']
22+
dataset_test = SyntheticDataset(config, SCENE_LIST) # ['synth_scurve', 'synth_maze', 'synth_bottleneck', 'cathedral', 'fernsehturm', 'park', 'manhattan']
2223
framework = CrowdESFramework(config)
2324

2425
# Start inference

README.md

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
<br>
6060

61-
## Model Training
61+
## 🔥 Model Training
6262
### Setup
6363
**Environment**
6464
<br>All models were trained and tested on Ubuntu 20.04 with Python 3.10 and PyTorch 2.2.2 with CUDA 12.1. You can install all dependencies via following command:
@@ -106,7 +106,7 @@ python trainval.py --model_train simulator --model_config ./configs/model/CrowdE
106106

107107
<br>
108108

109-
## Model Evaluation
109+
## 📊 Model Evaluation
110110
### Pretrained Models
111111
We provide pretrained models in the [**release section**](https://github.com/InhwanBae/Crowd-Behavior-Generation/releases).
112112

@@ -120,7 +120,31 @@ python trainval.py --test --model_config <path_to_model_config>
120120
python trainval.py --test --model_config ./configs/model/CrowdES_eth.yaml
121121
```
122122

123-
### Evaluate CrowdES with Custom Input
123+
<br>
124+
125+
## 🚀 Model Inference
126+
### Export Generated Trajectories
127+
To export the generated trajectories from the CrowdES model, you can use the following command:
128+
```bash
129+
python trainval.py --export --model_config <path_to_model_config>
130+
131+
# Example
132+
python trainval.py --export --model_config ./configs/model/CrowdES_eth.yaml
133+
```
134+
135+
You can also customize the hyperparameters for exporting the generated trajectories by modifying the `CrowdES/evaluate_export_generated_traj.py` file. Here are the default settings:
136+
```python
137+
# CrowdES/evaluate_export_generated_traj.py
138+
L11 │ # Global settings
139+
L12 │ TRIALS = 1 # Number of trials for each scene
140+
L13 │ SCENARIO_LENGTH = 30 * 60 * 10 # Scenario length in frames (30fps * 60s * 10min), if None, use the length of the scene
141+
L14 │ POSTFIX = 'crowdes' # Postfix for the generated scenario files
142+
L15 │ EXPORT_SPATIAL_LAYOUT = True # Export predicted spatial layout
143+
L16 │ EXPORT_SOCIALGAN_DATA = True # Export to text file for trajectory prediction model training
144+
L17 │ EXPORT_VIDEO = True # Export video for visualization
145+
```
146+
147+
### Run CrowdES with Custom Input
124148
To evaluate the CrowdES model with a custom input image, you can use the following command:
125149
```bash
126150
python trainval.py --synthetic --model_config <path_to_model_config>
@@ -129,9 +153,20 @@ python trainval.py --synthetic --model_config <path_to_model_config>
129153
python trainval.py --synthetic --model_config ./configs/model/CrowdES_eth.yaml
130154
```
131155

156+
You can also customize the hyperparameters by modifying the `CrowdES/evaluate_synthetic.py` file. Here are the default settings:
157+
```python
158+
# CrowdES/evaluate_synthetic.py
159+
L09 │ # Global settings
160+
L10 │ TRIALS = 1 # Number of trials for each scene
161+
L11 │ SCENE_LIST = ['synth_scurve',] # List of scenes to use for inference
162+
L12 │ SCENARIO_LENGTH = 30 * 60 * 10 # Scenario length in frames (30fps * 60s * 10min)
163+
L13 │ POSTFIX = 'crowdes-synthetic' # Postfix for generated files
164+
L14 │ EXPORT_VIDEO = True # Export video for visualization
165+
```
166+
132167
<br>
133168

134-
## 3D Visualization
169+
## 🌏 3D Visualization
135170
To visualize the generated crowd behaviors in 3D, we provide a visualization toolkit based on the CARLA simulator. Please follow the instructions in the [3D_Visualization_Toolkit/README](https://github.com/InhwanBae/Crowd-Behavior-Generation/blob/main/3D_Visualization_Toolkit/README.md) file to set up the environment and visualize the results.
136171

137172
<br>

0 commit comments

Comments
 (0)