Skip to content

Commit

Permalink
Adjusted readme, changed name of plot scripts, and added patience to …
Browse files Browse the repository at this point in the history
…experiment configs
  • Loading branch information
AndReGeist committed May 24, 2024
1 parent eb8fd0c commit 9ad4dd8
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 21 deletions.
33 changes: 20 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ pip3 install torch torchvision torchaudio
```

# Experiments

<p float="center">
<img src="/assets/docs/gso_vs_svd1.gif" width="200" />
<img src="/assets/docs/gso_vs_svd2.gif" width="200" />
<img src="/assets/docs/gso_vs_svd3.gif" width="200" />
</p>

All experiments are implemented in PyTorch.
Most experiments simply use [train.py](scripts/train.py).
Depending on which command line arguments are passed (see below),
Expand All @@ -72,7 +79,7 @@ learning results that have been stored using [logger.py](hitchhiking_rotations/u
To reproduce the paper's experiments, download the data, and save it in the `assets/datasets` folder.

> [!NOTE]
> The data is available here: [link](PUT-LINK-HERE)
> The data is available here: [link](https://drive.google.com/drive/folders/1D1FNeKBuFYC2BHxFWgzfm-cj2K3rVhnr?usp=sharing)

### Experiment 1, 2.1, and 2.2
Expand Down Expand Up @@ -100,16 +107,18 @@ for nb in {1..5}; do for seed in {1..20}; do python scripts/train.py --seed $see

To reproduce the paper's figures, run the following commands:

| **Figures** | **Console command** |
|------------------------------------|--------------------------------------|
| Experiment 1 | TBD |
| Experiment 2.1 | `python visu/figure12a.py` |
| Experiment 2.2 | `python visu/figure12b.py` |
| Experiment 3 | TBD |
| Experiment 4 | `python visu/figure14.py` |
| Figure 6 & 18: Lipschitz constants | `python visu/lipschitz_constants.py` |
| Figure 16: MoCap data analysis | TBD |
| Figure 17: Loss gradients | `python visu/loss_gradients.py` |
| **Figures** | **Console command** |
|------------------------------------|---------------------------------------|
| Experiment 1 | `python visu/figure_pointcloud.py` |
| Experiment 2.1 | `python visu/figure_exp2a.py` |
| Experiment 2.2 | `python visu/figure_exp2b.py` |
| Experiment 3 | `python visu/figure_posenet.py` |
| Experiment 4 | `python visu/figure_fourier.py` |
| Figure 6 & 20: Lipschitz constants | `python visu/lipschitz_constants.py` |
| Figure 19: MoCap data analysis | `python visu/figure_mocap.py` |
| Figure 17: Loss gradients | `python visu/loss_gradients.py` |
| Figure 10: Training GSO & SVD | `python visu/gso_vs_svd_animation.py` |
| Figure 11: Gradient ratios of SVD | `python visu/gso_vs_svd.py` |

# Development
### Code Formatting
Expand All @@ -130,5 +139,3 @@ pip3 install addheader
addheader hitchhiking_rotations -t .header.txt -p \*.py --sep-len 79 --comment='#' --sep=' '
```

# Credits
TBD
Binary file added assets/docs/gso_vs_svd1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/docs/gso_vs_svd2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/docs/gso_vs_svd3.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions hitchhiking_rotations/cfgs/cfg_cube_image_to_pose.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def get_cfg_cube_image_to_pose(device):
shared_trainer_cfg = {
"_target_": "hitchhiking_rotations.utils.Trainer",
"lr": 0.001,
"patience": 10,
"optimizer": "Adam",
"logger": "${logger}",
"verbose": "${verbose}",
Expand Down
1 change: 1 addition & 0 deletions hitchhiking_rotations/cfgs/cfg_pcd_to_pose.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def get_cfg_pcd_to_pose(device):
shared_trainer_cfg = {
"_target_": "hitchhiking_rotations.utils.Trainer",
"lr": 0.001,
"patience": 10,
"optimizer": "Adam",
"logger": "${logger}",
"verbose": "${verbose}",
Expand Down
6 changes: 3 additions & 3 deletions scripts/run_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
for seed in range(10):
os.system(f"python3 {p} --experiment {exp} --seed {seed}")
if exp in exps[:2]:
os.system("python3 " + str(os.path.join(HITCHHIKING_ROOT_DIR, "visu", "figure_19.py ") + exp))
os.system("python3 " + str(os.path.join(HITCHHIKING_ROOT_DIR, "visu", "figure_12a.py ") + exp))
os.system("python3 " + str(os.path.join(HITCHHIKING_ROOT_DIR, "visu", "figure_pointcloud.py ") + exp))
os.system("python3 " + str(os.path.join(HITCHHIKING_ROOT_DIR, "visu", "figure_exp2a.py ") + exp))
else:
os.system("python3 " + str(os.path.join(HITCHHIKING_ROOT_DIR, "visu", "figure_12b.py")))
os.system("python3 " + str(os.path.join(HITCHHIKING_ROOT_DIR, "visu", "figure_exp2b.py")))
2 changes: 1 addition & 1 deletion visu/figure_12a.py → visu/figure_exp2a.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
plt.xticks([0.3, 0.4, 0.5, 0.6], ["0.3", "0.4", "0.5", "0.6"])

plt.tight_layout()
out_p = os.path.join(HITCHHIKING_ROOT_DIR, "results", exp, "figure_12a.pdf")
out_p = os.path.join(HITCHHIKING_ROOT_DIR, "results", exp, "figure_exp2a.pdf")

plt.savefig(out_p)
plt.show()
2 changes: 1 addition & 1 deletion visu/figure_12b.py → visu/figure_exp2b.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@
plt.xticks([0.0005, 0.001, 0.002, 0.004], [r"$5\cdot10^{-4}$", r"$10^{-3}$", r"$2\cdot10^{-3}$", r"$4\cdot10^{-3}$"])

plt.tight_layout()
out_p = os.path.join(HITCHHIKING_ROOT_DIR, "results", "pose_to_cube_image", "figure_12b.pdf")
out_p = os.path.join(HITCHHIKING_ROOT_DIR, "results", "pose_to_cube_image", "figure_exp2b.pdf")
plt.savefig(out_p)
plt.show()
2 changes: 1 addition & 1 deletion visu/figure_14.py → visu/figure_fourier.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@
plt.yscale("log")
plt.tight_layout()

out_p = os.path.join(HITCHHIKING_ROOT_DIR, "results", "figure_14.pdf")
out_p = os.path.join(HITCHHIKING_ROOT_DIR, "results", "figure_fourier.pdf")
plt.savefig(out_p)
plt.show()
File renamed without changes.
2 changes: 1 addition & 1 deletion visu/figure_19.py → visu/figure_pointcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
# plt.xscale("log")
plt.tight_layout()

out_p = os.path.join(HITCHHIKING_ROOT_DIR, "results", exp, f"figure_19_combined.pdf")
out_p = os.path.join(HITCHHIKING_ROOT_DIR, "results", exp, f"figure_pointcloud_combined.pdf")

plt.savefig(out_p)

Expand Down
2 changes: 1 addition & 1 deletion visu/figure_13.py → visu/figure_posenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,5 @@ def generate_colormap(base_color, lvl=0.2, alpha=0.5):
plt.grid(True, linestyle="--", color="gray", alpha=0.5)

plt.tight_layout()
plt.savefig(os.path.join(HITCHHIKING_ROOT_DIR, "results", "dense_fusion", "figure_13.pdf"))
plt.savefig(os.path.join(HITCHHIKING_ROOT_DIR, "results", "dense_fusion", "figure_posenet.pdf"))
plt.show()

0 comments on commit 9ad4dd8

Please sign in to comment.