-
Notifications
You must be signed in to change notification settings - Fork 11
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
WIP: SpectralGPT for multi-temporal change detection #34
Conversation
Some config values that depend on other config values are set under But in general the pattern of doing something based on a name is not very nice, I'd much rather introduce some property in the segmentor config that then we can take into account (either by using it instead of the multitemporal flag, or setting the multitemporal flag based on it.) |
…ise, SpectralGPT expects bitemporal input, but the UperNetCD purposefully splits it into mono-temporal images, to compute separate features and then compute the difference between those two feature vectors.
Those mostly seem to move values from one dict into another, I don't think that the branching we need here is similar to that, so I'd put it into a new function.
We can use the existing How about adding a function that gets called right after |
…ng in utils/configs.py
875e55c
to
110f46c
Compare
The only difference in the encoder config would be the multitemporal argument, but currently that would be overwritten when the config is loaded: https://github.com/yurujaja/geofm-bench/blob/906d8c161994cec8c3b73a12f75781a1f02ffca5/utils/configs.py#L48
SpectralGPT sets its patch embedding and positional embedding based on multispectral during init, so we can't just pass it during runtime. If we want to provide
In that case, every user that wants to run change detection with xView2 will probably first run into the error message I got, and then hopefully know to add this to the run config, right? Philosophically, I'd prefer to take that responsibility from the user by handling the special case explicitly in code, especially because it's a structural problem that we know about, not a very special case that they can't expect to be handled by the code. tldr: I like my approach :D But I can switch to the second idea, if you prefer that. |
…tralGPT and change detection segmentors, in preparation of using a different strategy to handle this.
We refer to the original spectralgpt model parameters where the temporal dimension is set to 1 as the model is not pretrained on time series data. Accordingly, we also set the temporal dimension to 1. I modify the corresponding changes in MTUperNet forward functions. |
…emporal inputs. This follows the original SpectralGPT implementation and makes it easier to solve a different problem that occurs when combining SpectralGPT with change detection segmentors.
…ja/geofm-bench into spectralgpt-multitemporal
With this, we only need to handle the situations in the UperNet forwards. I removed my previously suggested way of handling the problem. Now we just ensure that the temporal dimension exists when we pass an image to SpectralGPT. We have the information that we're passing to SpectralGPT in UperNet, because the segmentor always knows its encoder, so no additional changes are necessary. Much cleaner solution, thanks Yuru. And sorry David for apparently editing your comment instead of replying to it. I was not aware that that's even an option, but apparently I clicked it. |
Sets SpectralGPT encoder to mono-temporal if UperNetCD is used. Otherwise, SpectralGPT expects bitemporal input, but the UperNetCD purposefully splits the bi-temporal input into two mono-temporal images, to compute two separate image feature vectors and then compute the difference between for change detection.
Small issue: I need to change the "multitemporal" value of the encoder, depending on the chosen segmentor architecture. The best spot I found for that is in run.py before the encoder is initialized, which is kind of ugly. Any suggestion where to put it or how to handle this issue differently?