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

How to convert instance-level masks to semantic masks in the CRAG dataset? #23

Open
li-qi-lin opened this issue Oct 29, 2024 · 9 comments

Comments

@li-qi-lin
Copy link

I am currently working with the CRAG dataset, which provides instance-level segmentation masks of adenocarcinoma and benign glands in colon cancer.

I would like to know how to convert these instance-level masks to semantic masks in your experiment.

Could you provide some guidance or suggestions on how to achieve this?

Thank you!

@jingweizhang-xyz
Copy link
Member

Simply regard all instances as one class: gland and regard the rest region as background.

@li-qi-lin
Copy link
Author

Thank you!But I still have some questions.

1、The paper of CRAG mentions both healthy and malignant glands, but it isn’t entirely clear if there’s a need to further differentiate these regions within each gland.

2、If additional differentiation within glands is recommended, could you please provide guidance or any established criteria for such annotations?

Understanding this distinction would be very helpful for correctly interpreting and using the mask labels in the dataset. Thank you for your assistance!

@jingweizhang-xyz
Copy link
Member

  1. We did not try to distinguish between healthy and malignant. If you have such labels, you can have a try.
  2. I do not know about such criteria or annotations.

@dw1360585641
Copy link

只需将所有实例视为一个类:gland,并将其余区域视为背景。
那么应该这样设置参数吗"dataset": {
"dataset_root": "/data/kb/wdw/sampath/SAMPath-main/kaggle",
"dataset_csv_path": "/data/kb/wdw/sampath/SAMPath-main/kaggle/200.csv",
"val_fold_id": 0,
"num_classes": 3,

    "ignored_classes": (0),
    "ignored_classes_metric": None,# if we do not count background, set to 1 (bg class)
    "image_hw": (1024, 1024), # default is 1024, 1024

    "feature_input": False, # or "True" for *.pt features
    "dataset_mean": (0.485, 0.456, 0.406),
    "dataset_std": (0.229, 0.224, 0.225),

@jingweizhang-xyz
Copy link
Member

Looks ok, you can have a try.

@dw1360585641
Copy link

看起来不错,你可以试试。

  1. i have a question about dataset,like this : in my dataset, all the image has two class: background , glomerulus,and i set background(0),glomerulus(1), so the follow is right ?
    “val_fold_id”: 0,
    “num_classes”: 3,
    "ignored_classes": None,
    "ignored_classes_metric": None,
  2. Besides,the number of fold in the file(.csv),i know img_id is filepath, fold = -1 is test-image, fold =0 is val-image, but fold =1,fold =2,fold=3 mean to what in the pixel of mask ? Because if i set all fold =1 execept filename with fold =-1,0 and the result is wrong, but success if i set fold =2 ,why?
    my .csv like this:
    img_id,fold
    image0,-1
    image1,-1
    image2,-1
    image3,-1
    image4,-1
    image5,-1
    image6,-1
    image7,-1
    image8,-1
    image9,-1
    image10,0
    image11,0
    image12,0
    image13,0
    image14,0
    image15,0
    image16,0
    image17,0
    image18,0
    image19,0
    image20,0
    image21,0
    image22,0
    image23,0
    image24,0
    image25,0
    image26,0
    image27,0
    image28,0
    image29,0
    image30,0
    image31,0
    image32,0
    image33,0
    image34,0
    image35,0
    image36,0
    image37,0
    image38,0
    image39,2
    image40,2
    image41,2
    image42,2
    image43,2
    image44,2
    image45,2
    image46,2
    image47,2
    image48,2
    image49,2
    image50,2
    image51,2
    image52,2
    image53,2
    image54,2
    image55,2
    image56,2
    image57,2
    image58,2
    image59,2
    image60,2
    image61,2
    image62,2
    image63,2

@jingweizhang-xyz
Copy link
Member

For 1, it should be correct, we use an extra class in this case.
For 2, fold==-1 means this sample is in the test set, "val_fold_id" in the cfg file defines the validation set. E.g. default, val_fold_id is 0. All samples with fold==0 are the validation set and all other folds are the training set.

@dw1360585641
Copy link

dw1360585641 commented Dec 3, 2024 via email

@jingweizhang-xyz
Copy link
Member

jingweizhang-xyz commented Dec 3, 2024

You can set it to 1 for simplicity. But we assume that you have a validation dataset which fold-id is 0. Not sure if it can run without a validation set. You may need to change image_mask_dataset.py

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