wentaozhu / DeepLung

WACV18 paper "DeepLung: Deep 3D Dual Path Nets for Automated Pulmonary Nodule Detection and Classification"
Apache License 2.0
316 stars 143 forks source link

Empty paths in frocwrtdetpepchluna16.py #4

Closed ghost closed 6 years ago

ghost commented 6 years ago

Dear Team, I am trying to run frocwrtdetpepchluna16.py. Do I have to generate these files for each fold or did you already do that?

annotations_filename = # path for ground truth annotations for the fold
annotations_excluded_filename = # path for excluded annotations for the fold
seriesuids_filename = # path for seriesuid for the fold

Best,

ghost commented 6 years ago
/usr/bin/python3.5 /home/nec/shlomo/db/dev/thirdparty/DeepLung/evaluationScript/noduleCADEvaluationLUNA16.py
./annotations/annotations.csv
Error file name: ./annotations/annotations.csv, exception : iterator should return strings, not bytes (did you open the file in text mode?)
Error file name: ./annotations/annotations_excluded.csv, exception : iterator should return strings, not bytes (did you open the file in text mode?)
Error file name: ./annotations/seriesuids.csv, exception : iterator should return strings, not bytes (did you open the file in text mode?)
Total number of included nodule annotations: 0
Total number of nodule annotations: 0
Error file name: ./annotations/3DRes18FasterR-CNN.csv, exception : iterator should return strings, not bytes (did you open the file in text mode?)
Traceback (most recent call last):
  File "/home/nec/shlomo/db/dev/thirdparty/DeepLung/evaluationScript/noduleCADEvaluationLUNA16.py", line 589, in <module>
    noduleCADEvaluation(annotations_filename,annotations_excluded_filename,seriesuids_filename,results_filename,'./')
  File "/home/nec/shlomo/db/dev/thirdparty/DeepLung/evaluationScript/noduleCADEvaluationLUNA16.py", line 581, in noduleCADEvaluation
    numberOfBootstrapSamples=bNumberOfBootstrapSamples, confidence=bConfidence)
  File "/home/nec/shlomo/db/dev/thirdparty/DeepLung/evaluationScript/noduleCADEvaluationLUNA16.py", line 414, in evaluateCAD
    nodOutputfile.write("    Average number of candidates per scan: %.9f\n" % (float(totalNumberOfCands) / float(len(seriesUIDs))))
ZeroDivisionError: float division by zero

Process finished with exit code 1
ghost commented 6 years ago

For python 3:

def readCSV(filename):
    lines = []
    try:
        with open(filename, "rt",  encoding="utf-8") as f:
            csvreader = csv.reader(f)
            for line in csvreader:
                lines.append(line)
    except Exception as e:
        print('Error file name: {}, exception : {}'.format(filename, e))

    return lines
wentaozhu commented 6 years ago

1) Yes. Because we need to validate the performance of each fold typically. The LUNA16 only provides the annotation for the entire dataset. You need to split them into the 10 folds for validation.

2) I am very sorry for the error. How about running 'noduleCADEvaluationLUNA16compare.py' in the evaluationScript folder. I just upload the file. You can get the visualization results for DPN model (I also uploaded the DPN prediction results). For the ResNet evaluation, I think the encoding of the csv file has some problem. You are welcomed to help solve the problem. I am very busy recently. If you can not solve it, remind me next week and I can solve it. Thank you for your contribution!

3) I use python 2.7.14 Anaconda for the environment.

ghost commented 6 years ago

Thanks for the reply! I converted the code to Python 3.5.

You need to split them into the 10 folds for validation. I was able to run /evaluationScript/frocwrtdetpepchluna16.py, and produce FROC, and I did NOT split the CSV, I saw in the code that fold=9, however, I am puzzled how does this work if these lines are commented out?

Additionally, do you have a script for splitting the CSV into 10 folds? Best,

ghost commented 6 years ago

Also, Can you share the code for creating the Visualizations in Figures 7 and 8 in the paper?

wentaozhu commented 6 years ago

@bayesianio The LUNA16 provides the splitting of 10 folds. You can download it from the website https://luna16.grand-challenge.org/download/

wentaozhu commented 6 years ago

@QuantScientist I think you mean the visualization of detection results. You can just use matplotlib to plot the annotation ground truth, the prediction. Because there are all in the numpy array format.

For circle plot, you can calculate if b1 < np.square(x - center) < b2: x = 1 else: x = 0 You can get it from the generated mask x.

ghost commented 6 years ago

Thanks, In line 153 in layers.py, this error is thrown:

selection_022

_, idcs = torch.topk(neg_output, min(num_hard, len(neg_output)))

RuntimeError: dimension specified as -1 but tensor has no dimensions

I decreased the batch size to 4, but I do not think this is related.

wentaozhu commented 6 years ago

It shows you do not have negative samples. Check your label and data loader process file.

ghost commented 6 years ago

It shows you do not have negative samples. Check your label and data loader process file.

Pre-processing completed successfully. Which process was supposed to generate the negative samples?

wentaozhu commented 6 years ago

Check detector/data.py line 380-311. The shape of numpy array representing the returned negative samples.

MjdMahasneh commented 3 years ago

Thanks for the reply! I converted the code to Python 3.5.

You need to split them into the 10 folds for validation. I was able to run /evaluationScript/frocwrtdetpepchluna16.py, and produce FROC, and I did NOT split the CSV, I saw in the code that fold=9, however, I am puzzled how does this work if these lines are commented out?

Additionally, do you have a script for splitting the CSV into 10 folds? Best,

Hello @deeponcology , did you convert the entire code to Python 3? I am working on this at the moment, was wondering which parts did you particularly have to change? for example, am trying to evaluate the division operations '/' to make sure they have consistent behaviour in Python 3.5, with that in the original Python 2.7 implementation. Was that one thing you had to look for? and what other things did you notice that needs looking after?

Obviously, if you share your scripts, that would be immensely helpful! otherwise, any elaboration and advice would be extremely appreciated. Please, and thank you in advance.

ghost commented 3 years ago

It was over two years ago ... I don't even have the code at my possession anymore!

MjdMahasneh commented 3 years ago

It was over two years ago ... I don't even have the code at my possession anymore!

@QuantScientist that's fine, If you have any advice on what to look for when converting the scripts to Python 3, that would of very much help, just a few comments maybe, otherwise, thank you for taking the time to respond.