ValueError: Input 0 is incompatible with layer resnet50: expected shape=(None, 224, 224, 3), found shape=(6, 13)

时间:2021-06-23 16:38:53

标签: python keras resnet

我想使用 Keras 并构建一个 Resnet 模型,但我只是使用具有 13 个特征的一维数据。在几次不成功的尝试后,我收到了这个错误,我想知道是否有人有任何建议?非常感谢!

如果有帮助,这是我的一些代码...

import numpy as np
import scipy
from scipy import ndimage
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.keras.applications.resnet50 import ResNet50

model = ResNet50(weights=None,classes=2)

model.compile(optimizer="adam",loss='binary_crossentropy',metrics=['accuracy'])

import pandas as pd
data = pd.read_csv('train.csv')
df = pd.DataFrame(data)

y = df['Label']
X = df.drop('Label',axis=1)

from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.25, random_state = 101)

from sklearn.preprocessing import StandardScaler
sc = StandardScaler()
X_train = sc.fit_transform(X_train)
X_test = sc.transform(X_test)

model.fit(X_train,y_train, epochs=10, batch_size=6)

0 个答案:

没有答案