Dataset Viewer (First 5GB)
Auto-converted to Parquet Duplicate
Search is not available for this dataset
image
imagewidth (px)
576
6.71k
label
class label
1 class
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
2image_1024
End of preview. Expand in Data Studio

F3Seg: A Zero-Shot Generalization Model for Medical Image Segmentation

This project implements F3Seg, a zero-shot generalization model for medical image segmentation.

Overview

F3Seg leverages:

  • SAM (Segment Anything Model): Generates candidate masks using automatic mask generation with configurable parameters
  • CLIP (Contrastive Language-Image Pre-training): Ranks and filters relevant crops based on text prompts and semantic similarity
  • Adaptive Filtering: Applies dynamic thresholding based on statistical measures to select the most relevant segmentation masks

Methodology

The F3Seg pipeline follows these steps:

  1. Automatic Mask Generation: SAM generates candidate masks for the entire image
  2. Crop Extraction: Extracts visual crops from relevant mask regions using various prompt modes
  3. CLIP Ranking: Uses CLIP to score crop relevance against disease-specific text prompts
  4. Adaptive Thresholding: Selects masks based on statistical filtering (mean ± std deviation)
  5. SAM Refinement: Uses selected bounding boxes as prompts to SAM for final segmentation

Setup

To set up the project environment using conda, follow these steps:

  1. Clone the repository
  2. Navigate to the project directory
  3. Create a conda environment: conda create --name f3seg python=3.8
  4. Install dependencies: pip install -r requirements.txt
  5. Download SAM's checkpoint from here
  6. CLIP model (ViT-L/14) will be automatically downloaded on first use

Arguments

The main.py script is the main entry point. Key command-line arguments:

  • --config: Path to dataset configuration file (required)
  • --data: Dataset to use: cxr, isic, ph2, wbc, busi, clinicdb (required)
  • --mode: Inference mode - "sam_clip" or "sam_prompted" (default: sam_clip)
  • --prompt_mode: Visual prompt mode - crops, crop_expand, bbox, contour, reverse_box_mask (default: crops)
  • --seed: Random seed for reproducibility (default: 1234)

Example Commands

Basic usage with default parameters:

python main.py --config ./config/lung.json --data "cxr" --seed 1234

With custom prompt mode and model configuration:

python main.py --config ./config/isic.json --data "isic" --mode "sam_clip" --prompt_mode "crops" --seed 42

Supported Datasets

  • CXR (Chest X-Ray): Lung segmentation from chest radiographs
  • ISIC: Melanoma and skin lesion segmentation
  • PH2: Dermoscopic image analysis
  • WBC: White blood cell segmentation
  • BUSI: Breast ultrasound imaging

Acknowledgments

Greatly appreciate the tremendous effort for the following projects!

Downloads last month
6