Thanks @ptrblck
Your codes work correct but the problem is when I add Local Binary Pattern part in lbp_transfer function I get the error:

from skimage.feature import local_binary_pattern


def lbp_transform(x):
radius = 2
n_points = 8 * radius
METHOD = 'uniform'
imgUMat = np.float32(x)
gray = cv2.cvtColor(imgUMat, cv2.COLOR_RGB2GRAY)

**lbp = local_binary_pattern(gray, n_points, radius, METHOD)**
lbp = torch.from_numpy(lbp)
  
return lbp



tfms = transforms.Compose([


transforms.Lambda(lbp_transform),
transforms.ToPILImage(),
transforms.Resize((300, 300)),
transforms.ToTensor()
])


out = tfms(x)
print(out.shape)

> TypeError: pic should be Tensor or ndarray. Got <class ‘torch.Tensor’>.
My goal is convert all dataset images to texture images by using lbp, but I stocked in this step.

(train_ds[0][0][0]).shape

Shows my dataset image [0] shape, but if I use it by adding “print”, it shows me error,