This project provides an implementation of image segmentation using YOLOv8, a state-of-the-art object detection algorithm, coupled with Spatial Attention Module (SAM) for enhanced segmentation accuracy. Leveraging the power of YOLOv8's object detection capabilities and SAM's attention mechanism, this project offers efficient and precise segmentation of images.
Here, I have used this blood cells dataset. You can use your own dataset.
https://github.com/utpalpaul108/Image-Segmentation-Using-YOLOv8-and-SAMUsing Anaconda Virtual Environments
conda create -n venv python=3.10 -y
conda activate venvOr for Linux operating system, you can use that
python3.10 -m venv venv
source venv/bin/activatepip install -r requirements.txt
pip install 'git+https://github.com/facebookresearch/segment-anything.git'
wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth
wget https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8x.pt
Finally, run the following command to run your application:
python app.pyNow,open up your local host with a port like that on your web browser.
http://localhost:8080You can train your model with your own dataset.
http://localhost:8080/trainAfter completing the training, you can now upload any blood cells image and detect the blood cells.
