inputReader.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:FCN-TensorFlow 作者: shoaibahmed 项目源码 文件源码
def saveLastBatchResults(self, outputImages, isTrain=True):
        """Saves the results of last retrieved image batch
        Args:
          outputImages: 4D Numpy array [batchSize, H, W, numClasses]
          isTrain: If the last batch was training batch
        Returns:
          None
        """
        if isTrain:
            imageNames = [self.imageList[index] for index in self.indices]
        else:
            imageNames = [self.imageListTest[index] for index in self.indices]

        # Iterate over each image name and save the results
        for i in xrange(0, self.options.batchSize):
            imageName = imageNames[i].split('/')
            imageName = imageName[-1]
            if isTrain:
                imageName = self.options.imagesOutputDirectory + '/' + 'train_' + imageName[:-4] + '_prob' + imageName[-4:]
            else:
                imageName = self.options.imagesOutputDirectory + '/' + 'test_' + imageName[:-4] + '_prob' + imageName[-4:]
            # print(imageName)

            # Save foreground probability
            im = np.squeeze(outputImages[i, :, :, 1] * 255)
            im = im.astype(np.uint8)    # Convert image from float to unit8 for saving
            skimage.io.imsave(imageName, im)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号