diff --git a/embodied_gen/data/mesh_operator.py b/embodied_gen/data/mesh_operator.py index 8d41ba0..4954900 100644 --- a/embodied_gen/data/mesh_operator.py +++ b/embodied_gen/data/mesh_operator.py @@ -403,6 +403,7 @@ class MeshFixer(object): ) mesh.clean(inplace=True) mesh.clear_data() + mesh = mesh.triangulate() mesh = mesh.decimate(ratio, progress_bar=True) # Update vertices and faces diff --git a/embodied_gen/models/layout.py b/embodied_gen/models/layout.py index c3e9f23..9613269 100644 --- a/embodied_gen/models/layout.py +++ b/embodied_gen/models/layout.py @@ -81,6 +81,7 @@ LAYOUT_DISASSEMBLE_PROMPT = f""" - Containers that hold objects (e.g., "bowl of apples", "box of tools") must be separated into individual items (e.g., ["bowl", "apple1", "apple2"]). - Do not include transparent objects such as "glass", "plastic", etc. + - All {Scene3DItemEnum.MANIPULATED_OBJS} and {Scene3DItemEnum.DISTRACTOR_OBJS} must be child node of {Scene3DItemEnum.CONTEXT}. - The output must be in compact JSON format and use Markdown syntax, just like the output in the example below. Examples: diff --git a/embodied_gen/scripts/gen_layout.py b/embodied_gen/scripts/gen_layout.py index c78b0df..591402c 100644 --- a/embodied_gen/scripts/gen_layout.py +++ b/embodied_gen/scripts/gen_layout.py @@ -118,6 +118,16 @@ def entrypoint() -> None: match_key = SCENE_MATCHER.query( text, str(scene_dict), params=gpt_params ) + n_max_attempt = 10 + while match_key not in scene_dict and n_max_attempt > 0: + logger.error( + f"Cannot find matched scene {match_key}, retrying left {n_max_attempt}..." + ) + match_key = SCENE_MATCHER.query( + text, str(scene_dict), params=gpt_params + ) + n_max_attempt -= 1 + match_scene_path = f"{os.path.dirname(args.bg_list)}/{match_key}" bg_save_dir = os.path.join(output_root, "background") copytree(match_scene_path, bg_save_dir, dirs_exist_ok=True) diff --git a/embodied_gen/validators/quality_checkers.py b/embodied_gen/validators/quality_checkers.py index 378e3af..65e236c 100644 --- a/embodied_gen/validators/quality_checkers.py +++ b/embodied_gen/validators/quality_checkers.py @@ -513,21 +513,23 @@ class SemanticMatcher(BaseChecker): - If there are fewer than distinct relevant matches, repeat the closest ones to make a list of . - Only output the list of scene IDs, sorted from most to less similar. - Do NOT use markdown, JSON code blocks, or any formatting syntax, only return a plain list like ["id1", ...]. + - The returned scene ID must exist in the dictionary and be in exactly the same format. For example, + if the key in the dictionary is "scene_0040", return "scene_0040"; if it is "scene_040", return "scene_040". Input example: Dictionary: "{{ - "t_scene_008": "A study room with full bookshelves and a lamp in the corner.", + "t_scene_0008": "A study room with full bookshelves and a lamp in the corner.", "t_scene_019": "A child's bedroom with pink walls and a small desk.", "t_scene_020": "A living room with a wooden floor.", "t_scene_021": "A living room with toys scattered on the floor.", ... - "t_scene_office_001": "A very spacious, modern open-plan office with wide desks and no people, panoramic view." + "t_scene_office_0001": "A very spacious, modern open-plan office with wide desks and no people, panoramic view." }}" Text: "A traditional indoor room" Output: - '["t_scene_office_001", ...]' + '["t_scene_office_0001", ...]' Input: Dictionary: