Lee-Gihun / MEDIAR

(NeurIPS 2022 CellSeg Challenge - 1st Winner) Open source code for "MEDIAR: Harmony of Data-Centric and Model-Centric for Multi-Modality Microscopy"
MIT License
141 stars 29 forks source link

Parameter name mismatches and other issues #3

Closed Mariosz2 closed 1 year ago

Mariosz2 commented 1 year ago

After I download the code and configure the environment, I can use pretrained and finetuned models to predict successfully, but the predicted label image is rotated 90 degrees clockwise and flipped symmetrically. But when I was about to run python main.py, I found that the parameter name in baseline.json was "tuning_mapping_file", but the parameter name in datasetter.py was "mapping_file_tuning", and there was no such parameter in mediar_example.json , which seems to be somewhat conflicting. Then when I unified the parameter names, the following error occurred in the IntensityDiversification of CellWare.py when running python main.py.

Original Traceback (most recent call last):
  File "/home/yss/anaconda3/envs/python39/lib/python3.9/site-packages/monai/transforms/transform.py", line 89, in apply_transform
    return _apply_transform(transform, data, unpack_items)
  File "/home/yss/anaconda3/envs/python39/lib/python3.9/site-packages/monai/transforms/transform.py", line 53, in _apply_transform
    return transform(parameters)
  File "/home/yss/MEDIAR/train_tools/data_utils/custom/CellAware.py", line 81, in __call__
    img_original = copy.deepcopy((1 - mask) * data["img"])
ValueError: operands could not be broadcast together with shapes (1,512,27) (3,512,512)

I checked my data set, and found the first problem occurring in the two groups of 00009 and 00010 of the official training set. My mapping_labeled.json is in the following format:

{
     "official": [
         {
             "img": "/home/yss/NeurIPS-CellSeg-main-remote/data/Official/Train_Labeled/images/cell_00001.bmp",
             "label": "/home/yss/NeurIPS-CellSeg-main-remote/data/Official/Train_Labeled/labels/cell_00001_label.tiff"
         },
         {
             "img": "/home/yss/NeurIPS-CellSeg-main-remote/data/Official/Train_Labeled/images/cell_00002.bmp",
             "label": "/home/yss/NeurIPS-CellSeg-main-remote/data/Official/Train_Labeled/labels/cell_00002_label.tiff"
         },
         {
             "img": "/home/yss/NeurIPS-CellSeg-main-remote/data/Official/Train_Labeled/images/cell_00003.bmp",
             "label": "/home/yss/NeurIPS-CellSeg-main-remote/data/Official/Train_Labeled/labels/cell_00003_label.tiff"
         },
         {
             "img": "/home/yss/NeurIPS-CellSeg-main-remote/data/Official/Train_Labeled/images/cell_00004.bmp",
             "label": "/home/yss/NeurIPS-CellSeg-main-remote/data/Official/Train_Labeled/labels/cell_00004_label.tiff"
         },
         ...
}

Is there any need for additional processing of the data before the dataloader? Does MEDIAR have the latest code version? I would greatly appreciate it if I could receive help.

Lee-Gihun commented 1 year ago

I apologize for the late reply. Thak you for pointing out the key error in the baseline config.

Actually mediar_example.json is a template file to show all options from pretraining to prediction. You can use config/* to conduct training and testing.

Did you fix the problem on CellAware.py?

Lee-Gihun commented 1 year ago

Let me close this issue for now. Please reopen this issue if it is not resolved yet.