result_total6=[] result_total7=[] result_total=[] y_train1=np.argmax(y_train,axis=1) y_test1=np.argmax(y_test,axis=1) for i in range(test_numbers): dense1_layer_model =Model(inputs=model.input,outputs=model.get_layer('layer3').output) fx_test3 = dense1_layer_model.predict(x_test) fx_train3 = dense1_layer_model.predict(x_train) fx_test3=change_shape(fx_test3,type='no') fx_train3=change_shape(fx_train3,type='no') pca=PCA(n_components=128) pca.fit(fx_train3) fx_tr3=pca.transform(fx_train3) fx_te3=pca.transform(fx_test3) result=all_model(fx_tr3,fx_te3,y_train1,y_test1) result_total4.append(result) dense1_layer_model =Model(inputs=model.input,outputs=model.get_layer('layer4').output) fx_test4 = dense1_layer_model.predict(x_test) fx_train4 = dense1_layer_model.predict(x_train) fx_test4=change_shape(fx_test4,type='no') fx_train4=change_shape(fx_train4,type='no') pca=PCA(n_components=86) pca.fit(fx_train4) fx_tr4=pca.transform(fx_train4) fx_te4=pca.transform(fx_test4) result=all_model(fx_tr4,fx_te4,y_train1,y_test1) result_total5.append(result) dense1_layer_model =Model(inputs=model.input,outputs=model.get_layer('dense1_out').output) fx_test_dence1 = dense1_layer_model.predict(x_test) fx_train_dence1 = dense1_layer_model.predict(x_train)
fx_te4=pca.transform(fx_test4) dense1_layer_model =Model(inputs=model_aconv.input,outputs=model_aconv.get_layer('layer3').output) fx_test_dence1 = dense1_layer_model.predict(x_test) fx_train_dence1 = dense1_layer_model.predict(x_train) fx_test_dence1=change_shape(fx_test_dence1,type='no') fx_train_dence1=change_shape(fx_train_dence1,type='no') dense1_layer_model_2 =Model(inputs=model_aconv.input,outputs=model_aconv.get_layer('layer4').output) fx_test_out = dense1_layer_model_2.predict(x_test) fx_train_out = dense1_layer_model_2.predict(x_train) fx_test_out=change_shape(fx_test_out,type='no') fx_train_out=change_shape(fx_train_out,type='no') fx_train=np.concatenate((fx_tr3,fx_tr4,fx_train_dence1,fx_train_out),axis=1) fx_test=np.concatenate((fx_te3,fx_te4,fx_test_dence1,fx_test_out),axis=1) y_train1=np.argmax(y_train,axis=1) y_test1=np.argmax(y_test,axis=1) result=all_model(fx_train,fx_test,y_train1,y_test1) result_total.append(result) print(i,'Rotation Forest:',result[0],'Adaboost RF:',result[1]) s2=model_aconv.evaluate(x_test,y_test) result_total=np.array(result_total) d=np.max(result_total,0) print(str(total)+' samples/one_category test_acc:','A_convNet:',s2[1],'Rotation Forest:',d[0],'Adaboost RF:',d[1])