Instructions to use Gertlek/DetectiveSAM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sam2
How to use Gertlek/DetectiveSAM with sam2:
# Use SAM2 with images import torch from sam2.sam2_image_predictor import SAM2ImagePredictor predictor = SAM2ImagePredictor.from_pretrained(Gertlek/DetectiveSAM) 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(Gertlek/DetectiveSAM) 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
Keep banana and train CocoGlide demos
Browse files- README.md +2 -2
- demo/cocoglide/mask/airplane_139871.png +0 -0
- demo/cocoglide/mask/giraffe_296969.png +0 -0
- demo/cocoglide/mask/tv_453722.png +0 -0
- demo/cocoglide/source/airplane_139871.png +0 -3
- demo/cocoglide/source/giraffe_296969.png +0 -3
- demo/cocoglide/source/tv_453722.png +0 -3
- demo/cocoglide/target/airplane_139871.png +0 -3
- demo/cocoglide/target/giraffe_296969.png +0 -3
- demo/cocoglide/target/tv_453722.png +0 -3
README.md
CHANGED
|
@@ -98,14 +98,14 @@ python -m detectivesam_inference.predict \
|
|
| 98 |
|
| 99 |
### 4. Bundled CocoGlide subset sweep
|
| 100 |
|
| 101 |
-
Use this to evaluate
|
| 102 |
|
| 103 |
```bash
|
| 104 |
python -m detectivesam_inference.evaluate \
|
| 105 |
--checkpoint detective_sam \
|
| 106 |
--dataset-root demo/cocoglide \
|
| 107 |
--output-dir outputs/poster_eval_cocoglide \
|
| 108 |
-
--num-visualizations
|
| 109 |
```
|
| 110 |
|
| 111 |
## Outputs
|
|
|
|
| 98 |
|
| 99 |
### 4. Bundled CocoGlide subset sweep
|
| 100 |
|
| 101 |
+
Use this to evaluate the bundled banana and train CocoGlide demo pairs.
|
| 102 |
|
| 103 |
```bash
|
| 104 |
python -m detectivesam_inference.evaluate \
|
| 105 |
--checkpoint detective_sam \
|
| 106 |
--dataset-root demo/cocoglide \
|
| 107 |
--output-dir outputs/poster_eval_cocoglide \
|
| 108 |
+
--num-visualizations 2
|
| 109 |
```
|
| 110 |
|
| 111 |
## Outputs
|
demo/cocoglide/mask/airplane_139871.png
DELETED
|
Binary file (1.02 kB)
|
|
|
demo/cocoglide/mask/giraffe_296969.png
DELETED
|
Binary file (1.77 kB)
|
|
|
demo/cocoglide/mask/tv_453722.png
DELETED
|
Binary file (284 Bytes)
|
|
|
demo/cocoglide/source/airplane_139871.png
DELETED
Git LFS Details
|
demo/cocoglide/source/giraffe_296969.png
DELETED
Git LFS Details
|
demo/cocoglide/source/tv_453722.png
DELETED
Git LFS Details
|
demo/cocoglide/target/airplane_139871.png
DELETED
Git LFS Details
|
demo/cocoglide/target/giraffe_296969.png
DELETED
Git LFS Details
|
demo/cocoglide/target/tv_453722.png
DELETED
Git LFS Details
|