Skip to content

Task Sampling

Sampling New Task Instances

Generate fresh instances of existing tasks with randomized elements for variety and robustness testing.

Example: Sampling a pick up trash task, task name = picking_up_trash 1. enter the sampling directory,

cd YOUR_PATH_TO_BEHAVIOR/BEHAVIOR-1K/OmniGibson/omnigibson/sampling

  1. generate json template for the your task,
    python autogenerate_task_custom_list_template.py --activity picking_up_trash
    

Command line will output something like this:

****************************************

{
    "picking_up_trash": {
        "room_types": [
            "living_room",
            "kitchen"
        ],
        "__TODO__SCENE__": {
            "whitelist": {
                "ashcan.n.01": {
                    "ashcan": {
                        "__TODO__MODEL__": null
                    }
                },
                "can__of__soda.n.01": {
                    "can__of__soda": {
                        "__TODO__MODEL__": null
                    }
                }
            },
            "blacklist": {}
        }
    }
}

****************************************
You need to fill in TODO__SCENE and TODO__MODEL yourself, then copy paste the modified json into sampling/task_custom_lists.json. Available scenes can be found at https://behavior.stanford.edu/knowledgebase/scenes/index.html. For MODEL, you could choose any objects that fall into the category, which is ashcan in this case https://behavior.stanford.edu/knowledgebase/synsets/ashcan.n.01.html. An example filled json looks like this:
"picking_up_trash": {
        "room_types": [
            "living_room",
            "kitchen"
        ],
        "house_double_floor_lower": {
            "whitelist": {
                "can__of__soda.n.01": {
                    "can_of_soda": {
                        "itolcg": null,
                        "lugwcz": null,
                        "opivig": null
                    }
                },
                "ashcan.n.01": {
                    "trash_can": {
                        "wkxtxh": null
                    }
                }
            },
            "blacklist": {}
        }
    }

  1. sample task related objects

python sample_b1k_tasks.py --offline --activities picking_up_trash 
After this command, you should see 1 file generated under BEHAVIOR-1K/datasets/2025-challenge-task-instances/scenes, with name like house_double_floor_lower_task_picking_up_trash_0_0_template-partial_rooms.json.

  1. postprocess the file generated by first step, by adding in other static scene objects.

python postprocess_sampled_task.py --overwrite --scene_model house_double_floor_lower --activity picking_up_trash
After this command, you should see another file generated under BEHAVIOR-1K/datasets/2025-challenge-task-instances/scenes: house_double_floor_lower_task_picking_up_trash_0_0_template.json.

  1. randomly generate 100 instances for your task

    python multiply_b1k_tasks.py --partial_save --scene_model house_double_floor_lower --activity picking_up_trash 
    
    After this step, you should see a folder named house_double_floor_lower_task_picking_up_trash_instances appeared under datasets/2025-challenge-task-instances/scenes/house_double_floor_lower/json, in which there are files with name like house_double_floor_lower_task_picking_up_trash_0_(index)_template-tro_state.json.

  2. presample poses for all supported robots

    python presample_robot_pose.py --scene_model house_double_floor_lower --activities picking_up_trash
    

To verify whether your sampling is successful, specify your task name in OmniGibson/omnigibson/configs/r1pro_behavior.yaml and run

python /BEHAVIOR-1K/OmniGibson/omnigibson/examples/environments/behavior_env_demo.py
When prompted, choose to use presample.