Image Segmentation
PyTorch
sam2
English
computer-vision
segmentation
few-shot-learning
zero-shot-learning
clip
Instructions to use ParallelLLC/Segmentation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sam2
How to use ParallelLLC/Segmentation with sam2:
# Use SAM2 with images import torch from sam2.sam2_image_predictor import SAM2ImagePredictor predictor = SAM2ImagePredictor.from_pretrained(ParallelLLC/Segmentation) with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): predictor.set_image(<your_image>) masks, _, _ = predictor.predict(<input_prompts>)# Use SAM2 with videos import torch from sam2.sam2_video_predictor import SAM2VideoPredictor predictor = SAM2VideoPredictor.from_pretrained(ParallelLLC/Segmentation) with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): state = predictor.init_state(<your_video>) # add new prompts and instantly get the output on the same frame frame_idx, object_ids, masks = predictor.add_new_points(state, <your_prompts>): # propagate the prompts to get masklets throughout the video for frame_idx, object_ids, masks in predictor.propagate_in_video(state): ... - Notebooks
- Google Colab
- Kaggle
File size: 895 Bytes
12fa055 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | # Core ML/DL libraries torch>=2.0.0 torchvision>=0.15.0 transformers>=4.30.0 diffusers>=0.21.0 # SAM 2 and related segment-anything-2>=0.1.0 groundingdino-py>=0.4.0 ultralytics>=8.0.0 # Computer Vision opencv-python>=4.8.0 Pillow>=10.0.0 albumentations>=1.3.0 kornia>=0.6.0 # Data processing numpy>=1.24.0 pandas>=2.0.0 scipy>=1.10.0 scikit-learn>=1.3.0 scikit-image>=0.21.0 # Visualization matplotlib>=3.7.0 seaborn>=0.12.0 plotly>=5.15.0 wandb>=0.15.0 # Jupyter and notebooks jupyter>=1.0.0 ipywidgets>=8.0.0 # Utilities tqdm>=4.65.0 pyyaml>=6.0 click>=8.1.0 rich>=13.0.0 # Domain-specific rasterio>=1.3.0 # Satellite imagery fiona>=1.9.0 # Geospatial data geopandas>=0.13.0 # Geospatial analysis # Evaluation metrics pycocotools>=2.0.6 timm>=0.9.0 # Optional: GPU acceleration # cupy-cuda11x>=12.0.0 # Uncomment for CUDA 11.x # cupy-cuda12x>=12.0.0 # Uncomment for CUDA 12.x |