Python:读取COIL20.mat文件

import scipy.io as scio
import numpy as np


path = r'E:\dataset\clusterData\label.mat'
path1 = r'E:\dataset\clusterData\fea.mat '
dataA = scio.loadmat(path)
dataB = scio.loadmat(path1)
X = dataB['fea']
y = dataA['label']
# y = np.hstack(y)

labels,counts = np.unique(y,return_counts=True)
print(X.shape)
print(y.shape)
print(labels)
print(counts)
print(max(counts)/min(counts))

输出:

(1440, 1024)
(1440, 1)
[ 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20]
[ 72  72  78  73  72  79  42  45 144  79  72  72  34 107  81  72  72  58
  58  58]
4.235294117647059

你可能感兴趣的:(Python学习)