应用时间汇总功能后,从nan的预测层输出VGG

时间:2019-04-27 09:56:28

标签: python numpy keras vgg-net

我正在尝试使用以下方法从VGG预测层获取输出:

   input_shape= (224, 224, 3)
   vgg = vgg16.VGG16(include_top=True, weights='imagenet', 
   input_shape=input_shape)

   model_output = vgg.get_layer("predictions").output
   vgg_model = Model(inputs=vgg.input, outputs=model_output)

然后,在将每个图像的输出追加到文件夹中之后,我应用汇总功能

    func_list = [np.average,  np.max,  np.std , np.min, np.mean, 
    scipy.stats.skew,scipy.stats.kurtosis]

    suffix_list = ['_avg', '_max', '_std','_min' ,'_mean' ,'_skew','_kurtosis']

然后我要使用随机森林分类器测试输出:

 yc = y_train
 val_yc =y_test

 train_feat= vgg_train
 test_feat= vgg_test


max_features = list(range(1,train_feat.shape[1]))

max_features中的max_feature:

sel = SelectFromModel(RandomForestClassifier(n_estimators=2000),max_features=max_feature)
sel.fit(train_feat, yc)

train_c = train_feat.loc[:, sel_c.get_support()]
test_c  = test_feat.loc[:, sel_c.get_support()]

我每次都会收到此错误:

  ValueError: Input contains NaN, infinity or a value too large for dtype('float32').

我在做错什么吗?

0 个答案:

没有答案