Skip to content

Commit 9dc6411

Browse files
authored
More robust formatting of the results returned by gpt. (#63)
1 parent 2f613c4 commit 9dc6411

5 files changed

Lines changed: 13 additions & 8 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ CUDA_VISIBLE_DEVICES=0 nohup python apps/image_to_3d.py > /dev/null 2>&1 &
9696
Generate physically plausible 3D assets from image input via the command-line API.
9797
```sh
9898
img3d-cli --image_path apps/assets/example_image/sample_00.jpg apps/assets/example_image/sample_01.jpg \
99-
--n_retry 1 --output_root outputs/imageto3d
99+
--n_retry 2 --output_root outputs/imageto3d
100100

101101
# See result(.urdf/mesh.obj/mesh.glb/gs.ply) in ${output_root}/sample_xx/result
102102
```
@@ -246,7 +246,7 @@ Remove `--insert_robot` if you don't consider the robot pose in layout generatio
246246
CUDA_VISIBLE_DEVICES=0 nohup layout-cli \
247247
--task_descs "apps/assets/example_layout/task_list.txt" \
248248
--bg_list "outputs/bg_scenes/scene_list.txt" \
249-
--n_image_retry 4 --n_asset_retry 3 --n_pipe_retry 2 \
249+
--n_image_retry 4 --n_asset_retry 3 --n_pipe_retry 3 \
250250
--output_root "outputs/layouts_gens" --insert_robot > layouts_gens.log &
251251
```
252252

docs/tutorials/image_to_3d.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Support the use of [SAM3D](https://github.com/facebookresearch/sam-3d-objects) o
1010
```bash
1111
img3d-cli --image_path apps/assets/example_image/sample_00.jpg \
1212
apps/assets/example_image/sample_01.jpg \
13-
--n_retry 1 --output_root outputs/imageto3d
13+
--n_retry 2 --output_root outputs/imageto3d
1414
```
1515

1616
You will get the following results:

docs/tutorials/layout_gen.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ You can also run multiple tasks via a task list file in the backend.
6060
CUDA_VISIBLE_DEVICES=0 nohup layout-cli \
6161
--task_descs "apps/assets/example_layout/task_list.txt" \
6262
--bg_list "outputs/bg_scenes/scene_list.txt" \
63-
--n_image_retry 4 --n_asset_retry 3 --n_pipe_retry 2 \
63+
--n_image_retry 4 --n_asset_retry 3 --n_pipe_retry 3 \
6464
--output_root "outputs/layouts_gens" \
6565
--insert_robot > layouts_gens.log &
6666
```

embodied_gen/scripts/imageto3d.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def parse_args():
105105
parser.add_argument(
106106
"--n_retry",
107107
type=int,
108-
default=2,
108+
default=3,
109109
)
110110
parser.add_argument("--disable_decompose_convex", action="store_true")
111111
parser.add_argument("--texture_size", type=int, default=2048)
@@ -163,7 +163,7 @@ def entrypoint(**kwargs):
163163
outputs = image3d_model_infer(PIPELINE, seg_image, seed)
164164
except Exception as e:
165165
logger.error(
166-
f"[Pipeline Failed] process {image_path}: {e}, skip."
166+
f"[Image3D Failed] process {image_path}: {e}, retry: {try_idx+1}/{args.n_retry}"
167167
)
168168
continue
169169

embodied_gen/validators/urdf_convertor.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,13 @@ def parse_response(self, response: str) -> dict[str, any]:
204204
Returns:
205205
dict[str, any]: Parsed attributes.
206206
"""
207-
lines = response.split("\n")
208-
lines = [line.strip() for line in lines if line]
207+
raw_lines = response.split("\n")
208+
lines = []
209+
for line in raw_lines:
210+
line = line.strip()
211+
if line and not line.startswith("```") and ":" in line:
212+
lines.append(line)
213+
209214
category = lines[0].split(": ")[1]
210215
description = lines[1].split(": ")[1]
211216
min_height, max_height = map(

0 commit comments

Comments
 (0)