Error with Segmentation Data Fine-Tuning the Model
I encountered a ValueError
while fine-tuning a model using segmentation data. The error is related to the multi_dataset.py
file:
File "/mnt/prjM3D/M3D/LaMed/src/dataset/multi_dataset.py", line 557, in __getitem__
cls_id = int(os.path.basename(seg_path).split('_')[1].split('.')[0])
ValueError: invalid literal for int() with base 10: '(3, 512, 512, 97)'
My segmentation data is organized like the following
0000
./0000/19
./0000/19/image.npy
./0000/19/mask_(1, 512, 512, 90).npz
...
The basename(seg_path)
appears to be a tuple string representing the structure of the segmentation file. I'm not sure why the code attempts to convert part of this string into an integer and whether I'm missing a preprocessing step before fine-tuning. Could you help me understand why this error occurs and what steps I might need to take to resolve it? Thank you.
Hi,
I apologize for the delay in my response.
To conserve storage space, we utilize a sparse matrix to store the mask; however, this approach omits shape information. Therefore, we incorporate the mask's shape details into the filename. You can refer to the guidelines on how to prepare the mask here. Consequently, we need to extract the mask's shape from the filename and reconstruct it using the coefficient matrix.
Regarding the issue in your code, I recommend debugging and inspecting the value of seg_path
to determine why it cannot be split. Upon reviewing the value of seg_path
, you should be able to identify the issue and find a resolution.
Should you have any further questions, please feel free to reach out.
Best regards,
BAI Fan