This project implements the Head CT Ontology Normalized Evaluation (HeadCT-ONE), a novel metric for evaluating head CT report generation through ontology-normalized entity and relation extraction. HeadCT-ONE represents a significant advancement in the automated evaluation of radiology reports, particularly for head CT scans.
This project provides the necessary tools and scripts to process head CT reports using the HeadCT-ONE metric, including Named Entity Recognition (NER) models and knowledge graph generation.
To set up the required environment, use the provided environment.yml
file:
conda env create -f environment.yml
conda activate ner_kg_env
The checkpoints of NER models can be found at Google Drive
The input file should be a JSONL (JSON Lines) file with the following structure for each line:
{
"id": "unique_identifier",
"key1": "ground_truth_text",
"key2": "predicted_text"
}
id
: A unique identifier for each entrykey1
: The ground truth text (default: "original_report")key2
: The predicted text (default: "modified_report")
To run the code, use the following command:
python main.py --input_jsonl_file path/to/your/input.jsonl
--ner_data_dir
: Directory for NER data (default: './ner/data')--ner_result_dir
: Directory for NER results (default: './ner/result/0823_run_relation')--kg_result_dir
: Directory for knowledge graph results (default: './kg/data')--id_key
: Key for ID in input data (default: 'id')--gt_key
: Key for ground truth in input data (default: 'original_report')--pred_key
: Key for predictions in input data (default: 'modified_report')
- Preprocess input data
- Run NER and Relation Extraction models
- Postprocess results
- Generate knowledge graphs
The final results will be saved in the ./kg/data
directory, including:
gt.json
: Processed ground truth datapred.json
: Processed prediction datagt_kg.json
: Knowledge graph for ground truth datapred_kg.json
: Knowledge graph for prediction data
Ensure that you have the necessary permissions to execute the Python scripts and access the specified directories.