Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions on Adapting SAM+ Model to New Architecture and Handling Channel Mismatch #806

Open
Climb-one opened this issue Jan 12, 2025 · 0 comments

Comments

@Climb-one
Copy link

Dear Author

I have successfully reproduced the results from your paper“SAM-Assisted Remote Sensing Imagery Semantic
Segmentation with Object and Boundary Constraints” and I am truly impressed with the outcome. Thank you for your team's contribution to advancing research in this field!

I am now trying to apply the "SAM+ model" you proposed to adapt to a new model, and I would like to ask what specific modifications I need to make for this adaptation. Could you kindly provide a detailed explanation?

Additionally, I encountered an issue with channel mismatch. Should I modify the model to accommodate SAM? If so, I would appreciate any guidance on how to handle this issue.

Looking forward to your advice and thank you in advance for your time.

Best regards!

Here is the error message I am encountering:
Loading Data: 0%| | 0/1000 [00:03<?, ?it/s]
Traceback (most recent call last):
File "/remote-home/cs_iot_zqw/SSRS/SSRS-main/SAM_RS/DCSwin_train_Urban_DCSwin.py", line 228, in
train(net, optimizer, 50, scheduler)
File "/remote-home/cs_iot_zqw/SSRS/SSRS-main/SAM_RS/DCSwin_train_Urban_DCSwin.py", line 180, in train
output = net(data)
File "/home/zqw/anaconda3/envs/SAM_RS/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/zqw/anaconda3/envs/SAM_RS/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/home/zqw/anaconda3/envs/SAM_RS/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 184, in forward
return self.module(*inputs[0], **module_kwargs[0])
File "/home/zqw/anaconda3/envs/SAM_RS/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/zqw/anaconda3/envs/SAM_RS/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/remote-home/cs_iot_zqw/SSRS/SSRS-main/SAM_RS/model/DCSwin.py", line 913, in forward
x = self.decoder(x1, x2, x3, x4)
File "/home/zqw/anaconda3/envs/SAM_RS/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/zqw/anaconda3/envs/SAM_RS/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/remote-home/cs_iot_zqw/SSRS/SSRS-main/SAM_RS/model/DCSwin.py", line 882, in forward
out1, out2 = self.dcfam(x1, x2, x3, x4)
File "/home/zqw/anaconda3/envs/SAM_RS/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/zqw/anaconda3/envs/SAM_RS/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/remote-home/cs_iot_zqw/SSRS/SSRS-main/SAM_RS/model/DCSwin.py", line 851, in forward
out4 = self.conv4(x4) + self.down34(self.pa(self.down232(x2)))
File "/home/zqw/anaconda3/envs/SAM_RS/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/zqw/anaconda3/envs/SAM_RS/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/home/zqw/anaconda3/envs/SAM_RS/lib/python3.8/site-packages/torch/nn/modules/container.py", line 219, in forward
input = module(input)
File "/home/zqw/anaconda3/envs/SAM_RS/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/zqw/anaconda3/envs/SAM_RS/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, **kwargs)
File "/home/zqw/anaconda3/envs/SAM_RS/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 458, in forward
return self._conv_forward(input, self.weight, self.bias)
File "/home/zqw/anaconda3/envs/SAM_RS/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 454, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Given groups=1, weight of size [768, 768, 1, 1], expected input[10, 1024, 8, 8] to have 768 channels, but got 1024 channels instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant