Lifelong-Robot-Learning / LIBERO

Benchmarking Knowledge Transfer in Lifelong Robot Learning
MIT License
249 stars 39 forks source link

Flipped demonstration images #11

Closed minoring closed 11 months ago

minoring commented 1 year ago

Hello, thank you for your excellent work!

I have a concern that might be incorrect, but it appears that the images in the demonstration dataset, both agentview_rgb and eye_in_hand_rgb, seem to be flipped upside down. I noticed this when comparing the first image from env.reset() with a second image from the demonstration data.

KITCHEN_SCENE7_open_the_microwave agentview_image_demo

For reference, this is the code I used to visualize the demonstration data:

import h5py
import cv2
import numpy as np
import argparse

def main():
    # Open the H5 file
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--dataset",
        type=str,
        help="path to hdf5 dataset",
    )
    args = parser.parse_args()

    with h5py.File(args.dataset, "r") as f:

        agentview_images = f["data/demo_0/obs/agentview_rgb"]

        # Display each image in the sequence
        for img in agentview_images:
            # Make video upside down.
            # img = np.flipud(img)
            cv2.imshow("AgentView Image", cv2.cvtColor(img, cv2.COLOR_RGB2BGR))
            cv2.waitKey(100)

        cv2.destroyAllWindows()

if __name__ == '__main__':
    main()
zhuyifengzju commented 1 year ago

Hi, in the codebase, we use the gl image rendering by default (see notebook example: https://github.com/Lifelong-Robot-Learning/LIBERO/blob/master/notebooks/quick_walkthrough.ipynb). Can you double-check if you are using the same image rendering method between both reading from env.reset() and from demonstration data?

minoring commented 1 year ago

Thank you for your response! I'm curious about whether grid_image.numpy()[::-1] flips the image vertically in your shared notebook. Could you please provide some clarification on this? Thanks!

zhuyifengzju commented 1 year ago

Because we are using gl version as default, the image is upside down using the jupyter notebook visualization. It doesn't matter which function to use to visualize images, and you will need to flip images based on if a function assumes gl convention or the cv convention. The important thing is to keep the format of images consistent.

minoring commented 11 months ago

Thank you for your response. I'm closing this issue as everything has been clarified now!