1.共现矩阵
灰度共生矩阵
- 先将图像转换成灰度图片
- 然后再用
graycomatirx
函数进行共生矩阵计算
1 | # -*- coding: utf-8 -*- |
我们将npy.文件格式转换为csv,再转化为Excel文件
1 | loaded_data = np.load('/home/jovyan/work/glcm_1.npy') |
输出的表格如下图:
2 Ucinet分析
2.1 输入矩阵中
菜单栏第三行第二个
随后保存
2.2 二值化
transform->dichotomize
0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1
- - - - - - - - - - - - - - - -
0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 0 1 1 1 0 0 0 0
2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0
3 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0
4 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 0
5 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0
6 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
7 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
8 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0
9 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0
10 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
11 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1
12 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1
13 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1
14 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1
15 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1
2.3 生成网络
将刚才保存的共现矩阵导入
2.4 中心性分析
Analysis->centralitymeasures
2.5 节点中心度
FREEMAN’S DEGREE CENTRALITY MEASURES:
Diagonal valid? NO
Model: SYMMETRIC
Input dataset: cocomarix (C:\Users\lenovo\Desktop\论文\UCINET\cocomarix)
1 2 3
Degree NrmDegree Share
8 7 0.017 13.909 0.130
7 6 0.017 13.291 0.124
9 8 0.014 10.977 0.103
15 14 0.011 8.892 0.083
10 9 0.010 8.241 0.077
14 13 0.010 8.011 0.075
6 5 0.009 7.025 0.066
11 10 0.007 5.887 0.055
13 12 0.007 5.866 0.055
4 3 0.007 5.270 0.049
12 11 0.006 4.755 0.045
16 15 0.005 3.821 0.036
3 2 0.005 3.633 0.034
5 4 0.004 3.246 0.030
2 1 0.003 2.043 0.019
1 0 0.002 1.904 0.018
DESCRIPTIVE STATISTICS
1 2 3
Degree NrmDegree Share
1 Mean 0.008 6.673 0.063
2 Std Dev 0.004 3.572 0.033
3 Sum 0.133 106.771 1.000
4 Variance 0.000 12.763 0.001
5 SSQ 0.001 916.710 0.080
6 MCSSQ 0.000 204.204 0.018
7 Euc Norm 0.038 30.277 0.284
8 Minimum 0.002 1.904 0.018
9 Maximum 0.017 13.909 0.130
Network Centralization = 8.27%
Heterogeneity = 8.04%. Normalized = 1.91%
Actor-by-centrality matrix saved as dataset FreemanDegree
Running time: 00:00:01
Output generated: 23 3月 24 18:59:01
Copyright (c) 2002-8 Analytic Technologies
NrmDegree 标准中心度
Mean 均值
Std Dev 标准差
Variance 方差
SSQ 平方差和
MCSSQ 平均值平方差和
Euc Norm 欧几里得范数
2.6 接近中心度
network->centrality->closeness
CLOSENESS CENTRALITY
Input dataset: cocomarix (C:\Users\lenovo\Desktop\论文\UCINET\cocomarix)
Method: Geodesic paths only (Freeman Closeness)
Output dataset: Closeness (C:\Users\lenovo\Desktop\论文\UCINET\Closeness)
Note: Data not symmetric, therefore separate in-closeness & out-closeness computed.
Closeness Centrality Measures
1 2 3 4
inFarness outFarness inCloseness outCloseness
------------ ------------ ------------ ------------
11 10 16.000 16.000 93.750 93.750
10 9 16.000 18.000 93.750 83.333
7 6 16.000 17.000 93.750 88.235
12 11 17.000 18.000 88.235 83.333
6 5 17.000 19.000 88.235 78.947
8 7 17.000 17.000 88.235 88.235
9 8 18.000 18.000 83.333 83.333
5 4 18.000 18.000 83.333 83.333
4 3 18.000 20.000 83.333 75.000
13 12 19.000 18.000 78.947 83.333
3 2 20.000 18.000 75.000 83.333
14 13 20.000 21.000 75.000 71.429
15 14 21.000 22.000 71.429 68.182
2 1 22.000 20.000 68.182 75.000
16 15 26.000 25.000 57.692 60.000
1 0 29.000 25.000 51.724 60.000
Statistics
1 2 3 4
inFarness outFarness inCloseness outCloseness
------------ ------------ ------------ ------------
1 Mean 19.375 19.375 79.621 78.674
2 Std Dev 3.569 2.595 12.153 9.445
3 Sum 310.000 310.000 1273.930 1258.778
4 Variance 12.734 6.734 147.693 89.217
5 SSQ 6210.000 6114.000 103794.195 100460.148
6 MCSSQ 203.750 107.750 2363.083 1427.469
7 Euc Norm 78.804 78.192 322.171 316.954
8 Minimum 16.000 16.000 51.724 60.000
9 Maximum 29.000 25.000 93.750 93.750
Network in-Centralization = 31.22%
Network out-Centralization = 33.31%
Output actor-by-centrality measure matrix saved as dataset Closeness (C:\Users\lenovo\Desktop\论文\UCINET\Closeness)
Running time: 00:00:01
Output generated: 23 3月 24 19:37:04
Copyright (c) 1999-2008 Analytic Technologies
2.7 中间中心度
network->centrality->freeman betweenness->node betweenness
FREEMAN BETWEENNESS CENTRALITY
Input dataset: cocomarix (C:\Users\lenovo\Desktop\论文\UCINET\cocomarix)
Important note: this routine binarizes but does NOT symmetrize.
Un-normalized centralization: 115.007
1 2
Betweenness nBetweenness
------------ ------------
11 10 11.563 5.506
7 6 7.874 3.749
5 4 6.907 3.289
12 11 6.215 2.959
10 9 5.533 2.635
4 3 5.395 2.569
8 7 4.846 2.308
3 2 4.621 2.201
13 12 4.389 2.090
6 5 3.718 1.771
9 8 2.939 1.400
14 13 2.330 1.109
2 1 2.310 1.100
15 14 1.359 0.647
1 0 0.000 0.000
16 15 0.000 0.000
DESCRIPTIVE STATISTICS FOR EACH MEASURE
1 2
Betweenness nBetweenness
------------ ------------
1 Mean 4.375 2.083
2 Std Dev 2.901 1.382
3 Sum 70.000 33.333
4 Variance 8.418 1.909
5 SSQ 440.937 99.986
6 MCSSQ 134.687 30.541
7 Euc Norm 20.999 9.999
8 Minimum 0.000 0.000
9 Maximum 11.563 5.506
Network Centralization Index = 3.65%
Output actor-by-centrality measure matrix saved as dataset FreemanBetweenness
Running time: 00:00:01
Output generated: 23 3月 24 19:38:10
Copyright (c) 1999-2008 Analytic Technologies
2.8 凝聚子群分析
network->roles& positions ->structural ->concor
3 结论
社交网络分析在灰度共生矩阵上的应用,反应了像素点之间的关联。从而可以得出图片中的痕迹是否明显。
4 与自己方向相结合
我的研究方向是视频深度伪造检测
本次提供的灰度共生数据,来源于以下图片
倘若,再加以处理,例如:将真的图片中的人脸提取出来,再进行灰度共生矩阵处理,对其进行中心性分析等一系列社交网络分析。然后将所得的分析数据输入神经网络模型中,并重复输入不同的人脸图像,让模型进行学习。再将假图片的分析数据给训练后的模型进行评估。