示例#1
0
    def __getitem__(self, item):
        row, col, label = self.coordinate_label[:, item]
        spectral_vector = getVectorByCoordinate(self.cube, int(row), int(col))

        if self.transform != None:
            spectral_vector = self.transform(spectral_vector)

        return spectral_vector, int(label)
示例#2
0
    def __getitem__(self, item):
        row, col, label = self.coordinate_label[item]
        spectral_vector = getVectorByCoordinate(self.cube, int(row), int(col))
        pca_cube = getCubeByCoordinate(self.pca_cube,
                                       int(row),
                                       int(col),
                                       radius=30)

        if self.transform != None:
            spectral_vector = self.transform(spectral_vector)
        if self.test:
            return spectral_vector, pca_cube, int(label), row, col
        return spectral_vector, pca_cube, int(label)
示例#3
0
    def __getitem__(self, item):
        row, col, label = self.coordinate_label[item]
        # row, col = self.indexToCoordinate(row_col, self.cube.shape[0])
        # gt = self.gt[row, col]
        # if int(gt) == int(label):
        #     print("yes")
        # else:
        #     print("no ", "gt: ", gt, " label: ", label)
        spectral_vector = getVectorByCoordinate(self.cube, int(row), int(col))
        spectral_cube_b = getCubeByCoordinate(self.cube, row, col,
                                              self.cube_radius)
        spectral_cube_s = getCubeByCoordinate(self.cube, row, col,
                                              self.cube_radius - 2)

        if self.transform != None:
            spectral_vector = self.transform(spectral_vector)
        spectral_cube_b = self.totensor(spectral_cube_b)
        spectral_cube_s = self.totensor(spectral_cube_s)

        return spectral_vector, spectral_cube_b, spectral_cube_s, int(label)