Problem about Image dataset generation
Hello I'm student studying at TU Munich. I currently do the project using robosuite,
I try to train the SAC RL model with lifting. I turn off the camera observation and depth here.
However, I try to use this model to generate image dataset with successful trajectories based on state-based SAC model. I turn on the camera observation and depth here. I got some dimension problem because of two different environments(without and with camera). I want to use this dataset to compare the performance between behavior cloning and flow matching.
Do you think this idea work? Or I have to turn on the camera observation when training the SAC lifting?
Thanks for your help.
This should work. When collecting successful trajectories using your state-based SAC model, make sure to just filter out images before passing in the observations to the state-based model
This should work. When collecting successful trajectories using your state-based SAC model, make sure to just filter out images before passing in the observations to the state-based model
What do you mean filter out image before passing in the observations to the state-based model? Can you explain precisely?
My current approach is to build two environment. First is turn-off camera, second is turning-on camera. First environment tried to predict the action from trained SAC model and second environment tried to read the action and show the camera obs. Is it correct?
Before: 122D state observations
obs.shape = (122,)
After: 28346D camera + depth + state observations
obs.shape = (28346,) # Includes RGB images + depth + state
re: "My current approach is to build two environment. First is turn-off camera, second is turning-on camera. First environment tried to predict the action from trained SAC model and second environment tried to read the action and show the camera obs. Is it correct?"
No, you should just use the second environment. In the second environment obs.shape = (28346,) (if possible) before passing in obs to your SAC model, remove all the elements which correspond to images and depth and only include the portion of obs which corresponds to the state. If you can share the script you are using the collect trajectories that would also be helpful
Thanks for your help. Below is my current scripts to generate the data.
generate_image_dataset_final.py
You mean just use the environment with camera. When trying to load the SAC model(122D), just use current env and filter out the image part? My problem is to load the state-based model that needs the 122D env, so I create one to load it.
"My problem is to load the state-based model that needs the 122D env, so I create one to load it." I see. Once you initialize/load the model, you can discard the state-only env and pass in the observations from the camera-env (after filtering out the image observations) - this should work.
Yes, it can work to generate dataset. But I still got bad result when I try to generate the trajectories. Original model in state environment got 80% success rate. I generate the dataset in camera-enabled environment success rate around 20%. It does not make sense.
Besides, when I try to do the behavior cloning(40 episode), the training plot shows overfitting, and the best test loss is around 30 epochs.
Also, I try to write a wrapper to make state-related dimension load the model to step the environment. The success rate is around 1% when I generate the dataset.
I think it's two environments are not align, so I am brainstorming with other solution. Therefore, I want to try to train the SAC model in camera environment but just use state-related dimension. The other is rewrite other code to capture image. Do you provide the way to record image in low dimension environment? Do you have any suggestion?
If you have a dataset (hdf5 file) with trajectories from a low-dim environment, you should be able to extract camera observations from the dataset as well. You can follow this documentation to extract images: https://robomimic.github.io/docs/datasets/robosuite.html
Closing this for now; feel free to reopen if you have any follow up questions.