模型:
这个BlipForConditionalGeneration模型根据胸部X射线和临床指征(例如“RLL crackles, eval for pneumonia”)生成逼真的放射学报告。
任何医疗应用。
from PIL import Image
from transformers import BlipForConditionalGeneration, BlipProcessor
# read in the model
processor = BlipProcessor.from_pretrained("nathansutton/generate-cxr")
model = BlipForConditionalGeneration.from_pretrained("nathansutton/generate-cxr")
# your data
my_image = 'my-chest-x-ray.jpg'
my_indication = 'RLL crackles, eval for pneumonia'
# process the inputs
inputs = processor(
images=Image.open(my_image),
text='indication:' + my_indication,
return_tensors="pt"
)
# generate an entire radiology report
output = model.generate(**inputs,max_length=512)
report = processor.decode(output[0], skip_special_tokens=True)
通过将MIMIC-CXR中的放射学报告与MIMIC-CXR-JPG中的图像进行交叉参考来训练此模型。这些数据不在此处提供,需要与physionet签署数据使用协议。