Skip to content

Commit

Permalink
fix default values for sam 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-medeiros authored Oct 22, 2024
1 parent d201935 commit cfb29a6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def inference(sam_type, box_threshold, text_threshold, image, text_prompt):

with gr.Blocks(title="lang-sam") as blocks:
with gr.Row():
sam_model_choices = gr.Dropdown(choices=list(SAM_MODELS.keys()), label="SAM Model", value="sam2_hiera_small")
sam_model_choices = gr.Dropdown(choices=list(SAM_MODELS.keys()), label="SAM Model", value="sam2.1_hiera_small")
box_threshold = gr.Slider(minimum=0.0, maximum=1.0, value=0.3, label="Box Threshold")
text_threshold = gr.Slider(minimum=0.0, maximum=1.0, value=0.25, label="Text Threshold")
with gr.Row():
Expand All @@ -63,21 +63,21 @@ def inference(sam_type, box_threshold, text_threshold, image, text_prompt):

examples = [
[
"sam2_hiera_small",
"sam2.1_hiera_small",
0.32,
0.25,
os.path.join(os.path.dirname(__file__), "assets", "fruits.jpg"),
"kiwi. watermelon. blueberry.",
],
[
"sam2_hiera_small",
"sam2.1_hiera_small",
0.3,
0.25,
os.path.join(os.path.dirname(__file__), "assets", "car.jpeg"),
"wheel.",
],
[
"sam2_hiera_small",
"sam2.1_hiera_small",
0.3,
0.25,
os.path.join(os.path.dirname(__file__), "assets", "food.jpg"),
Expand Down
2 changes: 1 addition & 1 deletion lang_sam/lang_sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


class LangSAM:
def __init__(self, sam_type="sam2_hiera_small", ckpt_path: str | None = None):
def __init__(self, sam_type="sam2.1_hiera_small", ckpt_path: str | None = None):
self.sam_type = sam_type
self.sam = SAM()
self.sam.build_model(sam_type, ckpt_path)
Expand Down
2 changes: 1 addition & 1 deletion lang_sam/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class LangSAMAPI(ls.LitAPI):
def setup(self, device: str) -> None:
"""Initialize or load the LangSAM model."""
self.model = LangSAM(sam_type="sam2_hiera_small")
self.model = LangSAM(sam_type="sam2.1_hiera_small")
print("LangSAM model initialized.")

def decode_request(self, request) -> dict:
Expand Down

0 comments on commit cfb29a6

Please sign in to comment.