You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
history = model.fit(x_train, y_train,
epochs=100,
batch_size=32,
validation_data = (x_test, y_test)
callbacks=[callbacks],
class_weight=class_weights
)
...и вот дальше вылазит эта ошибка
AttributeError: module 'keras.utils' has no attribute 'get_file'
...подскажи а можно передать через ?
train_generator = train_datagen.flow_from_directory( base_path,
target_size=(sz,sz),..............
The text was updated successfully, but these errors were encountered:
I encountered the same error and It was because the weights parameter was explicitly assigned to imagenet while calling the ResNet18 model. As per documentation, the pretrained imagenet weights are set as default for the model if not set to None. @TDL77
-- for keras
from classification_models.keras import Classifiers
--передаю как np.array ...images
ResNet18, preprocess_input = Classifiers.get('resnet18')
X = preprocess_input(images)
--prepare your data
--Split the loaded dataset into train, test sets
X_train, X_test, y_train, y_test = train_test_split(X, labels,
test_size = 0.2,
random_state = random_seed ,
stratify = labels)
print("x_train shape = ",X_train.shape)
print("y_train shape = ",y_train.shape)
print("\nx_test shape = ",X_test.shape)
print("y_test shape = ",y_test.shape)
--x_train shape = (9754, 180, 180, 3)
--y_train shape = (9754,)
--x_test shape = (2439, 180, 180, 3)
--y_test shape = (2439,)
n_classes = 40
--build model
base_model = ResNet18(input_shape=(sz,sz,3), weights='imagenet', include_top=False)
x = keras.layers.GlobalAveragePooling2D()(base_model.output)
output = keras.layers.Dense(n_classes, activation='softmax')(x)
model = keras.models.Model(inputs=[base_model.input], outputs=[output])
--train
model.compile(optimizer='SGD', loss='categorical_crossentropy', metrics=['accuracy'])
history = model.fit(x_train, y_train,
epochs=100,
batch_size=32,
validation_data = (x_test, y_test)
callbacks=[callbacks],
class_weight=class_weights
)
...и вот дальше вылазит эта ошибка
AttributeError: module 'keras.utils' has no attribute 'get_file'
...подскажи а можно передать через ?
train_generator = train_datagen.flow_from_directory( base_path,
target_size=(sz,sz),..............
The text was updated successfully, but these errors were encountered: