openpi icon indicating copy to clipboard operation
openpi copied to clipboard

image_tool changed shape of tensor when the batchsize is 1

Open Qiza-lyhm opened this issue 1 week ago • 0 comments

https://github.com/Physical-Intelligence/openpi/blob/3e0325a5e6032a9ab6beef7395fe47ca724980a5/src/openpi/shared/image_tools.py#L123

resize_with_pad has the attr "has_batch_dim" and keep the shape if batchsize == 1.

resize_with_pad_torch just drop the first dim when batchsize==1

I'm try to support LeRobotDataset by the following codes, I'm not sure if this issue is a bug or just work as design.

import openpi.models.model as _model item = _model.Observation.from_dict({k:v for k,v in data.items() if k not in not_tensor_keys})

here the data is a tensor dict with 'image', 'image_mask' and 'state' keys. And the image shape is (1, 3, 480, 640), target shape is (224, 224, 3)

Qiza-lyhm avatar Nov 27 '25 07:11 Qiza-lyhm