To address your question about the design choices and exactly what the embedding space represents, here is the reasoning behind why the notebook is set up this way:
-
A Teaching Moment: The use of
WeightedContrastiveLosshere is deliberate to showcase a different tool. In the first part of the lab, the notebook usedTripletMarginLoss. While this satellite dataset could have been formatted for Triplet Loss, using Contrastive Loss demonstrates a completely different, yet valid, approach to training Siamese networks. It highlights that there is more than one way to solve these problems. -
The Nature of the Embedding Space: You asked what the embedding space represents. In this design, the embedding space represents a manifold of visual similarity, not a semantic map of “growth” or “decay.” The loss function uses Euclidean distance (L2 norm), which is symmetric. In this space, the relative distance between E(a)and E(b) encodes the magnitude of the change (how much they differ), but not the direction of the change. It acts like a ruler, not a compass. It tells you that the images are far apart, but not why.
-
The “Two-Step” Solution: Because the loss function forces the model to focus on the binary concept of “Change vs. No Change”, you need a second step to recover the “direction” (Positive vs. Negative).
- Option A (Used in Notebook): Use the Siamese model to detect the change using an optimal threshold, then use a heuristic (like the HSV color check) to categorize it.
- Option B (Alternative): You could train a second, separate classifier that only looks at the pairs the Siamese network flagged as “Changed” and classifies them as Positive or Negative.
Best,
Mubsi