The accumulation of the confusion matrix produces overflows if you have a large data set.
Matrix is currently stored as int32.
If you have a dataset with 10^5 images and 10^5 pixels per image (480*360=172800) the maximum true positive number is 10^10 > 2^32 ~ 10^9.
Changed the dtype of the matrix to int64 to solve the problem.
The accumulation of the confusion matrix produces overflows if you have a large data set. Matrix is currently stored as int32. If you have a dataset with 10^5 images and 10^5 pixels per image (480*360=172800) the maximum true positive number is 10^10 > 2^32 ~ 10^9. Changed the dtype of the matrix to int64 to solve the problem.