Image Segmentation
PyTorch
sam2
custom-sam2
glove
baseball
sports-analytics
computer-vision
custom-model
Instructions to use caball21/glove_labelling with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sam2
How to use caball21/glove_labelling with sam2:
# Use SAM2 with images import torch from sam2.sam2_image_predictor import SAM2ImagePredictor predictor = SAM2ImagePredictor.from_pretrained(caball21/glove_labelling) 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(caball21/glove_labelling) 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
Create readme.md
Browse files
readme.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Glove Labelling Model (SAM 2.1 Fine-Tuned)
|
| 2 |
+
|
| 3 |
+
This model is a fine-tuned [Segment Anything Model (SAM 2.1)](https://github.com/facebookresearch/segment-anything) designed specifically for **baseball glove segmentation**. It identifies fine-grained regions on a pitcher’s glove from video frames, with the goal of analyzing glove position, shape, and movement across pitches.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## 🔍 Model Details
|
| 8 |
+
|
| 9 |
+
- **Architecture**: SAM 2.1 Hiera-L variant
|
| 10 |
+
- **Framework**: PyTorch
|
| 11 |
+
- **Training Type**: Image-only fine-tuning on custom glove segmentation data
|
| 12 |
+
- **Losses**: Dice, IoU, and mask loss
|
| 13 |
+
- **Epochs**: 50
|
| 14 |
+
- **Batch Size**: 2
|
| 15 |
+
- **Dataset**: Custom COCO-format sequences of glove mask annotations split by pitch
|
| 16 |
+
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
## 🏷️ Labels (Classes)
|
| 20 |
+
|
| 21 |
+
This model supports six segmentation classes:
|
| 22 |
+
- `glove_outline`
|
| 23 |
+
- `webbing`
|
| 24 |
+
- `thumb`
|
| 25 |
+
- `palm_pocket`
|
| 26 |
+
- `hand`
|
| 27 |
+
- `glove_exterior`
|
| 28 |
+
|
| 29 |
+
---
|
| 30 |
+
|
| 31 |
+
## 📁 Files in This Repo
|
| 32 |
+
|
| 33 |
+
| File | Description |
|
| 34 |
+
|-----------------------|------------------------------------------|
|
| 35 |
+
| `pytorch_model.bin` | Trained PyTorch weights (`.pt` file) |
|
| 36 |
+
| `config.json` | Model and dataset configuration |
|
| 37 |
+
| `README.md` | You're reading it |
|
| 38 |
+
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
## 🚀 Deployment Options
|
| 42 |
+
|
| 43 |
+
You can deploy this model using:
|
| 44 |
+
- **Google Cloud Vertex AI** (via Model Garden)
|
| 45 |
+
- **TorchServe**
|
| 46 |
+
- **CVAT** (via a custom segmentation model)
|
| 47 |
+
- **Hugging Face Inference Endpoints** (manual handler required)
|
| 48 |
+
|
| 49 |
+
---
|
| 50 |
+
|
| 51 |
+
## 🔗 Author
|
| 52 |
+
|
| 53 |
+
Created and maintained by [`caball21`](https://huggingface.co/caball21)
|
| 54 |
+
Please cite if used in academic or production applications.
|