# https://github.com/tensorflow/tensorflow/issues/32875를 참조하십시오.
제안 된 수정 사항은 다음과 같습니다.
class UpdatedMeanIoU(tf.keras.metrics.MeanIoU):
@tf.function
def __call__(self, y_true, y_pred, sample_weight=None):
y_pred = tf.argmax(y_pred, axis=-1) # this is the fix
return super().__call__(y_true, y_pred, sample_weight=sample_weight)
TF2.1에서는 작동했지만 TF2.2에서는 다시 중단되었습니다. 통과 할 수있는 방법이 있나요 y_pred = tf.argmax(y_pred, axis=-1)
으로 y_pred
서브 클래스보다이 메트릭 다른가?
이렇게하면 문제가 해결됩니다.
class UpdatedMeanIoU(tf.keras.metrics.MeanIoU):
def __init__(self,
y_true=None,
y_pred=None,
num_classes=None,
name=None,
dtype=None):
super(UpdatedMeanIoU, self).__init__(num_classes = num_classes,name=name, dtype=dtype)
def update_state(self, y_true, y_pred, sample_weight=None):
y_pred = tf.math.argmax(y_pred, axis=-1)
return super().update_state(y_true, y_pred, sample_weight)
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다