Skip to content

IndexError/KeyError: error in p2ch14 dsets.py, even in p2ch12/13 'dsets.py' 😢 #120

@205080

Description

@205080

why it always reports :
File "G:\ml\pytorch\p2ch14s\dsets.py", line 94, in init
mhd_path = glob.glob(
^^^^^^^^^^
IndexError: list index out of range

**tips: This error occurred when I was running 'run('p2ch14s.nodule_analysis.NoduleAnalysisApp', '--run-validation')' or other spicific uid

i already put the data locally, and change it to be absolute location, i copied codes and made some minor changes to the file to become my own, like p2ch14 -> p2ch14s, but i just change some data location and add some loginfo to help us run it **

'''
class Ct:
def init(self, series_uid):

    mhd_path = glob.glob(
        'G:/ml/pytorch/data/LUNA_dataset/3723295/subset*/{}.mhd'.format(series_uid)
    )[0]

mhd_list = glob.glob('G:/ml/pytorch/data/part2/luna/subset*/*.mhd')
presentOnDisk_set = {os.path.split(p)[-1][:-4] for p in mhd_list}

candidateInfo_list = []
with open('G:/ml/pytorch/data/part2/luna/annotations_with_malignancy.csv', "r") as f:
    for row in list(csv.reader(f))[1:]:
        series_uid = row[0]
        annotationCenter_xyz = tuple([float(x) for x in row[1:4]])
        annotationDiameter_mm = float(row[4])
        isMal_bool = {'False': False, 'True': True}[row[5]]

        candidateInfo_list.append(CandidateInfoTuple(True, True, isMal_bool, annotationDiameter_mm, series_uid, annotationCenter_xyz))

with open('G:/ml/pytorch/data/part2/luna/candidates.csv', "r") as f:
    for row in list(csv.reader(f))[1:]:

'''
this is the part of the codes which is about the data location,
if i change 'G:/ml/pytorch/data/LUNA_dataset/3723295/subset*/{}.mhd' to 'G:/ml/pytorch/data/part2/luna/seg-lungs-LUNA16/{}.mhd', the report will become :
File "G:\ml\pytorch\p2ch13s\dsets.py", line 161, in init
candidateInfo_list = getCandidateInfoDict()[self.series_uid] #
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
KeyError: '1.3.6.1.4.1.14519.5.2.1.6279.6001.120196332569034738680965284519'

By the way , i have been training p2ch13/14 model, got some my own model .state, but when i use it to run 'run('p2ch14s.nodule_analysis.NoduleAnalysisApp', '--run-validation')',
the result is poor :

1.3.6.1.4.1.14519.5.2.1.6279.6001.100225287222365663678666836860
| Complete Miss | Filtered Out | Pred. Benign | Pred. Malignant
Non-Nodules | | 1 | 0 | 0
Benign | 1 | 0 | 0 | 0
Malignant | 1 | 0 | 0 | 0

help me to run it successfully, if you need more imformation, please tell me, i will resond to you, please 😢

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions