Open zhijiejia opened 3 years ago
Hi @zhijiejia, It is the IoU metric of the class "change" only, i.e. it does not account for the overlap in the background (no change) class. The code I used for calculating IoU over all test images for LEVIRCD is the following (note that in the inner product, 1 stands for change class, 0 for background, thefore, background does not contribute):
total_intersection = 0.0
total_union = 0.0
for name_pred, name_gt in zip(flnames_inf, flnames_gt):
print ("Processing file:: {}".format(name_gt))
with rasterio.open(name_pred,mode='r',driver='GTiff') as src1:
pred = src1.read((1,2))
pred = np.argmax(pred,0).astype(np.uint8)
with rasterio.open(name_gt, driver='png',mode='r') as src:
mask = src.read(1).astype(np.uint8)
mask[mask>0]=1
intersection = (pred*mask).sum()
union = pred.sum() + mask.sum() - intersection
total_intersection += intersection
total_union += union
print (total_intersection/total_union)
Regards
hi feevos, the result in your paper has IOU metric in table. Is the IOU metric for change only ? Or the IOU euqal mIOU for 2 classes