Clarification of x0 and x1 in the simsiam.py example
bryanbocao opened this issue · 2 comments
bryanbocao commented
Thanks for the amazing SSL framework.
I have a few clarification questions regarding x0, x1
:
Q1: Is x0
the original image (without being transformed) and x1
is the transformed one from the same image?
Q2: Are both x0
and x1
transformed but differently from the same image?
for epoch in range(10):
total_loss = 0
for batch in dataloader:
x0, x1 = batch[0]
x0 = x0.to(device)
x1 = x1.to(device)
z0, p0 = model(x0)
z1, p1 = model(x1)
loss = 0.5 * (criterion(z0, p1) + criterion(z1, p0))
total_loss += loss.detach()
loss.backward()
optimizer.step()
optimizer.zero_grad()
avg_loss = total_loss / len(dataloader)
print(f"epoch: {epoch:>02}, loss: {avg_loss:.5f}")
Thanks!
philippmwirth commented
Hi @bryanbocao, thanks for the question. For SimSiam transforms are used to generate two views of the original image. So x0
and x1
are different transformed views of the same image.
guarin commented
I'll close this for now, please reopen if you have further questions :)