Adding centroids and midway output to segmentation