# On the Automatic Generation of Medical Imaging Reports
A `pytorch` implementation of `On the Automatic Generation of Medical Imaging Reports`.
The detail of the paper can be found in [On the Automatic Generation of Medical Imaging Reports](https://arxiv.org/abs/1711.08195).
## Performance
From model only_training/only_training/20180528-02:44:52/
| Mode | BLEU-1 | BLEU-2 | BLEU-3 | BLEU-4 | METEOR | ROUGE | CIDEr |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Train | 0.386 | 0.275 | 0.215 | 0.176 | 0.187 | 0.369 | 1.075 |
| Val | 0.303 | 0.182 | 0.118 | 0.077 | 0.143 | 0.256 | 0.214 |
| Test | 0.316 | 0.190 | 0.123 | 0.081 | 0.148 | 0.264 | 0.221 |
| Paper | 0.517 | 0.386 | 0.306 | 0.247 | 0.217 | 0.447 | 0.327 |
### Tags Prediction
![Stary 2018-07-07 at 10.30.57 AM](http://o7d2h0gjo.bkt.clouddn.com/2018-07-07-Stary%202018-07-07%20at%2010.30.57%20AM.png)
### Comparison
![Stary 2018-07-07 at 10.31.02 AM](http://o7d2h0gjo.bkt.clouddn.com/2018-07-07-Stary%202018-07-07%20at%2010.31.02%20AM.png)
## Visual Results
![Stary 2018-07-07 at 10.26.54 AM](http://o7d2h0gjo.bkt.clouddn.com/2018-07-07-Stary%202018-07-07%20at%2010.26.54%20AM.png)
![Stary 2018-07-07 at 10.26.30 AM](http://o7d2h0gjo.bkt.clouddn.com/2018-07-07-Stary%202018-07-07%20at%2010.26.30%20AM.png)
![Stary 2018-07-07 at 10.26.37 AM](http://o7d2h0gjo.bkt.clouddn.com/2018-07-07-Stary%202018-07-07%20at%2010.26.37%20AM.png)
![Stary 2018-07-07 at 10.26.45 AM](http://o7d2h0gjo.bkt.clouddn.com/2018-07-07-Stary%202018-07-07%20at%2010.26.45%20AM.png)
## Training
```
usage: trainer.py [-h] [--patience PATIENCE] [--mode MODE]
[--vocab_path VOCAB_PATH] [--image_dir IMAGE_DIR]
[--caption_json CAPTION_JSON]
[--train_file_list TRAIN_FILE_LIST]
[--val_file_list VAL_FILE_LIST] [--resize RESIZE]
[--crop_size CROP_SIZE] [--model_path MODEL_PATH]
[--load_model_path LOAD_MODEL_PATH]
[--saved_model_name SAVED_MODEL_NAME] [--momentum MOMENTUM]
[--visual_model_name VISUAL_MODEL_NAME] [--pretrained]
[--classes CLASSES]
[--sementic_features_dim SEMENTIC_FEATURES_DIM] [--k K]
[--attention_version ATTENTION_VERSION]
[--embed_size EMBED_SIZE] [--hidden_size HIDDEN_SIZE]
[--sent_version SENT_VERSION]
[--sentence_num_layers SENTENCE_NUM_LAYERS]
[--dropout DROPOUT] [--word_num_layers WORD_NUM_LAYERS]
[--batch_size BATCH_SIZE] [--learning_rate LEARNING_RATE]
[--epochs EPOCHS] [--clip CLIP] [--s_max S_MAX]
[--n_max N_MAX] [--lambda_tag LAMBDA_TAG]
[--lambda_stop LAMBDA_STOP] [--lambda_word LAMBDA_WORD]
optional arguments:
-h, --help show this help message and exit
--patience PATIENCE
--mode MODE
--vocab_path VOCAB_PATH
the path for vocabulary object
--image_dir IMAGE_DIR
the path for images
--caption_json CAPTION_JSON
path for captions
--train_file_list TRAIN_FILE_LIST
the train array
--val_file_list VAL_FILE_LIST
the val array
--resize RESIZE size for resizing images
--crop_size CROP_SIZE
size for randomly cropping images
--model_path MODEL_PATH
path for saving trained models
--load_model_path LOAD_MODEL_PATH
The path of loaded model
--saved_model_name SAVED_MODEL_NAME
The name of saved model
--momentum MOMENTUM
--visual_model_name VISUAL_MODEL_NAME
CNN model name
--pretrained not using pretrained model when training
--classes CLASSES
--sementic_features_dim SEMENTIC_FEATURES_DIM
--k K
--attention_version ATTENTION_VERSION
--embed_size EMBED_SIZE
--hidden_size HIDDEN_SIZE
--sent_version SENT_VERSION
--sentence_num_layers SENTENCE_NUM_LAYERS
--dropout DROPOUT
--word_num_layers WORD_NUM_LAYERS
--batch_size BATCH_SIZE
--learning_rate LEARNING_RATE
--epochs EPOCHS
--clip CLIP gradient clip, -1 means no clip (default: 0.35)
--s_max S_MAX
--n_max N_MAX
--lambda_tag LAMBDA_TAG
--lambda_stop LAMBDA_STOP
--lambda_word LAMBDA_WORD
```
## Tester
```
usage: tester.py [-h] [--model_dir MODEL_DIR] [--image_dir IMAGE_DIR]
[--caption_json CAPTION_JSON] [--vocab_path VOCAB_PATH]
[--file_lits FILE_LITS] [--load_model_path LOAD_MODEL_PATH]
[--resize RESIZE] [--cam_size CAM_SIZE]
[--generate_dir GENERATE_DIR] [--result_path RESULT_PATH]
[--result_name RESULT_NAME] [--momentum MOMENTUM]
[--visual_model_name VISUAL_MODEL_NAME] [--pretrained]
[--classes CLASSES]
[--sementic_features_dim SEMENTIC_FEATURES_DIM] [--k K]
[--attention_version ATTENTION_VERSION]
[--embed_size EMBED_SIZE] [--hidden_size HIDDEN_SIZE]
[--sent_version SENT_VERSION]
[--sentence_num_layers SENTENCE_NUM_LAYERS]
[--dropout DROPOUT] [--word_num_layers WORD_NUM_LAYERS]
[--s_max S_MAX] [--n_max N_MAX] [--batch_size BATCH_SIZE]
[--lambda_tag LAMBDA_TAG] [--lambda_stop LAMBDA_STOP]
[--lambda_word LAMBDA_WORD]
optional arguments:
-h, --help show this help message and exit
--model_dir MODEL_DIR
--image_dir IMAGE_DIR
the path for images
--caption_json CAPTION_JSON
path for captions
--vocab_path VOCAB_PATH
the path for vocabulary object
--file_lits FILE_LITS
the path for test file list
--load_model_path LOAD_MODEL_PATH
The path of loaded model
--resize RESIZE size for resizing images
--cam_size CAM_SIZE
--generate_dir GENERATE_DIR
--result_path RESULT_PATH
the path for storing results
--result_name RESULT_NAME
the name of results
--momentum MOMENTUM
--visual_model_name VISUAL_MODEL_NAME
CNN model name
--pretrained not using pretrained model when training
--classes CLASSES
--sementic_features_dim SEMENTIC_FEATURES_DIM
--k K
--attention_version ATTENTION_VERSION
--embed_size EMBED_SIZE
--hidden_size HIDDEN_SIZE
--sent_version SENT_VERSION
--sentence_num_layers SENTENCE_NUM_LAYERS
--dropout DROPOUT
--word_num_layers WORD_NUM_LAYERS
--s_max S_MAX
--n_max N_MAX
--batch_size BATCH_SIZE
--lambda_tag LAMBDA_TAG
--lambda_stop LAMBDA_STOP
--lambda_word LAMBDA_WORD
```
### Method:
* test(): Compute loss
* generate(): generate captions for each image, and saved result (json) in `os.path.join(model_dir, result_path)`.
* sample(img_name): generate a caption for an image and its heatmap (`cam`).
## quantify the model performance
```
python2 metric_performance.py
```
```
usage: metric_performance.py [-h] [--result_path RESULT_PATH]
optional arguments:
-h, --help show this help message and exit
--result_path RESULT_PATH
```
## Review generated captions
By using jupyter to read `review_captions.ipynb`, you can review the model generated captions for each image.
## visualize training procedure
By changing `tensorboard --logdir report_models` to your owned saved models path in tensorboard.sh, you can visualize training procedure.
```
./tensorboard.sh
```
## Improve performance by change the model
In `utils/models`, I have implemented all models in basic version, and I think there will be some more powerful model structures which can improve the performance. So enjoy your work `^_^`.
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Medical-Report-Generation.rar (81个子文件)
pycocoevalcap
cider
cider.py 2KB
__init__.pyc 187B
__init__.py 21B
cider.pyc 2KB
cider_scorer.py 8KB
cider_scorer.pyc 8KB
eval.pyc 3KB
eval.py 3KB
__init__.pyc 181B
__pycache__
__init__.cpython-35.pyc 168B
eval.cpython-35.pyc 3KB
__init__.py 21B
meteor
__init__.pyc 188B
meteor.py 3KB
__init__.py 21B
meteor-1.5.jar 6.03MB
meteor.pyc 3KB
data
paraphrase-en.gz 58.95MB
bleu
bleu.py 1KB
bleu_scorer.pyc 10KB
bleu.pyc 1KB
bleu_scorer.py 8KB
LICENSE 1KB
__init__.pyc 186B
__pycache__
__init__.cpython-35.pyc 173B
bleu.cpython-35.pyc 1KB
__init__.py 21B
tokenizer
__init__.pyc 191B
__pycache__
ptbtokenizer.cpython-35.pyc 2KB
__init__.cpython-35.pyc 178B
ptbtokenizer.pyc 2KB
stanford-corenlp-3.4.1.jar 5.65MB
__init__.py 21B
ptbtokenizer.py 3KB
rouge
rouge.py 4KB
__init__.pyc 189B
__init__.py 23B
rouge.pyc 4KB
README.md 8KB
review_captions.ipynb 28KB
utils
models.py 17KB
logger.py 2KB
dataset.py 5KB
build_vocab.py 2KB
tcn.py 3KB
callbacks.py 40KB
__pycache__
tcn.cpython-35.pyc 4KB
dataset.cpython-35.pyc 5KB
models.cpython-35.pyc 12KB
build_tag.cpython-35.pyc 6KB
__init__.cpython-35.pyc 138B
logger.cpython-35.pyc 2KB
build_vocab.cpython-35.pyc 3KB
loss.cpython-35.pyc 3KB
__init__.py 0B
loss.py 3KB
build_tag.py 6KB
models_debugger.py 29KB
metric_performance.py 1KB
trainer.py 26KB
debugger.py 26KB
sample.py 11KB
.idea
vcs.xml 180B
review_performance.ipynb 202KB
results
clean_data.py 0B
tester.py 19KB
data
new_data
new_val_lst.txt 10KB
new_test_lst.txt 10KB
train_data.txt 2.74MB
test_data.txt 208KB
captions.json 2.11MB
val_data.txt 205KB
debugging_captions.json 1018B
debugging_vocab.pkl 2KB
clean_caption.py 5KB
debugging_data.txt 2KB
new_train_lst.txt 134KB
img2othersFull.pkl 3.13MB
vocab.pkl 31KB
clean_tag.py 5KB
tensorboard.sh 88B
共 81 条
- 1
自不量力的A同学
- 粉丝: 765
- 资源: 2785
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页