Skip to content

Py3 scripts for LUNA16 eval #1068

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Nov 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion detection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ python3 luna16_testing.py \

#### [3.4 LUNA16 Detection Evaluation](./run_luna16_offical_eval.sh)
Please download the official LUNA16 evaluation scripts from https://luna16.grand-challenge.org/Evaluation/,
and save it as ./evaluation_luna16. Note that the official LUNA16 evaluation scripts are based on Python2.
and save it as ./evaluation_luna16. Note that the official LUNA16 evaluation scripts are based on python2.

To run it with python3, please 1) copy the files in ./evaluationScript_py3_update to replace the files in downloaded scripts in ./evaluation_luna16; 2) then run the following command to convert python2 code to python3 code: `python -m pip install future; futurize --stage1 -w evaluation_luna16/noduleCADEvaluationLUNA16.py; futurize --stage2 -w evaluation_luna16/noduleCADEvaluationLUNA16.py`;
3) In ./evaluation_luna16/noduleCADEvaluationLUNA16.py, replace `plt.xscale('log', basex=2)` with `plt.xscale('log', base=2)`.

./evaluation_luna16/noduleCADEvaluationLUNA16.py will be the main python script to generate evaluation scores.

Expand Down
46 changes: 46 additions & 0 deletions detection/evaluationScript_py3_update/tools/csvTools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import csv


def writeCSV(filename, lines):
with open(filename, "wb") as f:
csvwriter = csv.writer(f)
csvwriter.writerows(lines)


def readCSV(filename):
lines = []
try:
with open(filename, "rb") as f:
csvreader = csv.reader(f)
for line in csvreader:
lines.append(line)
except:
with open(filename, "r") as f:
csvreader = csv.reader(f)
for line in csvreader:
lines.append(line)
return lines


def tryFloat(value):
try:
value = float(value)
except:
value = value

return value


def getColumn(lines, columnid, elementType=""):
column = []
for line in lines:
try:
value = line[columnid]
except:
continue

if elementType == "float":
value = tryFloat(value)

column.append(value)
return column
2 changes: 1 addition & 1 deletion detection/run_luna16_offical_eval.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ python ./luna16_post_combine_cross_fold_results.py \
-o ./result/result_luna16_all.csv

mkdir -p ./result/eval_luna16_scores
python2 ./evaluation_luna16/noduleCADEvaluationLUNA16.py \
python ./evaluation_luna16/noduleCADEvaluationLUNA16.py \
./evaluation_luna16/annotations/annotations.csv \
./evaluation_luna16/annotations/annotations_excluded.csv \
./evaluation_luna16/annotations/seriesuids.csv \
Expand Down