YOLOv7-Pytorch-Segmentation icon indicating copy to clipboard operation
YOLOv7-Pytorch-Segmentation copied to clipboard

How to get area of segmented objects

Open yevgeniyclaudio opened this issue 3 years ago • 2 comments

Does anybody know how to calculate area if each segmented object?

yevgeniyclaudio avatar Nov 15 '22 12:11 yevgeniyclaudio

Do you mean the segmented object pixel area or the area of segmented object in real world scale?

laitathei avatar Nov 18 '22 06:11 laitathei

One of the output of the model are masks, which are binary images, represented by a boolean numpy array. You can use the sum() method of numpy to count the number of white pixels, that number corresponds to the pixels that your model assingned to a certain object. This is the area you are looking for.

guillermoecn avatar Nov 29 '22 18:11 guillermoecn