LiteMedSAM Quantization is an optimized version based on the original MedSAM library. The original repository can be found here: MedSAM GitHub Repository. The quantized version of LiteMedSAM has been deployed as a WEB application, accessible at: LiteMedSAM WEB Application: https://medsam.senma.xyz/. This application allows users to upload two-dimensional medical imaging pictures (in PNG, JPG, JPEG formats) and process them using the quantized version of LiteMedSAM for image segmentation masking.
Medsam.mp4
- Clone the repository of the quantized version of LiteMedSAM:
git clone https://github.com/WorkTimer/LiteMedSAM_Quantization/
cd LiteMedSAM_Quantization
- Install necessary libraries:
sudo apt-get install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libxi6 libxtst6
- Install conda, refer to the link: Conda Installation Guide.
- Create a conda virtual environment named
medsam
:
conda create -n medsam python=3.10 -y
conda activate medsam
- Install Pytorch and related dependencies:
conda install pytorch torchvision -c pytorch
pip install streamlit pandas opencv-python numpy matplotlib pillow pyarrow
pip install -e .
- Enter the MedSAM folder:
cd MedSAM
- Run the installation command:
pip install -e .
- Download the LiteMedSAM checkpoint file
lite_medsam.pth
and place it in thework_dir/LiteMedSAM
directory. Download link: Google Drive. - Download the demo data and place it in the
test_demo/
directory. Download link: Google Drive.
- Test using the original model:
python "CVPR24_LiteMedSAM_infer.py" -i test_demo/imgs/ -o test_demo/segs
- Test using the quantized model for accelerated performance:
python "CVPR24_LiteMedSAM_infer_accelerating.py" -i test_demo/imgs/ -o test_demo/segs
- Run the following command in the terminal to start the WEB application:
streamlit run /home/scchat/MedSAM/app_streamlit.py --server.port=8501
- Access the application in a browser: http://<Server_IP>:8501
Please replace <Server_IP>
with your actual server IP address. This document provides a basic guide for the installation, configuration, and usage of the quantized version of LiteMedSAM.