(predict, target)
return pixel_correct, pixel_labeled
Batch Pixel Accuracy
    Args:
        predict: input 4D tensor
        target: label 3D tensor
Batch Pixel Accuracy
    Args:
        predict: input 4D tensor
        target: label 3D tensor
Batch Pixel Accuracy Args : predict : input 4D tensor target : label 3D tensor
def batch_pix_accuracy(predict, target):
    """Batch Pixel Accuracy
    Args:
        predict: input 4D tensor
        target: label 3D tensor
    """
    _, predict = torch.max(predict, 1)
    predict = predict.cpu().numpy() + 1
    target = target.cpu().numpy() + 1
    pixel_labeled = np.sum(target > 0)
    pixel_correct = np.sum((predict == target)*(target > 0))
    assert pixel_correct <= pixel_labeled, \
        "Correct area should be smaller than Labeled"
    return pixel_correct, pixel_labeled
def batch_pix_accuracy ( predict , target ) : _ , predict = torch . max ( predict , 1 ) predict = predict . cpu ( ) . numpy ( ) + 1 target = target . cpu ( ) . numpy ( ) + 1 pixel_labeled = np . sum ( target > 0 ) pixel_correct = np . sum ( ( predict == target ) * ( target > 0 ) ) assert pixel_correct <= pixel_labeled , "Correct area should be smaller than Labeled" return pixel_correct , pixel_labeled