图像处理python中的尺寸差异

时间:2019-02-24 21:54:26

标签: python image-processing dimensionality-reduction

所以我的项目是图像处理。经过预处理和特征提取后,我得到了3d图片阵列。由于代码错误,我无法成功调试 先1-PCA,然后2-labelling该类的每个记录(行),而无需将我的3d调整为2d。

问题1:使用这种方法会丢失信息吗?
Q2:我找不到最终2d数组中的标签吗?我的分类器如何知道?

主要

def experiment1():
    females, males = readimages()
    females, males = convertygrey(females, males)
    f = np.asarray(females, dtype=np.float32)
    m = np.asarray(males, dtype=np.float32)
#Here I did the reshaping
    nsamples, nx, ny = f.shape
    d2_train_dataset = f.reshape((nsamples,nx*ny))
#getting to PCA later after solving this labelling issue
    #fe=dr_pca(d2_train_dataset) 
# labelling females matrix
    females= annotation(d2_train_dataset)
#printing it to csv since terminal don't display matrix properly
    np.savetxt("females.csv", females, delimiter=",")

注释方法/标签

def annotation(l1):
    label1 = ones((len(l1), 1),dtype='float')
    #np.append(np.atleast_3d(l1), label1, axis=1).shape
    np.append(l1,label1,axis=1)

    return l1

0 个答案:

没有答案