PRBonn / phenobench-baselines

Baselines of the PhenoBench Dataset

Home Page:https://www.phenobench.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iou_per_class ERROR

chenfh21 opened this issue · comments

for class_index, iou_class in enumerate(iou_per_class):

Hi:
I confused this here. My understanding of this is the 'iou_per_class ' should pass in a set of calculated values, but 'iou_per_class ' in the previous step is calculated to be a tensor value.

Hi Chenfh21,

We initialize the IoU evaluator as following
self.metric_val_iou = torchmetrics.JaccardIndex(self.network.num_classes, reduction=None),
where we set the reduction argument to None.

Thus, the line iou_per_class = self.metric_val_iou.compute() returns a Tensor with shape n_classes, i.e., [iou_background, iou_crop, iou_weed].

Consequently, the line for class_index, iou_class in enumerate(iou_per_class) iterates over the IoU score of each class.

Please note that torchmetrics replaced the reduction argument in the most recent version and now it is called average.

Hi Chenfh21,

We initialize the IoU evaluator as following self.metric_val_iou = torchmetrics.JaccardIndex(self.network.num_classes, reduction=None), where we set the reduction argument to None.

Thus, the line iou_per_class = self.metric_val_iou.compute() returns a Tensor with shape n_classes, i.e., [iou_background, iou_crop, iou_weed].

Consequently, the line for class_index, iou_class in enumerate(iou_per_class) iterates over the IoU score of each class.

Please note that torchmetrics replaced the reduction argument in the most recent version and now it is called average.

Thank you very much,