ultralytics 8.3.12 SAM and SAM2 multi-point prompts (#16643)
Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Ultralytics Assistant <135830346+UltralyticsAssistant@users.noreply.github.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
1c4d788aa1
commit
b89d6f4070
6 changed files with 79 additions and 13 deletions
|
|
@ -127,9 +127,21 @@ def test_predict_sam():
|
|||
# Run inference with bboxes prompt
|
||||
model(SOURCE, bboxes=[439, 437, 524, 709], device=0)
|
||||
|
||||
# Run inference with points prompt
|
||||
# Run inference with no labels
|
||||
model(ASSETS / "zidane.jpg", points=[900, 370], device=0)
|
||||
|
||||
# Run inference with 1D points and 1D labels
|
||||
model(ASSETS / "zidane.jpg", points=[900, 370], labels=[1], device=0)
|
||||
|
||||
# Run inference with 2D points and 1D labels
|
||||
model(ASSETS / "zidane.jpg", points=[[900, 370]], labels=[1], device=0)
|
||||
|
||||
# Run inference with multiple 2D points and 1D labels
|
||||
model(ASSETS / "zidane.jpg", points=[[400, 370], [900, 370]], labels=[1, 1], device=0)
|
||||
|
||||
# Run inference with 3D points and 2D labels (multiple points per object)
|
||||
model(ASSETS / "zidane.jpg", points=[[[900, 370], [1000, 100]]], labels=[[1, 1]], device=0)
|
||||
|
||||
# Create SAMPredictor
|
||||
overrides = dict(conf=0.25, task="segment", mode="predict", imgsz=1024, model=WEIGHTS_DIR / "mobile_sam.pt")
|
||||
predictor = SAMPredictor(overrides=overrides)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue