Spectral-Spatial Residual Network for Hyperspectral Image Classification--SSRN代码执行问题

论文:Spectral-Spatial Residual Network for Hyperspectral Image Classification: A 3-D Deep Learning Framework

代码 SSRN。路径首先修改

然后 写入path2对应的文件内容时候出错。后来修改了modelstatsrecord.py中三个函数中的代码,如黑体显示的部分,改为斜体显示的内容

def outputStats_assess(KAPPA_AE, OA_AE, AA_AE, ELEMENT_ACC_AE, CATEGORY, path1, path2):


    f = open(path1, 'a')

    sentence0 = 'KAPPAs, mean_KAPPA ± std_KAPPA for each iteration are:' + str(KAPPA_AE) + str(np.mean(KAPPA_AE)) + ' ± ' + str(np.std(KAPPA_AE)) + '\n'
    f.write(sentence0)
    sentence1 = 'OAs, mean_OA ± std_OA for each iteration are:' + str(OA_AE) + str(np.mean(OA_AE)) + ' ± ' + str(np.std(OA_AE)) + '\n'
    f.write(sentence1)
    sentence2 = 'AAs, mean_AA ± std_AA for each iteration are:' + str(AA_AE) + str(np.mean(AA_AE)) + ' ± ' + str(np.std(AA_AE)) + '\n'
    f.write(sentence2)

    element_mean = np.mean(ELEMENT_ACC_AE, axis=0)
    element_std = np.std(ELEMENT_ACC_AE, axis=0)
    sentence5 = "Mean of all elements in confusion matrix:" + str(np.mean(ELEMENT_ACC_AE, axis=0)) + '\n'
    f.write(sentence5)
    sentence6 = "Standard deviation of all elements in confusion matrix" + str(np.std(ELEMENT_ACC_AE, axis=0)) + '\n'+ '\n'
    f.write(sentence6)

    f.close()
    '''
    # BELOW IS ERROR 
    print_matrix = np.zeros((CATEGORY), dtype=object)
    for i in range(CATEGORY):
        print_matrix[i] = str(element_mean[i]) + " ± " + str(element_std[i])

    np.savetxt(path2, print_matrix.astype(str), fmt='%s', delimiter="\t",
               newline='\n')
    '''
    #BELOW IS CORRECT 2019.3.13

    f = open(path2, 'a')
    print_matrix = np.zeros((CATEGORY), dtype=object)
    for i in range(CATEGORY):
        print_matrix[i] = str(element_mean[i]) + " ± " + str(element_std[i])+ '\n'+ '\n'
        f.write(print_matrix[i])
    f.close()

 

2、up_classification_maps.py执行时候的问题:

 

/home/gis/anaconda3/envs/Pytguo27/bin/python /home/gis/Downloads/pycharm-community-2017.2/helpers/pydev/pydevd.py --multiproc --qt-support=auto --client 127.0.0.1 --port 44567 --file "/home/gis/PycharmProjects/guo/SSRN-master/Classification Maps/UP_classification_maps.py"
Connected to pydev debugger (build 172.3317.103)
pydev debugger: process 1281 is connecting

Using TensorFlow backend.
(610, 340, 103)
/home/gis/.local/lib/python2.7/site-packages/sklearn/utils/validation.py:475: DataConversionWarning: Data with input dtype uint16 was converted to float64 by the scale function.
  warnings.warn(msg, DataConversionWarning)
# 1 Iteration
('input shape:', 103)
('input shape:', (None, 7, 7, 49, 24))
('conv_spc_result shape:', (None, 7, 7, 1, 128))
('conv1 shape:', (None, 5, 5, 1, 24))
('input shape:', (None, 5, 5, 1, 24))
2019-03-13 21:10:06.185106: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2019-03-13 21:10:06.259797: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:895] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-03-13 21:10:06.260048: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1105] Found device 0 with properties: 
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.683
pciBusID: 0000:01:00.0
totalMemory: 10.92GiB freeMemory: 10.76GiB
2019-03-13 21:10:06.260059: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1195] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1)
Backend TkAgg is interactive backend. Turning interactive mode on.
Traceback (most recent call last):
  File "/home/gis/Downloads/pycharm-community-2017.2/helpers/pydev/pydevd.py", line 1596, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/home/gis/Downloads/pycharm-community-2017.2/helpers/pydev/pydevd.py", line 1023, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/home/gis/PycharmProjects/guo/SSRN-master/Classification Maps/UP_classification_maps.py", line 220, in <module>
    classification_map(y_re, gt_IN, 24, "../Cmaps/RES4_SS_UP1.png")
  File "/home/gis/PycharmProjects/guo/SSRN-master/Classification Maps/UP_classification_maps.py", line 63, in classification_map
    ax.imshow(map, aspect='normal')
  File "/home/gis/.local/lib/python2.7/site-packages/matplotlib/__init__.py", line 1867, in inner
    return func(ax, *args, **kwargs)
  File "/home/gis/.local/lib/python2.7/site-packages/matplotlib/axes/_axes.py", line 5496, in imshow
    self.set_aspect(aspect)
  File "/home/gis/.local/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 1373, in set_aspect
    aspect = float(aspect)  # raise ValueError if necessary
ValueError: could not convert string to float: normal
不知道如何解决。

explicit spectral-to-spatial convolution for pansharpening是一种用于全色融合的显式光谱到空间卷积方法。全色融合是将高分辨率的全色(黑白)图像与低分辨率的多光谱(彩色)图像融合,以提高图像质量和细节。传统的融合方法常常使用高通滤波器进行频域操作,而explicit spectral-to-spatial convolution for pansharpening则使用基于卷积的空间域方法。 该方法基于以下原理:在全色图像中,光谱分辨率高,但空间分辨率较低;而在多光谱图像中,光谱分辨率较低,但空间分辨率较高。因此,通过将全色图像的光谱信息传递给多光谱图像,可以提高多光谱图像的空间分辨率。 explicit spectral-to-spatial convolution for pansharpening方法通过使用卷积核,将全色图像的光谱信息转换为空间域的高频细节。这个卷积核是根据光谱和空间信息之间的关系而设计的。通过将这个卷积核应用于低分辨率的多光谱图像,可以增强其空间细节,使其接近高分辨率的全色图像。 这种方法的优势在于显式地将光谱信息转换为空间域的细节,能够更好地保留图像的光谱特征和空间细节。与传统的频域方法相比,显式光谱到空间卷积方法更容易实现,并且能够更好地适应各种图像场景。 总之,explicit spectral-to-spatial convolution for pansharpening是一种通过卷积将全色图像的光谱信息转换为多光谱图像的空间细节的方法,以实现全色融合,提高图像质量和细节。
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值