高光谱图像分类_高光谱图像分析-分类

高光谱图像分类

初学者指南 (Beginner’s Guide)

This article provides detailed implementation of different classification algorithms on Hyperspectral Images(HSI).

本文提供了在高光谱图像(HSI)上不同分类算法的详细实现。

目录 (Table of Contents)

  • Introduction to Hyperspectral Images(HSI)

    高光谱图像(HSI)简介

  • Dimensionality Reduction(DR)

    降维(DR)

  • Classification Algorithms

    分类算法

  • Implementation — Classification on HSI

    实施-恒指分类

高光谱图像(HSI)简介 (Introduction to Hyperspectral Images(HSI))

In Remote Sensing, Hyperspectral remote sensors are widely used for monitoring the earth’s surface with the high spectral resolution. Generally, the HSI contains more than three bands compared to conventional RGB Images. The Hyperspectral Images(HSI) are used to address a variety of problems in diverse areas such as Crop Analysis, Geological Mapping, Mineral Exploration, Defence Research, Urban Investigation, Military Surveillance, etc.

遥感中 ,高光谱遥感器广泛用于以高光谱分辨率监视地球表面。 通常,与传统的RGB图像相比,HSI包含三个以上的波段。 高光谱图像(HSI)用于解决作物 分析地质制图矿物勘探国防研究,城市调查,军事监视等各个领域的各种问题。

Use the below article which provides information on Data Collection, Data Preprocessing, and Exploratory Data Analysis on HSI.

使用下面的文章,它提供有关HSI上的数据收集数据预处理探索性数据分析的信息。

There are various open-source sites providing hyperspectral data for learning purposes. Here are the two popular sites:

有许多开放源站点提供高光谱数据用于学习目的。 这是两个受欢迎的网站:

In this article, we use the Indian Pines(IP) Hyperspectral Image Dataset. The Indian Pines(IP) HSI data is gathered using the AVIRIS sensor over the Indian Pines test site in North-western Indiana and it consists of 145 X 145 pixels, 16 classes, and 200 bands. Here are the Ground Truth details of the Indian Pines(IP) Dataset:

在本文中,我们使用“ 印度松(IP)高光谱图像数据集”。 印度派恩斯(IP)HSI数据是使用AVIRIS传感器在印第安纳州西北部的印度派恩斯测试站点上收集的,它由145 X 145像素,16个类别和200个波段组成。 以下是印度松树(IP)数据集的地面真相详细信息:

Image for post
Ground Truth Details of Indian Pines(IP) Dataset
印度松(IP)数据集的地面真相详细信息

The code to read the dataset:

读取数据集的代码:

from scipy.io import loadmatdef read_HSI():X = loadmat('Indian_pines_corrected.mat')['indian_pines_corrected']y = loadmat('Indian_pines_gt.mat')['indian_pines_gt']print(f"X shape: {X.shape}\ny shape: {y.shape}")return X, yX, y = read_HSI()

The visualization of the Ground Truth of the Indian Pines dataset is shown below:

印度松树数据集的地面真相的可视化如下所示:

Image for post
Ground Truth Visualisation of Indian Pines Dataset
印度松数据集的地面真相可视化

The visualization of the six randomly selected bands over 200 is shown below:

下面显示了200多个随机选择的六个波段的可视化:

Image for post
Visualization of the Bands of Indian Pines(IP) Dataset
可视化印度松(IP)数据带

降维(DR) (Dimensionality Reduction(DR))

Dimensionality Reduction is used to reduce the number of dimensions of the data, thereby paving the way for the classifiers to generate comprehensive models at a low computational cost. Hence, Dimensionality Reduction (DR) has become more prominent to improve the accuracy of pixel classification in Hyperspectral Images(HSI).

降维用于减少数据的维数,从而为分类器以较低的计算成本生成综合模型铺平了道路。 因此,降维(DR)在提高高光谱图像(HSI)中像素分类的准确性方面变得更加突出。

Dimensionality Reduction can be done in two types. They are:

降维可以采用两种类型。 他们是:

  • Feature Selection

    功能选择
  • Feature Extraction

    特征提取

Feature Selection is the process of selecting dimensions of features of the dataset which contributes mode to the machine learning tasks such as classification, clustering, e.t.c. This can be achieved by using different methods such as correlation analysis, univariate analysis, e.t.c.

特征选择是选择数据集特征维度的过程,该特征维度有助于机器学习任务的模式,例如分类,聚类等。这可以通过使用不同的方法(例如相关分析,单变量分析等)来实现

Feature Extraction Feature Extraction is a process of finding new features by selecting and/or combining existing features to create reduced feature space, while still accurately and completely describing the data set without loss of information.

特征提取特征提取是通过选择和/或组合现有特征以创建缩小的特征空间来查找新特征的过程,同时仍能准确,完整地描述数据集而不会丢失信息。

Based on the criterion function and process of convergence, dimensionality reduction techniques are also classified as Convex and Non-Convex. Some popular dimensionality reduction techniques include PCA, ICA, LDA, GDA, Kernel PCA, Isomap, Local linear embedding(LLE), Hessian LLE, etc.

基于准则函数和收敛过程,降维技术也分为凸和非凸。 一些流行的降维技术包括PCA,ICA,LDA,GDA,内核PCA,Isomap,局部线性嵌入(LLE),Hessian LLE等。

Use the below article “Dimensionality Reduction in Hyperspectral Images using Python” to get a better understanding.

使用下面的文章“使用Python减少高光谱图像的维数”以获得更好的理解。

In this article, we are going to use Principal Component Analysis(PCA) to reduce the dimensionality of the data.

在本文中,我们将使用主成分分析(PCA)来减少数据的维数。

主成分分析(PCA) (Principal Component Analysis(PCA))

Principal Component Analysis(PCA) is one of the standard algorithms used to reduce the dimensions of the data. PCA is a non-parametric algorithm that increases the interpretability at the same time reducing the minimizing the loss of information(Reconstruction Error).

主成分分析(PCA)是用于减少数据量的标准算法之一。 PCA是一种非参数算法,可在提高解释性的同时减少信息损失(重构错误)。

Use the below two papers for better understanding the math behind the PCA.

使用以下两篇论文可以更好地理解PCA背后的数学原理。

Based on the explained variance ratio the number of components is taken as 40. The below code explains —

根据解释的方差比,组件个数为40。以下代码说明了-

pca = PCA(n_components = 40)dt = pca.fit_transform(df.iloc[:, :-1].values)q = pd.concat([pd.DataFrame(data = dt), pd.DataFrame(data = y.ravel())], axis = 1)q.columns = [f'PC-{i}' for i in range(1,41)]+['class']

The first eight principal components or eight bands are shown below:

前八个主要成分或八个频段如下所示:

Image for post
First Eights Bands after PCA
PCA之后的前八人乐队

分类算法 (Classification Algorithms)

Classification refers to a predictive modeling problem where a class label is predicted for the given input data. The classification can be divided as :

分类是指预测建模问题,其中针对给定输入数据预测类别标签。 分类可分为:

  • Classification Predictive Modeling

    分类预测建模
  • Binary Classification

    二进制分类
  • Multi-Class Classification

    多类别分类
  • Multi-Label Classification

    多标签分类
  • Imbalanced Classification

    分类不平衡

Today, we are dealing with the Multi-Class Classification problem. There are different classification algorithms that are used for the classification of Hyperspectral Images(HSI) such as :

今天,我们正在处理“多类分类”问题。 高光谱图像(HSI)的分类有不同的分类算法,例如:

  • K-Nearest Neighbors

    K最近邻居
  • Support Vector Machine

    支持向量机
  • Spectral Angle Mapper

    光谱角映射器
  • Convolutional Neural Networks

    卷积神经网络
  • Decision Trees e.t.c

    决策树等

In this article, we are going to use the Support Vector Machine(SVM) to classify the Hyperspectral Image(HSI).

在本文中,我们将使用支持向量机(SVM)对高光谱图像(HSI)进行分类。

支持向量机(SVM) (Support Vector Machine(SVM))

Support Vector Machine is a supervised classification algorithm that maximizes the margin between data and hyperplane. Different kernel functions are used to project the data into higher dimensions such as Linear, polynomial, Radial Basis Function(RBF), e.t.c.

支持向量机是一种监督分类算法,可最大化数据和超平面之间的余量。 使用不同的内核函数将数据投影到更高的维度,例如线性,多项式,径向基函数(RBF)等

For better understanding, the concept behind SVM refer the below lectures:

为了更好地理解,SVM背后的概念请参考以下讲座:

实施-恒指分类 (Implementation — Classification on HSI)

The below code serves the purpose of implementing the support vector machine to classify the Hyperspectral Image.

以下代码用于实现支持向量机以对高光谱图像进行分类的目的。

x = q[q['class'] != 0]X = x.iloc[:, :-1].valuesy = x.loc[:, 'class'].values names = ['Alfalfa',	'Corn-notill', 'Corn-mintill',	'Corn',		'Grass-pasture','Grass-trees',
'Grass-pasture-mowed','Hay-windrowed','Oats','Soybean-notill','Soybean-mintill',
'Soybean-clean', 'Wheat',	'Woods',	'Buildings Grass Trees Drives',	'Stone Steel Towers']X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20, random_state=11, stratify=y)svm =  SVC(C = 100, kernel = 'rbf', cache_size = 10*1024)svm.fit(X_train, y_train)ypred = svm.predict(X_test)

The confusion matrix is generated using the code:

混淆矩阵是使用以下代码生成的:

data = confusion_matrix(y_test, ypred)df_cm = pd.DataFrame(data, columns=np.unique(names), index = np.unique(names))df_cm.index.name = 'Actual'df_cm.columns.name = 'Predicted'plt.figure(figsize = (10,8))sn.set(font_scale=1.4)#for label sizesn.heatmap(df_cm, cmap="Reds", annot=True,annot_kws={"size": 16}, fmt='d')plt.savefig('cmap.png', dpi=300)
Image for post
Confusion Matrix
混淆矩阵

The generated Classification Report which consists of the Classwise Accuracy, Accuracy Precision, Recall, F1 Score, and Support is shown below:

生成的分类报告由分类准确性,准确性准确性,召回率,F1得分支持组成,如下所示:

Image for post
Classification Report
分类报告

Finally, the classification Map is shown below:

最后,分类图如下所示:

Image for post
Classification Map of Indian Pines(IP) Dataset
印度松(IP)数据集分类图

The entire code that I have written in this article can be accessed using the below notebook in GitHub and CoLab.

可以使用GitHub和CoLab中的以下笔记本访问本文中编写的全部代码。

翻译自: https://towardsdatascience.com/hyperspectral-image-analysis-classification-c41f69ac447f

高光谱图像分类

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/391015.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

机器人的动力学和动力学联系_通过机器学习了解幸福动力学(第2部分)

机器人的动力学和动力学联系Happiness is something we all aspire to, yet its key factors are still unclear.幸福是我们所有人都渴望的东西,但其关键因素仍不清楚。 Some would argue that wealth is the most important condition as it determines one’s li…

ubuntu 16.04 安装mysql

2019独角兽企业重金招聘Python工程师标准>>> 1) 安装 sudo apt-get install mysql-server apt-get isntall mysql-client apt-get install libmysqlclient-dev 2) 验证 sudo netstat -tap | grep mysql 如果有 就代表已经安装成功。 3)开启远程访问 1、 …

大样品随机双盲测试_训练和测试样品生成

大样品随机双盲测试This post aims to explore a step-by-step approach to create a K-Nearest Neighbors Algorithm without the help of any third-party library. In practice, this Algorithm should be useful enough for us to classify our data whenever we have alre…

JavaScript 基础,登录验证

<script></script>的三种用法&#xff1a;放在<body>中放在<head>中放在外部JS文件中三种输出数据的方式&#xff1a;使用 document.write() 方法将内容写到 HTML 文档中。使用 window.alert() 弹出警告框。使用 innerHTML 写入到 HTML 元素。使用 &qu…

从数据角度探索在新加坡的非法毒品

All things are poisons, for there is nothing without poisonous qualities. It is only the dose which makes a thing poison.” ― Paracelsus万物都是毒药&#xff0c;因为没有毒药就没有什么。 只是使事物中毒的剂量。” ― 寄生虫 执行摘要(又名TL&#xff1b; DR) (Ex…

Android 自定义View实现QQ运动积分抽奖转盘

因为偶尔关注QQ运动&#xff0c; 看到QQ运动的积分抽奖界面比较有意思&#xff0c;所以就尝试用自定义View实现了下&#xff0c;原本想通过开发者选项查看下界面的一些信息&#xff0c;后来发现积分抽奖界面是在WebView中展示的&#xff0c;应该是在H5页面中用js代码实现的&…

瑞立视:厚积薄发且具有“工匠精神”的中国品牌

一家成立两年的公司&#xff1a;是如何在VR行业趋于稳定的情况下首次融资就获得如此大额的金额呢&#xff1f; 2017年VR行业内宣布融资的公司寥寥无几&#xff0c;无论是投资人还是消费者对这个 “宠儿”都开始纷纷投以怀疑的目光。但就在2017年7月27日&#xff0c;深圳市一家…

CSV模块的使用

CSV模块的使用 1、csv简介 CSV (Comma Separated Values)&#xff0c;即逗号分隔值&#xff08;也称字符分隔值&#xff0c;因为分隔符可以不是逗号&#xff09;&#xff0c;是一种常用的文本 格式&#xff0c;用以存储表格数据&#xff0c;包括数字或者字符。很多程序在处理数…

python 重启内核_Python从零开始的内核回归

python 重启内核Every beginner in Machine Learning starts by studying what regression means and how the linear regression algorithm works. In fact, the ease of understanding, explainability and the vast effective real-world use cases of linear regression is…

回归分析中自变量共线性_具有大特征空间的回归分析中的变量选择

回归分析中自变量共线性介绍 (Introduction) Performing multiple regression analysis from a large set of independent variables can be a challenging task. Identifying the best subset of regressors for a model involves optimizing against things like bias, multi…

python 面试问题_值得阅读的30个Python面试问题

python 面试问题Interview questions are quite tricky to predict. In most cases, even peoples with great programming ability fail to answer some simple questions. Solving the problem with your code is not enough. Often, the interviewer will expect you to hav…

机器学习模型 非线性模型_机器学习:通过预测菲亚特500的价格来观察线性模型的工作原理...

机器学习模型 非线性模型Introduction介绍 In this article, I’d like to speak about linear models by introducing you to a real project that I made. The project that you can find in my Github consists of predicting the prices of fiat 500.在本文中&#xff0c;…

10款中小企业必备的开源免费安全工具

10款中小企业必备的开源免费安全工具 secist2017-05-188共527453人围观 &#xff0c;发现 7 个不明物体企业安全工具很多企业特别是一些中小型企业在日常生产中&#xff0c;时常会因为时间、预算、人员配比等问题&#xff0c;而大大减少或降低在安全方面的投入。这时候&#xf…

图片主成分分析后的可视化_主成分分析-可视化

图片主成分分析后的可视化If you have ever taken an online course on Machine Learning, you must have come across Principal Component Analysis for dimensionality reduction, or in simple terms, for compression of data. Guess what, I had taken such courses too …

TP引用样式表和js文件及验证码

TP引用样式表和js文件及验证码 引入样式表和js文件 <script src"__PUBLIC__/bootstrap/js/jquery-1.11.2.min.js"></script> <script src"__PUBLIC__/bootstrap/js/bootstrap.min.js"></script> <link href"__PUBLIC__/bo…

pytorch深度学习_深度学习和PyTorch的推荐系统实施

pytorch深度学习The recommendation is a simple algorithm that works on the principle of data filtering. The algorithm finds a pattern between two users and recommends or provides additional relevant information to a user in choosing a product or services.该…

Java 集合-集合介绍

2017-10-30 00:01:09 一、Java集合的类关系图 二、集合类的概述 集合类出现的原因&#xff1a;面向对象语言对事物的体现都是以对象的形式&#xff0c;所以为了方便对多个对象的操作&#xff0c;Java就提供了集合类。数组和集合类同是容器&#xff0c;有什么不同&#xff1a;数…

Exchange 2016部署实施案例篇-04.Ex基础配置篇(下)

上二篇我们对全新部署完成的Exchange Server做了基础的一些配置&#xff0c;今天继续基础配置这个话题。 DAG配置 先决条件 首先在配置DGA之前我们需要确保DAG成员服务器上磁盘的盘符都是一样的&#xff0c;大小建议最好也相同。 其次我们需要确保有一块网卡用于数据复制使用&…

数据库课程设计结论_结论:

数据库课程设计结论In this article, we will learn about different types[Z Test and t Test] of commonly used Hypothesis Testing.在本文中&#xff0c;我们将学习常用假设检验的不同类型[ Z检验和t检验 ]。 假设是什么&#xff1f; (What is Hypothesis?) This is a St…

配置Java_Home,临时环境变量信息

一、内容回顾 上一篇博客《Java运行环境的搭建---Windows系统》 我们说到了配置path环境变量的目的在于控制台可以在任意路径下都可以找到java的开发工具。 二、配置其他环境变量 1. 原因 为了获取更大的用户群体&#xff0c;所以使用java语言开发系统需要兼容不同版本的jdk&a…