Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why IoUs not summed? #32

Closed
onurtore opened this issue Nov 25, 2022 · 0 comments
Closed

Why IoUs not summed? #32

onurtore opened this issue Nov 25, 2022 · 0 comments

Comments

@onurtore
Copy link

onurtore commented Nov 25, 2022

Hi!,
In validate function inside the utils/function.py, the code calculates and logs IoU:

    for i in range(nums):
        pos = confusion_matrix[..., i].sum(1)
        res = confusion_matrix[..., i].sum(0)
        tp = np.diag(confusion_matrix[..., i])
        IoU_array = (tp / np.maximum(1.0, pos + res - tp))
        mean_IoU = IoU_array.mean()
        
        logging.info('{} {} {}'.format(i, IoU_array, mean_IoU))

    writer = writer_dict['writer']
    global_steps = writer_dict['valid_global_steps']
    writer.add_scalar('valid_loss', ave_loss.average(), global_steps)
    writer.add_scalar('valid_mIoU', mean_IoU, global_steps)
    writer_dict['valid_global_steps'] = global_steps + 1
    return ave_loss.average(), mean_IoU, IoU_array

The part that I dont understand is, I think the nums variable holds the number of GPUs and code only reports the output of the second GPU. If that is the case, why? Shouldn't be average of two?

@onurtore onurtore changed the title Why meanIoU not summed? Why IoUs not summed? Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant