Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita2abbe6

Browse files
committed
I was so foolish, made a mistake in their loss eq
1 parent05afd3c commita2abbe6

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

‎dense_correspondence/loss_functions/pixelwise_contrastive_loss.py‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def match_loss(image_a_pred, image_b_pred, matches_a, matches_b):
162162
matches_a_descriptors=matches_a_descriptors.unsqueeze(0)
163163
matches_b_descriptors=matches_b_descriptors.unsqueeze(0)
164164

165-
match_loss=torch.div(1.0,num_matches* (matches_a_descriptors-matches_b_descriptors).pow(2).sum())
165+
match_loss=torch.div(1.0,num_matches)* (matches_a_descriptors-matches_b_descriptors).pow(2).sum()
166166

167167
returnmatch_loss,matches_a_descriptors,matches_b_descriptors
168168

@@ -188,12 +188,8 @@ def non_match_descriptor_loss(image_a_pred, image_b_pred, non_matches_a, non_mat
188188
:return: torch.FloatTensor with shape torch.Shape([num_non_matches])
189189
:rtype:
190190
"""
191-
192-
try:
193-
non_matches_a_descriptors=torch.index_select(image_a_pred,1,non_matches_a.long()).squeeze()
194-
non_matches_b_descriptors=torch.index_select(image_b_pred,1,non_matches_b.long()).squeeze()
195-
except:
196-
importpdb;pdb.set_trace()
191+
non_matches_a_descriptors=torch.index_select(image_a_pred,1,non_matches_a.long()).squeeze()
192+
non_matches_b_descriptors=torch.index_select(image_b_pred,1,non_matches_b.long()).squeeze()
197193

198194
# crazily enough, if there is only one element to index_select into
199195
# above, then the first dimension is collapsed down, and we end up

‎dense_correspondence/training/training.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def run(self, loss_current_iteration=0, use_pretrained=False):
300300
background_non_matches_a,background_non_matches_b, \
301301
blind_non_matches_a,blind_non_matches_b, \
302302
metadata=data
303-
print(f"Doing iteration{i} now with data:{metadata}")
303+
#print(f"Doing iteration {i} now with data: {metadata}")
304304

305305
if (match_type==-1).all():
306306
print("\n empty data, continuing\n")
@@ -407,6 +407,8 @@ def run(self, loss_current_iteration=0, use_pretrained=False):
407407
loss.backward()
408408
optimizer.step()
409409

410+
print(f"LOSS:{loss.item():.4e}")
411+
410412
#if i % 10 == 0:
411413
# TPV.update(self._dataset, dcn, loss_current_iteration, now_training_object_id=metadata["object_id"])
412414

‎main.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@
3737
dataset=SpartanDataset(config=config)
3838

3939
logging_dir="trained_models/tutorials"
40-
num_iterations=10000
40+
num_iterations=3500
4141
d=3# the descriptor dimension
4242
name="caterpillar_%d"%(d)
4343
train_config["training"]["logging_dir_name"]=name
4444
train_config["training"]["logging_dir"]=logging_dir
4545
train_config["dense_correspondence_network"]["descriptor_dimension"]=d
4646
train_config["training"]["num_iterations"]=num_iterations
4747

48-
TRAIN=False
48+
TRAIN=True
4949
EVALUATE=True
5050

5151

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp