in a dataset I have target like this:
{'category': 94, 'box_coord': BoundingBoxes([[ 12, 175, 395, 346]], dtype=torch.int32, format=BoundingBoxFormat.XYXY, canvas_size=(416, 416)), 'box_tight': BoundingBoxes([[ 12.5925, 178.8145, 394.3760, 345.4069]], dtype=torch.float64, format=BoundingBoxFormat.XYXY, canvas_size=(416, 416))}
I would expect DataLoader(dataset, batch_size=2) will return BoundingBoxes type.
However, it returns the normal tensor type, because internally it does a stack operation.
This stack operation convert the tv_tensor to normal tensor.
with tv_tensors.set_return_type("TVTensor")
won’t work for some reason:
bounding_boxes = tensor.as_subclass(cls)
AttributeError: 'int' object has no attribute 'as_subclass'
this completely defeated the purpose of the transforms.v2’s go. If After dataloader all the tv_tensors converted to normal tensor, there is no way to recover the lost info which needed to reconstruct the tv_tensor.
I wonder what is the canonical way to let the dataloader return boundingboxes.