likyoo / Siam-NestedUNet

The pytorch implementation for "SNUNet-CD: A Densely Connected Siamese Network for Change Detection of VHR Images"
MIT License
252 stars 60 forks source link

Does the same high performance for false color image change detection? #6

Closed NightSongs closed 3 years ago

NightSongs commented 3 years ago

Thank you very much for your work, I am doing a change detection task on false color images, referring to your framework, which is currently performing average on my dataset, and I hope you can guide me in which direction I should improve. Also, for large size tif images, can you provide a source code that can be used to reduce the crop prediction edge effect? I have used my previous semantic segmentation method in your framework with mediocre results, so I would appreciate it if you could provide it!😂😂

NightSongs commented 3 years ago

Thank you very much for your work, I am doing a change detection task on false color images, referring to your framework, which is currently performing average on my dataset, and I hope you can guide me in which direction I should improve. Also, for large size tif images, can you provide a source code that can be used to reduce the crop prediction edge effect? I have used my previous semantic segmentation method in your framework with mediocre results, so I would appreciate it if you could provide it!😂😂

My Email: 916754699@qq.com

likyoo commented 3 years ago

Hi, @NightSongs, thanks for your interest. The dataset used in this repo has been cropped and processed by the original paper --"Change detection in remote sensing images using conditional adversarial networks".

NightSongs commented 3 years ago

Hi, @NightSongs, thanks for your interest. The dataset used in this repo has been cropped and processed by the original paper --"Change detection in remote sensing images using conditional adversarial networks".

emmm,要是有直接预测超大尺寸的遥感影像的代码就比较方便啦,因为小图片输入进去返回的结果有拼接痕迹,我用以前自己的语义分割方法处理过后在您这个代码里还是有一点,就想看看您这里有没有处理过这种问题 顺便,transforms.py中定义的数据增强方法里,Normalize和随机缩放似乎有点问题没办法直接使用,比如Normalize: class Normalize(object): """Normalize a tensor image with mean and standard deviation. Args: mean (tuple): means for each channel. std (tuple): standard deviations for each channel. """ def init(self, mean=(0., 0., 0.), std=(1., 1., 1.)): self.mean = mean self.std = std

def __call__(self, sample):
    img = sample['image']
    mask = sample['label']
    img = np.array(img).astype(np.float32)
    mask = np.array(mask).astype(np.float32)
    img /= 255.0
    img -= self.mean
    img /= self.std

    return {'image': img,
            'label': mask}

这个我修改成了: class Normalize(object): """Normalize a tensor image with mean and standard deviation. 用平均值和标准差归一化图像。 Args: mean (tuple): means for each channel. std (tuple): standard deviations for each channel. mean (元组):每个通道的平均值。 std (元组):每个通道的标准差。 """ def init(self, mean=(0., 0., 0.), std=(1., 1., 1.)): self.mean = mean self.std = std

def __call__(self, sample):  #这里有问题,原始的img是两张图像
    img = sample['image']
    mask = sample['label']

    """
    做出如下修改
    """
    img1 = img[0]
    img2 = img[1]

    img1 = np.array(img1).astype(np.float32)
    img2 = np.array(img2).astype(np.float32)

    #分别进行归一化
    img1 /= 255.0
    img1 -= self.mean
    img1 /= self.std

    img2 /= 255.0
    img2 -= self.mean
    img2 /= self.std

    img = [img1, img2]   #需要返回一个由两个numpy数组组成的图像列表
    return {'image': img,
            'label': mask}

这样就可以正常进行了,缩放似乎也是同样的问题

likyoo commented 3 years ago

@NightSongs 是的,感谢指出!您是正确的。由于我们最终没使用这两个函数,所以忘了更新上去了。如果您方便的话,可以pull一下,代码风格可以参照下该文件中的其他函数 :)