ZFTurbo / volumentations

Library for 3D augmentations
MIT License
220 stars 35 forks source link

AttributeError: 'Tensor' object has no attribute 'astype' #3

Open Kaveh8 opened 2 years ago

Kaveh8 commented 2 years ago

I have got an error complaining about type of img which is in the transforms.py:11, and it uses .astype. Apparently it considers img as a numpy array, while I have using a .map function for a tfdataset.

I think it should consider to convert input to an expected array (numpy for example). Or, even better, it should only use tensorflow functions in order to make it useful for graph mode execution, such as when using .map function.

    <ipython-input-10-149e589e978b>:16 get_augmentation  *
        aug_data = aug(**data)
    /opt/conda/lib/python3.7/site-packages/volumentations/core/composition.py:24 __call__  *
        data = tr(force_apply, self.targets, **data)
    /opt/conda/lib/python3.7/site-packages/volumentations/core/transforms_interface.py:50 __call__  *
        data[k] = self.apply(v, **params)
    /opt/conda/lib/python3.7/site-packages/volumentations/augmentations/transforms.py:11 apply  *
        return img.astype(np.float32)

    AttributeError: 'Tensor' object has no attribute 'astype'