tianrun-chen / SAM-Adapter-PyTorch

Adapting Meta AI's Segment Anything to Downstream Tasks with Adapters and Prompts
MIT License
1k stars 89 forks source link

Has anyone obtained the same results as in the paper? From the code it looks like the Adapter is not added to the training? #41

Closed Chen94yue closed 5 months ago

Chen94yue commented 1 year ago

Adapter is not added to the training or am I misunderstanding the code?

the model is init in:

https://github.com/tianrun-chen/SAM-Adapter-PyTorch/blob/62a83a48b254fdd0cfb71e8be8df87dfa0d5a9d8/train.py#L96-L111

In config file, the code chooses 'sam', and the 'sam' model is defined in 'models/sam.py'.

In the forward of sam:

https://github.com/tianrun-chen/SAM-Adapter-PyTorch/blob/62a83a48b254fdd0cfb71e8be8df87dfa0d5a9d8/models/sam.py#L169-L191

Use "self.image_encoder" to get image embedding, this sub-module is defined in 'ImageEncoderViT', it is implemented in ‘models/mmseg/models/sam/image_encoder.py’. In this file, I just can't find any implemented about adapter, only see one variable that is not being used ‘self.adapter’.

theneao commented 1 year ago

不就是mlp吗,用了self.mlp,不知道我理解有错不

Abhiram-kandiyana commented 1 year ago

@tianrun-chen Can you please help with this. Can you let us know where we can find the code for the adaptor?

Abhiram-kandiyana commented 1 year ago

I think it's implemented as prompt-generator in ImageEncoderViT.

monstergq commented 1 year ago

In './models/image_encoder.py', the class ImageEncoderViT image

ericzw commented 9 months ago

same question

tianrun-chen commented 5 months ago

Please Check models/mmseg/models/sam/image_encoder.py