Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation results on ShapeNet part benchmark #29

Open
TheJasal opened this issue Jan 1, 2020 · 2 comments
Open

Segmentation results on ShapeNet part benchmark #29

TheJasal opened this issue Jan 1, 2020 · 2 comments

Comments

@TheJasal
Copy link

TheJasal commented Jan 1, 2020

****** 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 ?

@tn00364361
Copy link

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.

@Jamesli0123
Copy link

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 modified it according to your method and then used the model provided by the author. The training result is normal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants