support box threshold in GD 1.5 demos

This commit is contained in:
rentainhe
2024-10-31 15:50:14 +08:00
parent e537a1e763
commit 1aec7ded16
4 changed files with 7 additions and 1 deletions

View File

@@ -130,7 +130,7 @@ We've already released our most capable open-set detection model [Grounding DINO
Install the latest DDS cloudapi: Install the latest DDS cloudapi:
```bash ```bash
pip install dds-cloudapi-sdk pip install dds-cloudapi-sdk --upgrade
``` ```
Apply your API token from our official website here: [request API token](https://deepdataspace.com/request_api). Apply your API token from our official website here: [request API token](https://deepdataspace.com/request_api).

View File

@@ -28,6 +28,7 @@ IMG_PATH = "notebooks/images/cars.jpg"
SAM2_CHECKPOINT = "./checkpoints/sam2.1_hiera_large.pt" SAM2_CHECKPOINT = "./checkpoints/sam2.1_hiera_large.pt"
SAM2_MODEL_CONFIG = "configs/sam2.1/sam2.1_hiera_l.yaml" SAM2_MODEL_CONFIG = "configs/sam2.1/sam2.1_hiera_l.yaml"
GROUNDING_MODEL = DetectionModel.GDino1_5_Pro # DetectionModel.GDino1_6_Pro GROUNDING_MODEL = DetectionModel.GDino1_5_Pro # DetectionModel.GDino1_6_Pro
BOX_THRESHOLD = 0.2
WITH_SLICE_INFERENCE = False WITH_SLICE_INFERENCE = False
SLICE_WH = (480, 480) SLICE_WH = (480, 480)
OVERLAP_RATIO = (0.2, 0.2) OVERLAP_RATIO = (0.2, 0.2)
@@ -69,6 +70,7 @@ if WITH_SLICE_INFERENCE:
prompts=[TextPrompt(text=TEXT_PROMPT)], prompts=[TextPrompt(text=TEXT_PROMPT)],
targets=[DetectionTarget.BBox], # detect bbox targets=[DetectionTarget.BBox], # detect bbox
model=GROUNDING_MODEL, # detect with GroundingDino-1.5-Pro model model=GROUNDING_MODEL, # detect with GroundingDino-1.5-Pro model
bbox_threshold=BOX_THRESHOLD, # box confidence threshold
) )
client.run_task(task) client.run_task(task)
result = task.result result = task.result
@@ -110,6 +112,7 @@ else:
prompts=[TextPrompt(text=TEXT_PROMPT)], prompts=[TextPrompt(text=TEXT_PROMPT)],
targets=[DetectionTarget.BBox], # detect bbox targets=[DetectionTarget.BBox], # detect bbox
model=GROUNDING_MODEL, # detect with GroundingDINO-1.5-Pro model model=GROUNDING_MODEL, # detect with GroundingDINO-1.5-Pro model
bbox_threshold=BOX_THRESHOLD, # box confidence threshold
) )
client.run_task(task) client.run_task(task)

View File

@@ -30,6 +30,7 @@ SOURCE_VIDEO_FRAME_DIR = "./custom_video_frames"
SAVE_TRACKING_RESULTS_DIR = "./tracking_results" SAVE_TRACKING_RESULTS_DIR = "./tracking_results"
API_TOKEN_FOR_GD1_5 = "Your API token" API_TOKEN_FOR_GD1_5 = "Your API token"
PROMPT_TYPE_FOR_VIDEO = "box" # choose from ["point", "box", "mask"] PROMPT_TYPE_FOR_VIDEO = "box" # choose from ["point", "box", "mask"]
BOX_THRESHOLD = 0.2
""" """
Step 1: Environment settings and model initialization for SAM 2 Step 1: Environment settings and model initialization for SAM 2
@@ -108,6 +109,7 @@ task = DetectionTask(
prompts=[TextPrompt(text=TEXT_PROMPT)], prompts=[TextPrompt(text=TEXT_PROMPT)],
targets=[DetectionTarget.BBox], # detect bbox targets=[DetectionTarget.BBox], # detect bbox
model=DetectionModel.GDino1_6_Pro, # detect with GroundingDino-1.5-Pro model model=DetectionModel.GDino1_6_Pro, # detect with GroundingDino-1.5-Pro model
bbox_threshold=BOX_THRESHOLD,
) )
client.run_task(task) client.run_task(task)

View File

@@ -80,6 +80,7 @@ task = DetectionTask(
prompts=[TextPrompt(text="children. pillow")], prompts=[TextPrompt(text="children. pillow")],
targets=[DetectionTarget.BBox], # detect bbox targets=[DetectionTarget.BBox], # detect bbox
model=DetectionModel.GDino1_5_Pro, # detect with GroundingDino-1.5-Pro model model=DetectionModel.GDino1_5_Pro, # detect with GroundingDino-1.5-Pro model
bbox_threshold=0.2,
) )
client.run_task(task) client.run_task(task)