为什么训练和验证的准确率、精确度和召回率结果在我的深度学习模型的每个时期都显示出相同的值

Why the accuracy, precision and recall results for training and validation shows same value in each epoch in my deep learning model

提问人:Achini Nisansala 提问时间:11/9/2023 更新时间:11/9/2023 访问量:15

问:

我想获得此问题的准确度、精确度和召回率值、分类报告。但是我在每个时期的准确性、精确度和召回率都得到了相同的值。此外,我得到的 iou 价值微薄。我怎样才能提高准确性、精确度、召回率和借据,请给我一个相同值获取问题的解决方案。这是我使用的深度学习代码

from tensorflow.keras import layers
model=Sequential()
model.add(layers.Conv2D(16,(3,3),activation='relu',input_shape=(224,224,3)))
model.add(layers.MaxPooling2D((2, 2)))

model.add(layers.Conv2D(32,(3,3),activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))

model.add(layers.Conv2D(64, (3, 3), activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))

model.add(layers.Conv2D(128,(3,3),activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))

model.add(layers.Conv2D(512, (3, 3), activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))

model.add(layers.Conv2D(512, (3, 3), activation='relu'))
model.add(layers.Flatten())

model.add(layers.Dense(64, activation='relu'))
model.add(layers.Dense(2,activation='softmax'))

model.summary()

from keras import optimizers
from sklearn.metrics import precision_score, recall_score, f1_score
metrics = ["accuracy",tf.keras.metrics.Recall(thresholds=None, top_k=None, class_id=None,       name=None, dtype=None), tf.keras.metrics.Precision(thresholds=None, top_k=None, class_id=None, name=None, dtype=None), iou]


adam = optimizers.Adam()
model.compile(loss='binary_crossentropy',optimizer=Adam(learning_rate=0.001),metrics=metrics)

history = model.fit(train_ds,validation_data=val_ds,epochs=50)

前纪元 1/50 25/25 [================================] - 28s 1s/步 - 损失:0.6883 - 精度:0.5329 - 召回率:0.5329 - 精度:0.5329 - IOU:0.2665 - val_loss: 0.6840 - val_accuracy: 0.5076 - val_recall: 0.5076 - val_precision: 0.5076 - val_iou: 0.2741 纪元 2/50 25/25 [==================================] - 17s 665ms/步 - 损耗:0.6377 - 精度:0.6684 - 召回率:0.6684 - 精度:0.6684 - IOU:0.2916 - val_loss:0.5209 - val_accuracy:0.9289 - val_recall:0.9289 - val_precision:0.9289 - val_iou:0.3613 纪元 3/50 25/25 [================================] - 18s 703ms/步 - 损耗:0.3707 - 精度:0.8684 - 召回率:0.8684 - 精度:0.8684 - IOU:0.4125 - val_loss: 0.2006 - val_accuracy: 0.9289 - val_recall: 0.9289 - val_precision: 0.9289 - val_iou: 0.4732

当我得到分类报告和混淆矩阵时,它给出了值,

混淆矩阵 [[54 42] [56 45]] 分类报告 精确召回 F1 分数支持

Ovarian_Cancer       0.49      0.56      0.52        96

Non_Ovarian_Cancer 0.52 0.45 0.48 101

      accuracy                           0.50       197
     macro avg       0.50      0.50      0.50       197
  weighted avg       0.50      0.50      0.50       197
分类 精度 混淆矩阵

评论


答: 暂无答案