deep-learning-with-pytorch / dlwpt-code

Code for the book Deep Learning with PyTorch by Eli Stevens, Luca Antiga, and Thomas Viehmann.

Home Page:https://www.manning.com/books/deep-learning-with-pytorch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

p

icegomic opened this issue · comments

commented
p
commented

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'

commented

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]]