我目前正在 Keras 中研究用于 MRI 分类的 2D CNN。班级比例约为 60/40,我有 155 名患者,每个患者都有一个 MRI,由大约 180 个切片组成,CNN 的输入是 MRI 图像的切片(256*256 px)(所以总共输入约为 27900图像,每个 256*256 像素)。
我测试了不同的模型,并总是使用混洗分层 10 折交叉验证和 EarlyStopping 监视器对它们进行评估,它们都表现得非常好,验证准确率约为 95% 到 98%。但是每次,一到两次的表现都比其他的差很多(70% 到 80% 的验证准确率)。由于褶皱是随机的,我希望褶皱的表现都一样好。
有人可以解释这是如何发生的以及如何防止它吗?
准确度和损失图:
这是其中一个模型的一部分:
num_classes = 2
img_size = 256
batch_size = 200
# Because of EarlyStopping monitor, the number of epochs doesn't really matter
num_epochs = 1000
kfold_splits = 10
skf = StratifiedKFold(n_splits=kfold_splits, shuffle=True)
# Here the data is split
for index, (train_index, test_index) in enumerate(skf.split(x_data_paths, y_data_paths)):
x_train, x_test = np.array(x_data_paths)[train_index.astype(int)], np.array(x_data_paths)[test_index.astype(int)]
y_train, y_test = np.array(y_data_paths)[train_index.astype(int)], np.array(y_data_paths)[test_index.astype(int)]
training_batch_generator = BcMRISequence(x_train, y_train_one_hot, batch_size)
test_batch_generator = BcMRISequence(x_test, y_test_one_hot, batch_size)
# region Create model (using the functional API)
inputs = Input(shape=(img_size, img_size, 1))
conv1 = Conv2D(64, kernel_size=5, strides=1, activation='relu')(inputs)
pool1 = MaxPooling2D(pool_size=3, strides=(2, 2), padding='valid')(conv1)
conv2 = Conv2D(32, kernel_size=3, activation='relu')(pool1)
pool2 = MaxPooling2D(pool_size=(2, 2))(conv2)
conv3 = Conv2D(16, kernel_size=3, activation='relu')(pool2)
pool3 = MaxPooling2D(pool_size=(2, 2))(conv3)
flat = Flatten()(pool3)
hidden1 = Dense(10, activation='relu')(flat)
output = Dense(num_classes, activation='softmax')(hidden1)
model = Model(inputs=inputs, outputs=output)