ttanida / rgrg

Code for the CVPR paper "Interactive and Explainable Region-guided Radiology Report Generation"
MIT License
146 stars 25 forks source link

how to do inference on image? #8

Closed aiakash closed 1 year ago

aiakash commented 1 year ago

thanks for great project, i saw the code but is there any simple way to load the weights & do inference & get the report ?

ttanida commented 1 year ago

Hi,

I created this script for you: generate_reports_for_images.py.

This should make it straightforward to generate reports for a list of images.

aiakash commented 1 year ago

@ttanida ill try this thanks a lot

aiakash commented 1 year ago

why is the model weight sie 4.2 gb? its normal ? need to pass this .pt to model ckpt right ?

https://drive.google.com/u/0/uc?id=1rDxqzOhjqydsOrITJrX0Rj1PAdMeP7Wy&export=download
aiakash commented 1 year ago

im getting this error ,even i installed torch 1.12 & im using google collab for inference.

ModuleNotFoundError                       Traceback (most recent call last)
[<ipython-input-22-ca674bb84bb8>](https://localhost:8080/#) in <cell line: 21>()
     19 
     20 from src.full_model.report_generation_model import ReportGenerationModel
---> 21 from src.full_model.train_full_model import get_tokenizer
     22 
     23 device = torch.device("cuda")

1 frames
[/usr/local/lib/python3.10/dist-packages/torch/random.py](https://localhost:8080/#) in manual_seed(seed)
     40         torch.cuda.manual_seed_all(seed)
     41 
---> 42     return default_generator.manual_seed(seed)
     43 
     44 

ModuleNotFoundError: No module named 'torch.mps'
ttanida commented 1 year ago

Did you follow these steps to setup the repo? In particular step 1 and 3 are needed. The script worked fine for me even when I ran it on my local computer without GPU.

mk-runner commented 11 months ago

generate_reports_for_images

I ran "python generate_reports_for_images.py" with full model checkpoint from https://drive.google.com/file/d/1rDxqzOhjqydsOrITJrX0Rj1PAdMeP7Wy/view on MIMIC-CXR test set, the performance is deficient (e.g., BLUE1 0.21). Can you help solve it? Thank you