Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Zhi-Ren TsaiWei-Chieh Wu蔣德美
Published © CC BY-SA

Revolutionizing Kidney Tumor Diagnosis with MI210

DoctorGPT-based MiniGPT-4 excels in kidney tumor detection with 93% sensitivity and 86% specificity, surpassing CNN models in accuracy.

ExpertFull instructions provided24 hours118
Revolutionizing Kidney Tumor Diagnosis with MI210

Things used in this project

Hardware components

AMD MI210
×1

Software apps and online services

Ubuntu 22.04 LTS (Jammy)

Story

Read more

Schematics

Project Documentation

Detail the hardware, data and software used.

Code

This is the environment we created for developing, verifying, and testing the project.

Python
Full instructions:
Step 1: Install Ubuntu 22.04 LTS (Jammy) on an AMD MI210 Server.
Step 2: Run the following commands in the terminal to install the Docker engine.
# Add Docker's official GPG key:
$ sudo apt-get update
$ sudo apt-get install ca-certificates curl
$ sudo install -m 0755 -d /etc/apt/keyrings
$ sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
$ sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | $ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Step 3: Download the customized Docker image that we built for the pretraining, fine-tuning, and testing of MiniGPT-4 at this link.
https://asiaedutw-my.sharepoint.com/:u:/g/personal/ren_live_asia_edu_tw/EU_RkHSwX6ZDqsCLZGG4NbkB25ZMS6VQKv3TOpMKmhvxsg?e=7JuSgl
Step 4: Run the following commands in the terminal to load and run the customized Docker image:
$ docker load --input rocm_lmllm.tar
$ docker run -it -w /workspace --device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --shm-size 64G rocm/lmllm:latest
$ cd /home/asia/Downloads/minigpt4a/
Step 5: Run the following commands in the terminal to load the working Anaconda environment for MiniGPT-4.
$ conda activate py3.11
Step 6: Run the following commands in the terminal to check the test images in the following folders:
$ ls /home/asia/Downloads/minigpt4a/malignant_ts
$ ls /home/asia/Downloads/minigpt4a/benign_ts
Step 7: Run the following commands in the terminal to test the fine-tuned MiniGPT-4 model using the above test images:
$ python3 demo_tumor4.py benign_ts --cfg-path eval_configs/minigpt4_llama2_eval.yaml
$ python3 demo_tumor4.py malignant_ts --cfg-path eval_configs/minigpt4_llama2_eval.yaml
The test results of the fine-tuned MiniGPT-4 model are displayed in the txt files within the benign_ts and malignant_ts folders. The naming convention for the txt files is the test image filename concatenated with _ans. Next, run the following command in the terminal to obtain Sensitivity (Recall or True Positive Rate) and Specificity (True Negative Rate) using Llama3-70B:
$ python3 txt2acc.py
Step 8: You can find an image-text pairs dataset of 85,741 medical images that we collected and re-labelled using Llama3-70B LLM in this study for pretraining MiniGPT-4 at this link.
https://asiaedutw-my.sharepoint.com/:u:/g/personal/ren_live_asia_edu_tw/EfUuQeqZ3PdAt-FiG_IOhyABVZpJlMqMuMVR_6x2fFvsJA?e=Svs6q6
Step 9: Run the following command in the terminal to fine-tune the pretrained MiniGPT-4 model using 636 ultrasound images from the publicly available dataset on ultrasoundcases.info, along with the proposed image-text pairs of kidney tumors labeled in this study:
$ ./tr_llama2.sh
Step 10: Run the following command in the terminal to fine-tune the pretrained MiniGPT-4 model using the above 85,741 medical image-text pairs in Step 8:
$ cd /home/asia/Downloads/minigpt4a/cc_sbu_align
Next, unzip 85741images_base_tr.zip to obtain the image folder and filter_cap.json, and replace the original image folder and filter_cap.json in the cc_sbu_align folder with these.
$ cd ..
$ ./tr_llama2.sh
Step 11: You can find a project that we built for demoing the transfer learning and testing of 10 types of CNNs in this study at this link.
https://asiaedutw-my.sharepoint.com/:u:/g/personal/ren_live_asia_edu_tw/Ed-QUwblek5DknLd1ZQPLc4BwpuXWLf77hCi6IQx5qXMCQ?e=dCNxpM
$ unzip cnns_proj2.zip
$ cd cnns_proj2
Step 12: Run the following command in the terminal to test the fine-tuned CNNs using the above test images:
$ sudo chmod 777 ts_cnns.sh
$ ./ts_cnns.sh
Step 13: Run the following command in the terminal to fine-tune the pretrained CNNs using 636 ultrasound images from the publicly available dataset on ultrasoundcases.info:
$ sudo chmod 777 tr_cnns.sh
$ ./tr_cnns.sh
# Please refer to the above full instructions.

Credits

Zhi-Ren Tsai
1 project • 1 follower
I conduct medical research at Asia University. I've spent four months preparing this project using the MI210 donated by AMD.
Wei-Chieh Wu
1 project • 0 followers
蔣德美
1 project • 0 followers

Comments