Before: I concate image RGB numpy with depthmap
    def __getitem__(self, idx):
        if torch.is_tensor(idx):
            idx = idx.tolist()
        rgb_image_path, dep_image_path, cls_id = self.df.iloc[idx]
        # print(rgb_image_path)
        image = Image.open(rgb_image_path)
        if self.input_channels == 4:
            rgb_image = np.asarray(image)
            misc.imsave("trung.jpg", rgb_image)
            dep_image = np.load(dep_image_path)
            depth_colormap = cv2.applyColorMap(cv2.convertScaleAbs(dep_image, alpha=340), cv2.COLORMAP_JET)
            misc.imsave("trung1.jpg", depth_colormap)
            dep_image = np.expand_dims(dep_image, axis=-1)
            image = np.concatenate((rgb_image, dep_image), axis=-1)
            #print("chua tranform",image)#kieu numpu
            
        if self._transform is not None:
            image = self._transform(image)

            #print("da tranform", image)#kieu tensor
        # There is no need to transfer into One-hot encoding
        # label = torch.zeros(self._num_of_classes, dtype=torch.long).scatter_(0, torch.from_numpy(np.array(cls_id)), 1)
        # label = (np.arange(self._num_of_classes) == cls_id).astype(np.float32)
        #print(image)
        return image, cls_id


After: I using new define function to normalize

class Resize(object):
    """Resize the image in a sample to a given size.
    ** Strongly Recommended use this class only when dealing with RGB-D Images **

    Args:
        output_size (tuple or int): Desired output size. If tuple, output is
            matched to output_size. If int, smaller of image edges is matched
            to output_size keeping aspect ratio the same.
    """

    def __init__(self, output_size):
        assert isinstance(output_size, (int, tuple))
        self.output_size = output_size

    def __call__(self, image):

        #print("co resize:===========================>",image)
        #print("shape:=====================",image.shape)#(256,256,4)
        if isinstance(image, np.ndarray):
            h, w = image.shape[:2]
        else:
            return transforms.Resize(self.output_size)(image)
        if isinstance(self.output_size, int):
            if h > w:
                new_h, new_w = self.output_size * h / w, self.output_size
            else:
                new_h, new_w = self.output_size, self.output_size * w / h
        else:
            new_h, new_w = self.output_size
        new_h, new_w = int(new_h), int(new_w)
        image = transform.resize(image, (new_h, new_w)).astype(np.float32)

        #print("co resize111111:===========================>", image)
        print("shape co resize:=====================",image.shape)
        return image


class RandomHorizontalFlip(object):
    """Horizontally flip the given Image randomly with a given probability.

    Args:
        p (float): probability of the image being flipped. Default value is 0.5
    """

    def __init__(self, p=0.5):
        self.p = p

    def __call__(self, image):
        """
        Args:
            image ( Image): Image to be flipped.

        Returns:
            Image: Randomly flipped image.
        """
        if not isinstance(image, np.ndarray):
            return transforms.RandomHorizontalFlip(p=self.p)(image)
        if random.random() < self.p:
            return np.fliplr(image).astype(np.float32)
        return image

    def __repr__(self):
        return self.__class__.__name__ + '(p={})'.format(self.p)


I think inceptionv3 cannot receive 4 chanel input here, but how about.

Screenshot from 2021-07-05 09-01-581920×1080 306 KB

Please help me.