我想使用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)
1条答案
按热度按时间djmepvbi1#
值错误:层“resnet50”的输入0与层不兼容:预期形状=(无,224,224,3),找到的形状=(无,32,32,3)