deep-learning-with-pytorch / dlwpt-code

Code for the book Deep Learning with PyTorch by Eli Stevens, Luca Antiga, and Thomas Viehmann.
https://www.manning.com/books/deep-learning-with-pytorch
4.69k stars 1.98k forks source link

p #95

Open icegomic opened 2 years ago

icegomic commented 2 years ago

KeyError Traceback (most recent call last)

in ----> 1 run('p2ch13.prepcache.LunaPrepCacheApp') in run(app, *argv) 5 6 app_cls = importstr(*app.rsplit('.', 1)) # <2> ----> 7 app_cls(argv).main() 8 9 log.info("Finished: {}.{!r}).main()".format(app, argv)) ~\Documents\pythonProjects\pytorch-learning\p2ch13\prepcache.py in main(self) 49 50 self.prep_dl = DataLoader( ---> 51 PrepcacheLunaDataset( 52 # sortby_str='series_uid', 53 ), ~\Documents\pythonProjects\pytorch-learning\p2ch13\dsets.py in __init__(self, *args, **kwargs) 345 super().__init__(*args, **kwargs) 346 --> 347 self.candidateInfo_list = getCandidateInfoList() 348 self.pos_list = [nt for nt in self.candidateInfo_list if nt.isNodule_bool] 349 ~\Documents\pythonProjects\pytorch-learning\p2ch13\dsets.py in getCandidateInfoList(requireOnDisk_bool) 47 annotationCenter_xyz = tuple([float(x) for x in row[1:4]]) 48 annotationDiameter_mm = float(row[4]) ---> 49 isMal_bool = {'False': False, 'True': True}[row[5]] 50 51 candidateInfo_list.append( KeyError: '1.0'
icegomic commented 2 years ago

I have fixed this error. the reason is that the row[5] in file annotations_with_malignancy.csv value is '1.0' or '0.0', but the code recive 'True' or 'False' I modify the code as isMal_bool = {'0.0': False, '1.0': True}[row[5]] #isMal_bool = {'False': False, 'True': True}[row[5]]