20.03.2021 Views

Deep-Learning-with-PyTorch

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Bridging CT segmentation and nodule candidate classification

415

origin_xyz=ct.origin_xyz,

vxSize_xyz=ct.vxSize_xyz,

)

cls_tup = (prob_nodule, prob_mal, center_xyz, center_irc)

classifications_list.append(cls_tup)

return classifications_list

This is great! We can now threshold the output probabilities to get a list of things our

model thinks are actual nodules. In a practical setting, we would probably want to output

them for a radiologist to inspect. Again, we might want to adjust the threshold to

err a bit on the safe side: that is, if our threshold was 0.3 instead of 0.5, we would present

a few more candidates that turn out not to be nodules, while reducing the risk of

missing actual nodules.

Listing 14.6

nodule_analysis.py:333, NoduleAnalysisApp.main

If we don’t pass run_validation, we

print individual information …

if not self.cli_args.run_validation:

print(f"found nodule candidates in {series_uid}:")

for prob, prob_mal, center_xyz, center_irc in classifications_list:

if prob > 0.5:

s = f"nodule prob {prob:.3f}, "

if self.malignancy_model:

s += f"malignancy prob {prob_mal:.3f}, "

s += f"center xyz {center_xyz}"

print(s)

if series_uid in candidateInfo_dict:

one_confusion = match_and_score(

classifications_list, candidateInfo_dict[series_uid]

)

all_confusion += one_confusion

print_confusion(

series_uid, one_confusion, self.malignancy_model is not None

)

print_confusion(

"Total", all_confusion, self.malignancy_model is not None

)

Let’s run this for a given CT from the validation set: 3

… for all candidates found by

the segmentation where the

classifier assigned a nodule

probability of 50% or more.

If we have the ground truth data, we

compute and print the confusion matrix and

also add the current results to the total.

$ python3.6 -m p2ch14.nodule_analysis 1.3.6.1.4.1.14519.5.2.1.6279.6001

➥ .592821488053137951302246128864

...

found nodule candidates in 1.3.6.1.4.1.14519.5.2.1.6279.6001.5928214880

➥ 53137951302246128864:

3

We chose this series specifically because it has a nice mix of results.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!