|
|
@@ -1501,8 +1501,9 @@ class RoIHeads(nn.Module):
|
|
|
|
|
|
# print(f'line_features from line_roi_pool:{line_features.shape}')
|
|
|
#(b,256,512,512)
|
|
|
- cs_features = self.channel_compress(features['0'])
|
|
|
+ # cs_features = self.channel_compress(features['0'])
|
|
|
#(b.8,512,512)
|
|
|
+ cs_features= features['0']
|
|
|
|
|
|
|
|
|
all_proposals=line_proposals+point_proposals
|
|
|
@@ -1530,25 +1531,42 @@ class RoIHeads(nn.Module):
|
|
|
|
|
|
# line_features = lines_features_align(line_features, filtered_proposals, image_shapes)
|
|
|
|
|
|
- point_features =features_align(cs_features, point_proposals, image_shapes)
|
|
|
+ line_features=None
|
|
|
+ # line_features = features_align(cs_features, line_proposals, image_shapes)
|
|
|
+ # if line_features is not None:
|
|
|
+ # print(f'line_features:{line_features.shape}')
|
|
|
|
|
|
|
|
|
- line_features = features_align(cs_features, line_proposals, image_shapes)
|
|
|
|
|
|
+ # if line_features is not None and point_features is not None:
|
|
|
+ # combine_features = torch.cat((point_features, line_features), dim=0)
|
|
|
+ # elif line_features is not None:
|
|
|
+ # combine_features =line_features
|
|
|
+ # elif point_features is not None:
|
|
|
+ # combine_features =point_features
|
|
|
|
|
|
+ # combine_features = point_features
|
|
|
+ # print(f'line_features from features_align:{combine_features.shape}')
|
|
|
|
|
|
+ # combine_features = self.line_head(cs_features)
|
|
|
|
|
|
|
|
|
|
|
|
- print(f'line_features from features_align:{cs_features.shape}')
|
|
|
+ # if point_features is not None:
|
|
|
+ # print(f'point_features:{point_features.shape}')
|
|
|
|
|
|
- cs_features = self.line_head(cs_features)
|
|
|
#(N,1,512,512)
|
|
|
- print(f'line_features from line_head:{cs_features.shape}')
|
|
|
- # line_logits = self.line_predictor(line_features)
|
|
|
+ # print(f'combine_features from line_head:{combine_features.shape}')
|
|
|
|
|
|
- line_logits = cs_features
|
|
|
- print(f'line_logits:{line_logits.shape}')
|
|
|
+ combine_features = self.line_predictor(cs_features )
|
|
|
+ print(f'combine_features from line_predictor:{combine_features.shape}')
|
|
|
+
|
|
|
+ point_features = features_align(combine_features, point_proposals, image_shapes)
|
|
|
+ print(f'point_features from features_align:{point_features.shape}')
|
|
|
+ combine_features=point_features
|
|
|
+
|
|
|
+ # line_logits = combine_features
|
|
|
+ # print(f'line_logits:{line_logits.shape}')
|
|
|
|
|
|
loss_line = {}
|
|
|
loss_line_iou = {}
|
|
|
@@ -1574,13 +1592,13 @@ class RoIHeads(nn.Module):
|
|
|
print(f'gt_points_tensor:{gt_points_tensor.shape}')
|
|
|
if gt_lines_tensor.shape[0]>0 and line_features is not None:
|
|
|
loss_line = lines_point_pair_loss(
|
|
|
- line_features, line_proposals, gt_lines, line_pos_matched_idxs
|
|
|
+ combine_features, line_proposals, gt_lines, line_pos_matched_idxs
|
|
|
)
|
|
|
- loss_line_iou = line_iou_loss(line_logits, line_proposals, gt_lines, line_pos_matched_idxs, img_size)
|
|
|
+ loss_line_iou = line_iou_loss(combine_features, line_proposals, gt_lines, line_pos_matched_idxs, img_size)
|
|
|
|
|
|
if gt_points_tensor.shape[0]>0 and point_features is not None:
|
|
|
loss_point = compute_point_loss(
|
|
|
- point_features, point_proposals, gt_points, point_pos_matched_idxs
|
|
|
+ combine_features, point_proposals, gt_points, point_pos_matched_idxs
|
|
|
)
|
|
|
|
|
|
if not loss_line:
|
|
|
@@ -1607,14 +1625,14 @@ class RoIHeads(nn.Module):
|
|
|
|
|
|
if gt_lines_tensor.shape[0] > 0 and line_features is not None:
|
|
|
loss_line = lines_point_pair_loss(
|
|
|
- line_features, line_proposals, gt_lines, line_pos_matched_idxs
|
|
|
+ combine_features, line_proposals, gt_lines, line_pos_matched_idxs
|
|
|
)
|
|
|
- loss_line_iou = line_iou_loss(line_features, line_proposals, gt_lines, line_pos_matched_idxs,
|
|
|
+ loss_line_iou = line_iou_loss(combine_features, line_proposals, gt_lines, line_pos_matched_idxs,
|
|
|
img_size)
|
|
|
|
|
|
if gt_points_tensor.shape[0] > 0 and point_features is not None:
|
|
|
loss_point = compute_point_loss(
|
|
|
- point_features, point_proposals, gt_points, point_pos_matched_idxs
|
|
|
+ combine_features, point_proposals, gt_points, point_pos_matched_idxs
|
|
|
)
|
|
|
|
|
|
if not loss_line :
|
|
|
@@ -1633,18 +1651,18 @@ class RoIHeads(nn.Module):
|
|
|
|
|
|
|
|
|
else:
|
|
|
- if line_logits is None or line_proposals is None:
|
|
|
+ if combine_features is None or line_proposals is None:
|
|
|
raise ValueError(
|
|
|
"both keypoint_logits and keypoint_proposals should not be None when not in training mode"
|
|
|
)
|
|
|
|
|
|
- if line_features is not None:
|
|
|
- lines_probs, lines_scores = line_inference(line_features,line_proposals)
|
|
|
- for keypoint_prob, kps, r in zip(lines_probs, lines_scores, result):
|
|
|
- r["lines"] = keypoint_prob
|
|
|
- r["liness_scores"] = kps
|
|
|
+ # if line_features is not None:
|
|
|
+ # lines_probs, lines_scores = line_inference(combine_features,line_proposals)
|
|
|
+ # for keypoint_prob, kps, r in zip(lines_probs, lines_scores, result):
|
|
|
+ # r["lines"] = keypoint_prob
|
|
|
+ # r["liness_scores"] = kps
|
|
|
if point_features is not None:
|
|
|
- point_probs, points_scores=point_inference(point_features, point_proposals,)
|
|
|
+ point_probs, points_scores=point_inference(combine_features, point_proposals,)
|
|
|
for points, ps, r in zip(point_probs,points_scores, result):
|
|
|
print(f'points_prob :{points.shape}')
|
|
|
|