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-SAM
Using Anaconda Virtual Environments
conda create -n venv python=3.10 -y
conda activate venv
Or for Linux operating system, you can use that
python3.10 -m venv venv
source venv/bin/activate
pip 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.py
Now,open up your local host with a port like that on your web browser.
http://localhost:8080
You can train your model with your own dataset.
http://localhost:8080/train
After completing the training, you can now upload any blood cells image and detect the blood cells.