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

About the evaluation metric mIoU. #2

Open
forrestsz opened this issue Aug 8, 2020 · 6 comments
Open

About the evaluation metric mIoU. #2

forrestsz opened this issue Aug 8, 2020 · 6 comments

Comments

@forrestsz
Copy link

Hi, thank for your nice work and job.
After reading your code, i have a little question. can you share the code how to compute the mIoU in unsupervised way, because which is different from supervised segmentation.
Thank you!👍

@kanezaki
Copy link
Owner

Thanks for your comment! The code is coming soon. The sample code and segments are currently in my Dropbox link here.

$ python miou_calculation.py --bsd500 --mode 1 --gt ./gt --input ./results

mode 1: "all"
mode 2: "fine"
mode 3: "coarse"

Before mIOU calculation, you need to distinguish unconnected segments that have the same class labels. I used this library to relabel connected components.

@forrestsz
Copy link
Author

great thank for your reply!

@euwern
Copy link

euwern commented Dec 9, 2020

Thanks for your comment! The code is coming soon. The sample code and segments are currently in my Dropbox link here.

$ python miou_calculation.py --bsd500 --mode 1 --gt ./gt --input ./results

mode 1: "all"
mode 2: "fine"
mode 3: "coarse"

Before mIOU calculation, you need to distinguish unconnected segments that have the same class labels. I used this library to relabel connected components.

Can you describe how you use the library (mentioned above) to relabel connected components? Assuming that I have just cloned the repo and compile the library, what's the next step? It will be helpful if you can share the command line to relabel the connected components.

@kanezaki
Copy link
Owner

I used the function SuperpixelTools::relabelConnectedSuperpixels(segmentation) in examples/cpp/evaluation.cpp.
To obtain the output, I inserted the following lines in L151 and then used the executable bin/example_evaluation.

    for (int i = 0; i < segmentation.rows; ++i) {
        for (int j = 0; j < segmentation.cols-1; ++j) {
          std::cerr << segmentation.at<int>(i, j) << ",";
        }
        std::cerr << segmentation.at<int>(i, segmentation.cols-1) << std::endl;
    }

@charleneolive
Copy link

Regarding your code, what is the use of these lines?

gg = np.zeros(gt_array.shape)
gt_mask = np.where(gt_array > 0, 1, gg)
determinant_array = gt_mask * input_array
label_list = np.unique(gt_array)

I saw that you have defined label_list already above.

lior1990 added a commit to lior1990/pytorch-unsupervised-segmentation-tip that referenced this issue Oct 30, 2021
@lutfiex
Copy link

lutfiex commented Mar 14, 2022

Thanks for your comment! The code is coming soon. The sample code and segments are currently in my Dropbox link here.

$ python miou_calculation.py --bsd500 --mode 1 --gt ./gt --input ./results

mode 1: "all" mode 2: "fine" mode 3: "coarse"

Before mIOU calculation, you need to distinguish unconnected segments that have the same class labels. I used this library to relabel connected components.

have the other method to relabel connected components?

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

5 participants