Skip to content

Commit

Permalink
Update detector
Browse files Browse the repository at this point in the history
  • Loading branch information
flahoud authored and ckanesan committed Jan 7, 2022
1 parent 2d2ae69 commit 6c6bb27
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions hawp/detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,18 @@ def forward(self, images, annotations = None):
#jloc_pred_nms = non_maximum_suppression(jloc_pred[0])
#topK = torch.clamp((jloc_pred_nms > 0.008).count_nonzero(), max=300)

juncs_pred, _ = get_junctions(non_maximum_suppression(jloc_pred[0]),joff_pred[0], topk=300, th=0.008)
nms_jloc_pred = non_maximum_suppression(jloc_pred)[0]
juncs_pred, _ = get_junctions(nms_jloc_pred,joff_pred[0], topk=300, th=0.008)
extra_info['time_proposal'] = time.time() - extra_info['time_proposal']
extra_info['time_matching'] = time.time()
dis_junc_to_end1, idx_junc_to_end1 = torch.sum((lines_pred[:,:2]-juncs_pred[:,None])**2,dim=-1).min(0)
dis_junc_to_end2, idx_junc_to_end2 = torch.sum((lines_pred[:,2:] - juncs_pred[:, None]) ** 2, dim=-1).min(0)

idx_junc_to_end_min = torch.min(idx_junc_to_end1,idx_junc_to_end2)
idx_junc_to_end_max = torch.max(idx_junc_to_end1,idx_junc_to_end2)
# idx_junc_to_end_min = torch.min(idx_junc_to_end1,idx_junc_to_end2)
# idx_junc_to_end_max = torch.max(idx_junc_to_end1,idx_junc_to_end2)
idx_junc_to_end_stacked = torch.stack((idx_junc_to_end1, idx_junc_to_end2))
idx_junc_to_end_min = idx_junc_to_end_stacked.min(dim=0)[0]
idx_junc_to_end_max = idx_junc_to_end_stacked.max(dim=0)[0]

iskeep = (idx_junc_to_end_min < idx_junc_to_end_max)# * (dis_junc_to_end1< 10*10)*(dis_junc_to_end2<10*10) # *(dis_junc_to_end2<100)

Expand Down

0 comments on commit 6c6bb27

Please sign in to comment.