Git Product home page Git Product logo

chatcad's Introduction

[COMMSENG'24, TMI'24] Interactive Computer-Aided Diagnosis using LLMs

This repo includes official implementations of ChatCAD and ChatCAD+

Paper

[Nature COMMSENG] ChatCAD: Interactive Computer-Aided Diagnosis on Medical Image using Large Language Models by Sheng Wang, Zihao Zhao, Xi Ouyang, Tianming Liu, Qian Wang, Dinggang Shen

(a) Overview of our proposed strategy. The image is processed by various networks to generate diverse outputs, which are then transformed into text descriptions. The descriptions, served as a link between visual and linguistic information, are combined as inputs to a large language model (LLM). With its ability to reason and its knowledge of the medical field, the LLM can provide a condensed report. (b) Interactive explanations and medical advice from ChatCAD.

[IEEE TMI] ChatCAD+: Towards a Reliable and Universal Interactive CAD using LLMs by Zihao Zhao*, Sheng Wang*, Jinchen Gu*, Yitao Zhu*, Lanzhuju Mei, Zixu Zhuang, Zhiming Cui, Qian Wang, Dinggang Shen

Overview of our proposed ChatCAD+ system. (a) For patients seeking a diagnosis, ChatCAD+ generates reliable medical reports based on the input medical image(s) by referring to local report database. (b) Additionally, for any inquiry from patients, ChatCAD+ retrieves related knowledge from online database and lets large language model generate reliable response.

Introduction

This repository provides the official implementation of some components of ChatCAD+:

  • Modality identification Open in Colab
  • Chinese version Interactive CAD of Chest X-rays
  • LLM-based knowledge retrieval
  • An easy-deploy local web ui based on Gradio

Resources

  • We would like to thank Merck Manual Professional who make all these medical knowledge public, we sorted their website for easier usage: here
  • A BART-based model that has the capability to translate chest X-ray reports into Chinese well [link]

Usage

weights&others

  • R2GenCMN: r2gcmn_mimic-cxr.pth and annotation.json
  • PCAM weights: JFchexpert.pth
  • Place annotation.json under ./r2g/ and pre-trained weights under ./weights/
  • For template retrieval system, please download MIMIC-CXR reports from official website and organize them into a dictionary, save as report_en_dict.json under the ./

You can either find them from original repository or dowload from Google Drive

Deploy local web ui

  • pip install -r requirements.txt
  • implement web.py and load your openai api-key


- Would like some diagnostic results? upload image via left panel --> wait for your report


- ChatCAD+ will answer your question with a reference from Merck Manucal Professional


Citation

If you find our work useful, please consider giving a star ⭐ and citation.

@article{wang2023chatcad,
  title={Chatcad: Interactive computer-aided diagnosis on medical image using large language models},
  author={Wang, Sheng and Zhao, Zihao and Ouyang, Xi and Wang, Qian and Shen, Dinggang},
  journal={arXiv preprint arXiv:2302.07257},
  year={2023}
}

@article{zhao2023chatcad,
      title={ChatCAD+: Towards a Universal and Reliable Interactive CAD using LLMs},
      author={Zihao Zhao and Sheng Wang and Jinchen Gu and Yitao Zhu and Lanzhuju Mei and Zixu Zhuang and Zhiming Cui and Qian Wang and Dinggang Shen},
      journal={arXiv preprint arXiv:2305.15964},
      year={2023},
}

Acknowledgment

Our implementation (including coming version) is based on the following codebases. We gratefully thank the authors for their wonderful works.

R2GenCMN, PCAM, CSNet.

chatcad's People

Contributors

zhaozh10 avatar absterzhu avatar jamesqfreeman avatar

Stargazers

 avatar ZiFeng Xu avatar  avatar Xinyu Liu avatar Binjian avatar Mei Wang avatar AkshayJain avatar  avatar HarveyYi avatar  avatar Dawn avatar leed avatar Bowen Zheng avatar  avatar  avatar Dawn avatar  avatar  avatar  avatar Thanuja Ambegoda avatar Vaibhav Sethia avatar  avatar 乌龙 avatar Cheyanne Lee avatar Muhammad Sulaiman avatar  avatar Kim HyoJun avatar Qingpeng Kong avatar  avatar Username Jones avatar  avatar Sami Nas avatar 394481125 avatar  avatar LAU Kane avatar Thomas Friedel avatar  avatar 周凯 avatar  avatar Lukas Bierling avatar Shuge Lei avatar wan avatar  avatar William Lee avatar Juhyuk Han avatar cytusbox avatar Yuxiang Nie avatar  avatar Satyam Tiwary avatar Xuecheng avatar  avatar FlyingCat avatar  avatar  avatar Niranjan Anandkumar avatar Pablo avatar  avatar Luo Chen avatar  avatar Wenpei Jiao avatar HsinMing Chen avatar Hossein Mokhtarzadeh avatar  avatar ZionC avatar Subtitle123 avatar Chenlin Du avatar Hong JianYuan avatar  avatar Sandalots avatar 姬忠鹏 avatar 爱可可-爱生活 avatar Jintai Chen avatar Shishuang Zhao avatar Tom avatar Dr. Santosh Shah avatar Sinuo Wang avatar  avatar Yann Ma avatar PENG PEIXI avatar  avatar Han Wu avatar  avatar cz avatar  avatar  avatar  avatar Jeff Carpenter avatar dayang_wang avatar ziyan huang avatar 王梦伟 avatar Chan Chi-Min avatar  avatar Li Yonghao avatar  avatar SheldonHur avatar  avatar leo sher avatar  avatar Yunkang Cao avatar Mitchell Parker avatar

Watchers

Swizard avatar  avatar  avatar  avatar  avatar wan avatar

chatcad's Issues

你好,我在运行web.py的时候,链接打开的同时报错,这该怎么解决?(并且我已确认代理正常,gradio版本是3.31.0,api key正常)

(cad) zzz@zzz:~/yz/AllVscodes/ChatCAD-main$ python3 web.py
/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/revChatGPT/init.py:29: UserWarning: The current Python is not a recommended version, 3.10+ is recommended
import("warnings").warn(
Running on local URL: http://127.0.0.1:4900

To create a public link, set share=True in launch().
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 408, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in call
return await self.app(scope, receive, send)
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/fastapi/applications.py", line 1106, in call
await super().call(scope, receive, send)
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/applications.py", line 122, in call
await self.middleware_stack(scope, receive, send)
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/middleware/errors.py", line 184, in call
raise exc
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/middleware/errors.py", line 162, in call
await self.app(scope, receive, _send)
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/middleware/cors.py", line 83, in call
await self.app(scope, receive, send)
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 79, in call
raise exc
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 68, in call
await self.app(scope, receive, sender)
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in call
raise e
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in call
await self.app(scope, receive, send)
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/routing.py", line 718, in call
await route.handle(scope, receive, send)
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/routing.py", line 66, in app
response = await func(request)
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/fastapi/routing.py", line 274, in app
raw_response = await run_endpoint_function(
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/fastapi/routing.py", line 193, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/anyio/to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 807, in run
result = context.run(func, *args)
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/gradio/routes.py", line 263, in api_info
return gradio.blocks.get_api_info(config, serialize) # type: ignore
File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/gradio/blocks.py", line 504, in get_api_info
serializer = serializing.COMPONENT_MAPPINGtype
KeyError: 'dataset'

输入api后

api输入后,
image
等待很久后没结果
上传图像也再显示
image

Inference using code

Hi, thanks for the amazing project, however I am not able to get the gradio web ui running (shows 初始化失败,请输入正确的openai key。I have tried your testing code and it works well with my api key) Do you have a code sample for running inference without using the web ui? Thanks a lot

code

Your work is impressive and has greatly inspired my research. How can I fine-tune your code using my own dataset, or how can I reproduce your paper from scratch?

training script

thanks for your excellent work. Can you provide a training script for the generator?

Report refinement

Hello, @zhaozh10

First of all, thank you for sharing your great work!

I recently read your ChatCAD+ paper and have a question about a specific part, so I am creating an issue here.

I am particularly curious about the report refinement method. The paper mentions "LLM to refine its preliminary report with retrieve k reports, and generate the enhanced report." Does this mean you provided the LLM with the top k reports and used a prompt to create an enhanced report? Could you please share the instructions or process you used for this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.