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|
| 11 |
+
|
| 12 |
+
[Ikechukwu Daniel Adebi](https://danieladebi.github.io), [Peter Stone](https://www.cs.utexas.edu/~pstone/), [Mitchell Pryor](https://www.me.utexas.edu/people/faculty-directory/pryor)
|
| 13 |
+
|
| 14 |
+
The University of Texas at Austin
|
| 15 |
+
|
| 16 |
+
## Download Model
|
| 17 |
+
|
| 18 |
+
A pretrained checkpoint is available on HuggingFace:
|
| 19 |
+
[danieladebi/lcamp-model](https://huggingface.co/danieladebi/lcamp-model).
|
| 20 |
+
Download it into `checkpoints/` to skip training and go straight to
|
| 21 |
+
evaluation.
|
| 22 |
+
|
| 23 |
+
You can access our model by downloading the `lcamp_model.pt` checkpoint from the Files tab
|
| 24 |
+
|
| 25 |
+
## Setup
|
| 26 |
+
|
| 27 |
+
1. Create the conda/micromamba environment from `environment_lcamp.yml`:
|
| 28 |
+
```bash
|
| 29 |
+
micromamba create -f environment_lcamp.yml # or: conda env create -f environment_lcamp.yml
|
| 30 |
+
micromamba activate lcamp
|
| 31 |
+
```
|
| 32 |
+
2. Build the LCAMP dataset (only needed once per dataset version), see
|
| 33 |
+
`process_lcamp_dataset.py` / `process_lcamp_dataset.slurm`. This produces a
|
| 34 |
+
dataset directory containing `train_dataset.json`, `test_dataset.json`,
|
| 35 |
+
and `intrinsics.npy`, referenced below as `--data_root`/`--data_dir`.
|
| 36 |
+
|
| 37 |
+
All commands below (`train.py`, `eval.py`) assume the `lcamp` environment is
|
| 38 |
+
active.
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
## Training
|
| 42 |
+
|
| 43 |
+
Training is done with `train.py` via `torchrun` (DDP). The dataset must already
|
| 44 |
+
be built (see `process_lcamp_dataset.py` / `process_lcamp_dataset.slurm`) as a
|
| 45 |
+
directory containing `train_dataset.json`, `test_dataset.json`, and
|
| 46 |
+
`intrinsics.npy`.
|
| 47 |
+
|
| 48 |
+
Single-GPU / local run:
|
| 49 |
+
```bash
|
| 50 |
+
torchrun --nproc_per_node=1 train.py \
|
| 51 |
+
--save_path checkpoints/my_lcamp_model \
|
| 52 |
+
--data_root ./lcamp_dataset_limited_dataset \
|
| 53 |
+
--model_type resnet \
|
| 54 |
+
--epochs 50 \
|
| 55 |
+
--batch_size 64 \
|
| 56 |
+
--lr 1e-3 \
|
| 57 |
+
--min_lr 1e-5 \
|
| 58 |
+
--use_camera_frame \
|
| 59 |
+
--use_depth \
|
| 60 |
+
--use_text_instructions \
|
| 61 |
+
--emphasize_part_mask \
|
| 62 |
+
--lambda_axis 8 \
|
| 63 |
+
--lambda_anchor 2 \
|
| 64 |
+
--lambda_joint 1
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
Multi-GPU (cluster) example:
|
| 68 |
+
```bash
|
| 69 |
+
torchrun --nproc_per_node=8 train.py \
|
| 70 |
+
--save_path "$SCRATCH/lcamp_model_RGB_log_norm_DEPTH_NO_AXIS_SYMMETRY" \
|
| 71 |
+
--data_root "$SCRATCH/lcamp_dataset_off_target_depth_LANGUAGE_EXPLICIT_OBJ_CMDS" \
|
| 72 |
+
--model_type resnet \
|
| 73 |
+
--epochs 50 \
|
| 74 |
+
--warmup_epochs 5 \
|
| 75 |
+
--batch_size 256 \
|
| 76 |
+
--lr 1e-3 \
|
| 77 |
+
--min_lr 1e-5 \
|
| 78 |
+
--use_camera_frame \
|
| 79 |
+
--use_depth \
|
| 80 |
+
--use_text_instructions \
|
| 81 |
+
--emphasize_part_mask \
|
| 82 |
+
--randomize_background \
|
| 83 |
+
--lambda_axis 8 \
|
| 84 |
+
--lambda_anchor 4 \
|
| 85 |
+
--lambda_joint 1 \
|
| 86 |
+
--lambda_plucker 0 \
|
| 87 |
+
--log_dir "$SCRATCH/train_logs" \
|
| 88 |
+
--cluster_loc "stampede3"
|
| 89 |
+
```
|
| 90 |
+
See `train.slurm` / `train_h100.slurm` for full Slurm submission scripts (note:
|
| 91 |
+
those scripts currently hold older `--lr`/`--lambda_anchor`/`--lambda_joint`
|
| 92 |
+
values, update them if you want the Slurm jobs to match the above).
|
| 93 |
+
|
| 94 |
+
Notable flags (`train.py --help` for the complete list):
|
| 95 |
+
- `--model_type`: `resnet` (default LCAMP backbone) or `dino`.
|
| 96 |
+
- `--use_text_instructions`: enables the language-conditioned model
|
| 97 |
+
(`LCAMPModelResnetLanguage`); required if you plan to run the `lcamp`
|
| 98 |
+
backend with instructions in `lcamp_service_node.py`.
|
| 99 |
+
- `--use_depth`: adds depth as an input channel.
|
| 100 |
+
- `--bbox_loc`: predict axis location as `(u,v,z)` decoded via the part
|
| 101 |
+
bounding box instead of raw XYZ, must match `--bbox_loc` in `eval.py` and
|
| 102 |
+
`use_bbox_loc` in `lcamp_service_node.py`/`lcamp.launch.py` for the same
|
| 103 |
+
checkpoint.
|
| 104 |
+
- `--resume` / `--resume_from <path>`: resume from `checkpoint_best.pt` in
|
| 105 |
+
`--save_path`, or from an explicit checkpoint path.
|
| 106 |
+
- `--save_freq`, `--eval_freq`: checkpoint/eval cadence in epochs.
|
| 107 |
+
|
| 108 |
+
Checkpoints are written to `--save_path` as `checkpoint_best.pt`,
|
| 109 |
+
`checkpoint_last.pt`, and periodic `checkpoint_{epoch}.pt` files.
|
| 110 |
+
|
| 111 |
+
## Evaluation
|
| 112 |
+
|
| 113 |
+
Evaluation is done with `eval.py` (single process, no DDP):
|
| 114 |
+
```bash
|
| 115 |
+
python eval.py \
|
| 116 |
+
--model_path checkpoints/my_lcamp_model/checkpoint_best.pt \
|
| 117 |
+
--data_dir ./lcamp_dataset_limited_dataset \
|
| 118 |
+
--split test \
|
| 119 |
+
--model_type resnet \
|
| 120 |
+
--use_camera_frame \
|
| 121 |
+
--use_depth \
|
| 122 |
+
--use_text_instructions \
|
| 123 |
+
--visualize
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
This must use the **same architecture flags used at training time**
|
| 127 |
+
(`--model_type`, `--use_depth`, `--use_text_instructions`,
|
| 128 |
+
`--exclude_object_mask`, `--emphasize_part_mask`/`--emphasize_object_mask`,
|
| 129 |
+
`--bbox_loc`, etc.), mismatches will load state dict weights incorrectly or
|
| 130 |
+
error, and `--use_camera_frame`/`--cluster_loc` must match how the dataset
|
| 131 |
+
was built.
|
| 132 |
+
|
| 133 |
+
Notable flags:
|
| 134 |
+
- `--split`: `train` or `test`.
|
| 135 |
+
- `--visualize`: saves per-sample prediction images.
|
| 136 |
+
- `--random_preds`: baseline using random axis/location predictions.
|
| 137 |
+
- `--free_motion_query_prob`: fraction of eval samples using a free-motion
|
| 138 |
+
(zero-vector) query instead of the GT axis, to measure reliance on visual
|
| 139 |
+
cues vs. the GT axis itself.
|
| 140 |
+
|
| 141 |
+
Results (per-object/per-category success rates, axis/location error, joint
|
| 142 |
+
type accuracy) are written to `results/<model_name>/`, where `<model_name>`
|
| 143 |
+
is derived from `--model_path`.
|
| 144 |
+
|
| 145 |
+
Once you have a checkpoint you're happy with, drop it into `checkpoints/`
|
| 146 |
+
and point the `model_name` launch argument in `launch/lcamp.launch.py` at it
|
| 147 |
+
(see the launch file for details on `use_bbox_loc` and other runtime flags).
|
| 148 |
+
|
| 149 |
+
## Deploying on a Robot
|
| 150 |
+
|
| 151 |
+
Running predictions on a real Boston Dynamics Spot (via the ROS2 service node
|
| 152 |
+
in `scripts/lcamp_service_node.py`) is outside the scope of this README, see
|
| 153 |
+
[ros2_setup/ROS2_SETUP.md](ros2_setup/ROS2_SETUP.md) for that setup.
|