Skip to content

Commit

Permalink
fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
Boomerl committed Nov 10, 2023
1 parent 2a481bf commit 4c463ca
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions mmdeploy/codebase/mmdet/models/dense_heads/sparseinst_head.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# Copyright (c) OpenMMLab. All rights reserved.
from typing import Dict, List, Tuple
from typing import List

import torch
import torch.nn.functional as F
from mmdet.models.utils import aligned_bilinear
from mmdet.structures import OptSampleList, SampleList
from mmengine.config import ConfigDict
from torch import Tensor

from mmdeploy.core import FUNCTION_REWRITER
Expand All @@ -30,7 +27,7 @@ def sparseinst__predict(
max_shape = batch_inputs.shape[-2:]
x = self.extract_feat(batch_inputs)
output = self.decoder(x)

pred_scores = output['pred_logits'].sigmoid()
pred_masks = output['pred_masks'].sigmoid()
pred_objectness = output['pred_scores'].sigmoid()
Expand All @@ -47,15 +44,13 @@ def sparseinst__predict(

img_meta = batch_data_samples[0].metainfo
# rescoring mask using maskness
scores = rescoring_mask(scores,
pred_masks > self.mask_threshold,
scores = rescoring_mask(scores, pred_masks > self.mask_threshold,
pred_masks)
h, w = img_meta['img_shape'][:2]
pred_masks = F.interpolate(pred_masks,
size=max_shape,
mode='bilinear',
align_corners=False)[:, :, :h, :w]

pred_masks = F.interpolate(
pred_masks, size=max_shape, mode='bilinear',
align_corners=False)[:, :, :h, :w]

bboxes = torch.zeros(scores.shape[0], scores.shape[1], 4)
dets = torch.cat([bboxes, scores.unsqueeze(-1)], dim=-1)
masks = (pred_masks > self.mask_threshold).float()
Expand Down

0 comments on commit 4c463ca

Please sign in to comment.