ManiFlow_Policy icon indicating copy to clipboard operation
ManiFlow_Policy copied to clipboard

Clarification about the 2D encoder

Open tkelestemur-bdai opened this issue 1 year ago • 4 comments

In the paper you mention that you are using ResNet18, however, in the configs, you are using the r3m encoder. Can you clarify which one is used for training the 2D policies?

Great work!

tkelestemur-bdai avatar Sep 09 '25 03:09 tkelestemur-bdai

Hi, thank you for your interest! The r3m encoder uses a ResNet18 network, as shown in this line: https://github.com/geyan21/ManiFlow_Policy/blob/eb37c3865071605af9f5e02944debe9470d41259/ManiFlow/maniflow/model/vision_2d/timm_obs_encoder.py#L90 And generally, we found that a learn-from-scratch ResNet18 encoder can be efficient enough for simulation tasks. But for more noisy real-world environments, a larger model like CLIP or DINOv2/v3 can be more generalizable to environment change. We also provide a config for using CLIP in this config: https://github.com/geyan21/ManiFlow_Policy/blob/eb37c3865071605af9f5e02944debe9470d41259/ManiFlow/maniflow/config/maniflow_image_transformer_policy.yaml

geyan21 avatar Sep 09 '25 04:09 geyan21

Thanks for the quick clarification @geyan21. I have a couple of follow up questions regarding the observation encoders.

  • In the paper, it's mentioned that the proprioception data is encoded with 2-layer MLP and there's a dropout applied to them. When I look at the implementation, I see that the batch is forwarded into the obs_encoder which is the timm_obs_encoder and in the forward function of the obs_encoder you are concatenating the low dim keys with the vision tokens. Where is exactly 2-layer MLP and dropout to the state is applied?

  • Following upon the above questions, can you clarify how are the input tokens to the cross attention constructed? Are you using spatial feature from resnet? Are state information become distinct tokens? Overall, I'm trying to understand what is in the vis_cond in this line.

tkelestemur-bdai avatar Sep 09 '25 15:09 tkelestemur-bdai

Thank you for your questions! Regarding the observation encoders:

  • For the first question, the mentioned 2-layer MLP encoding for proprioception is in the 3D point cloud encoder: https://github.com/geyan21/ManiFlow_Policy/blob/eb37c3865071605af9f5e02944debe9470d41259/ManiFlow/maniflow/model/vision_3d/pointnet_extractor.py#L274 For 2D image encoder, we directly adopt the UMI-style image encoder which directly concatenate state info with image features without MLP processing: https://github.com/real-stanford/universal_manipulation_interface/blob/main/diffusion_policy/model/vision/timm_obs_encoder.py And for state dropout, if you mean state masking, we find it's useful to prevent overfitting to proprioception data in some real-world tasks, especially when the number of demonstration data is low. But we did not use that for simulation tasks, and for the simplicity of this codebase, we do not incorporate this part. However, it should be fairly easy to implement by randomly masking the state with zero-value in the dataloader, with a probability p.
  • The vis_cond is 2D or 3D visual features concatenated with state features. We didn't separate state features into distinct tokens but it may be interesting to try that and concatenate state tokens with visual/language tokens.

geyan21 avatar Sep 09 '25 17:09 geyan21

In the paper you mention that you are using ResNet18, however, in the configs, you are using the r3m encoder. Can you clarify which one is used for training the 2D policies?

Great work!

Hi, I want to train the 2D policy, but it appears that "No module named 'r3m'. How can I deal with it

rstonghua avatar May 07 '26 04:05 rstonghua