google-research / google-research/scenic

TypeError: Sam.__call__() got an unexpected keyword argument 'input_image'

Open
#1,007 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3.8k
Forks
481
Avg merge
13d 21h
Merged PRs (30d)
1

Description

Hello the demo usage code of sam is giving me this error:
TypeError: Sam.__call__() got an unexpected keyword argument 'input_image'

Changing line 28 to:
```
ret = sam_model.apply(
{'params': params},
image = input_image,
point_coords = point_coords,
point_labels = point_labels,
padding_mask = padding_mask,
return_image_embedding=True,
train=False)
```

and line 44 to:
```
ret = sam_model.apply(
{'params': params},
image=None,
point_coords=point_coords,
point_labels=point_labels,
padding_mask=padding_mask,
image_embeddings=cached_image_embedding,
train=False)
```
fixes the issue, i.e., passing in "image = " argument when calling the sam_model.

Contributor guide

Open the contributing guide

Research direction

Start with the SAM demo usage code at lines 28 and 44, where sam_model.apply is called. Compare those calls with the reported TypeError and verify the demo runs successfully after the image arguments are included; done means the demo no longer passes input_image to Sam.__call__.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.