MarkFzp / act-plus-plus

Imitation learning algorithms with Co-training for Mobile ALOHA: ACT, Diffusion Policy, VINN
https://mobile-aloha.github.io/
MIT License
2.86k stars 525 forks source link

how to inference? #25

Open tanxr00 opened 6 months ago

tanxr00 commented 6 months ago

Hi, thank you for great work.

I get a issue. How to real-time inference?

or infer a trained scene, can infer a new scene?

anupampatil44 commented 4 months ago

Hey, maybe you could look at replay_episodes.py? It has the following code:

def main(args):
        # dataset_path is the file path to a .h5py file that contains 
    # action (states of the various components) which we then sequentially perform
    dataset_path = args['dataset_path']

    with h5py.File(dataset_path, 'r') as root:
        actions = root['/action'][()]

# load the environment fo the task:
    env = make_sim_env('sim_transfer_cube')
    BOX_POSE[0] = sample_box_pose() # used in sim reset
    ts = env.reset()
    episode_replay = [ts]

    # perform the action-
    for action in actions:
        print("For action:")
        print(action)
        ts = env.step(action)
        episode_replay.append(ts)

A single action may look like-

[-1.2901543e-03 -3.6779362e-01 1.1062293e+00 -2.0220939e-03 -7.3979789e-01 1.4955290e-03 0.0000000e+00 3.1307980e-05 -2.9615888e-01 3.0987167e-01 -3.2766675e-05 1.0336729e+00 5.0244853e-05 1.0000000e+00]