Relation-Shape-CNN
Relation-Shape-CNN copied to clipboard
Segmentation results on ShapeNet part benchmark
****** Airplane: 0.001279
****** Bag: 0.125000
****** Cap: 0.000000
****** Car: 0.015432
****** Chair: 0.066288
****** Earphone: 0.222222
****** Guitar: 0.000000
****** Knife: 0.000000
****** Lamp: 0.204545
****** Laptop: 0.000000
****** Motorbike: 0.102564
****** Mug: 0.000000
****** Pistol: 0.000000
****** Rocket: 0.041667
****** Skateboard: 0.066667
****** Table: 0.159297
************ Test Loss: 3.403158
************ Class_mIoU: 0.062810
************ Instance_mIoU: 0.084091
@Yochengliu
why the model of Cap, Mug and Pistol instance_ious is always 0.000000 ?
I had the same issue with Pytorch 0.4. I manage to solve it by modifying line 103 to 114 in voting_evaluate_partseg.py
from
for b in range(len(cls)):
segp = pred_val[b, :]
segl = target[b, :]
cat = seg_label_to_cat[segl[0]]
part_ious = [0.0 for _ in range(len(seg_classes[cat]))]
for l in seg_classes[cat]:
if torch.sum((segl == l) | (segp == l)) == 0:
# part is not present in this shape
part_ious[l - seg_classes[cat][0]] = 1.0
else:
part_ious[l - seg_classes[cat][0]] = torch.sum((segl == l) & (segp == l)) / float(torch.sum((segl == l) | (segp == l)))
shape_ious[cat].append(np.mean(part_ious))
to
for b in range(len(cls)):
segp = pred_val[b, :].numpy()
segl = target[b, :].numpy()
cat = seg_label_to_cat[segl[0]]
part_ious = [0.0 for _ in range(len(seg_classes[cat]))]
for l in seg_classes[cat]:
if np.sum((segl == l) | (segp == l)) == 0:
# part is not present in this shape
part_ious[l - seg_classes[cat][0]] = 1.0
else:
part_ious[l - seg_classes[cat][0]] = np.sum((segl == l) & (segp == l)) / float(np.sum((segl == l) | (segp == l)))
shape_ious[cat].append(np.mean(part_ious))
I also did the same mod in train_partseg.py
.
I had the same issue with Pytorch 0.4. I manage to solve it by modifying line 103 to 114 in
voting_evaluate_partseg.py
fromfor b in range(len(cls)): segp = pred_val[b, :] segl = target[b, :] cat = seg_label_to_cat[segl[0]] part_ious = [0.0 for _ in range(len(seg_classes[cat]))] for l in seg_classes[cat]: if torch.sum((segl == l) | (segp == l)) == 0: # part is not present in this shape part_ious[l - seg_classes[cat][0]] = 1.0 else: part_ious[l - seg_classes[cat][0]] = torch.sum((segl == l) & (segp == l)) / float(torch.sum((segl == l) | (segp == l))) shape_ious[cat].append(np.mean(part_ious))
to
for b in range(len(cls)): segp = pred_val[b, :].numpy() segl = target[b, :].numpy() cat = seg_label_to_cat[segl[0]] part_ious = [0.0 for _ in range(len(seg_classes[cat]))] for l in seg_classes[cat]: if np.sum((segl == l) | (segp == l)) == 0: # part is not present in this shape part_ious[l - seg_classes[cat][0]] = 1.0 else: part_ious[l - seg_classes[cat][0]] = np.sum((segl == l) & (segp == l)) / float(np.sum((segl == l) | (segp == l))) shape_ious[cat].append(np.mean(part_ious))
I also did the same mod in
train_partseg.py
. i modified it according to your method and then used the model provided by the author. The training result is normal