0
votes

I'm would like to use Keras and build a Resnet model but I'm just using a one-dimensional data with 13 features. I got this error after a few unsuccessful attempts, and I was wondering if anyone has any suggestions? Thank you very much!

if it helps, here's some of my code...

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)

No, you can not use that Resnet with 1D data. - Frightera
hi, so it is that i cannot apply ResNet on any 1D data? - Laura
That's not how it works. ResNet50 pretrained model contains 2D convolutions which do not suit your data, you can create your residual network using 1D convolutions. - Frightera
Yes. Resnet builds for image tasks, you could try to build a model with dense layer. - Trong Van