Open BaseMax opened 4 years ago
It simply means that validation_cases
is larger than len(self.patients)
.
patients
is a dictionary mapping patient IDs to volumes.
Did you run it on your own dataset?
You can add this assert after setting self.patients
variable: https://github.com/mateuszbuda/brain-segmentation-pytorch/blob/8ef2e2d423b67b53ec8113fc71a9b968bb0f66e7/dataset.py#L51
assert len(patients) >= validation_cases, f'The number of patients ({len(self.patients)}) is lower than the validation sample size ({validation_cases})'
I have solved " validation_patients = random.sample(self.patients, k=validation_cases) File "/usr/lib/python3.6/random.py", line 320, in sample raise ValueError("Sample larger than population or is negative") ValueError: Sample larger than population or is negative" issue by adding --images 'root folder with images' argument while running inference.py
我也遇到过相同的问题,可能是您的路径超参数设置与你代码的真实目录有出入 parser.add_argument( "--images", type=str, default="./kaggle_3m", help="root folder with images" ) 请将这一部分进行修改
Hello,
Running python script cause to an error:
History of my commands in a Arch Linux system:
[max@base brain-segmentation-pytorch]$ python -v
[max@base brain-segmentation-pytorch]$ python inference.py --images data --weights weights/unet.pt
We face to same problem in Google CoLab:
Can you guide?
I change 56th line of
dataset.py
, from:to:
Still, there is an error in the program:
[max@base brain-segmentation-pytorch]$ python3 inference.py --images data --weights weights/unet.pt
Regards, Max