zhengrongzhang hongywei commited on
Commit
0d99aa0
1 Parent(s): ff1446e

Update utils.py (#1)

Browse files

- Update utils.py (8b4b482bf05346879e1f42575cfa68eba4d6d9bd)


Co-authored-by: Hongyang Wei <hongywei@users.noreply.huggingface.co>

Files changed (1) hide show
  1. utils.py +3 -3
utils.py CHANGED
@@ -198,7 +198,7 @@ def postprocess(cfg, img, outputs, scale, resize, confidence_threshold, nms_thre
198
  Returns:
199
  detetcion results
200
  """
201
- _, _, im_height, im_width= img.shape
202
  loc = torch.from_numpy(outputs[0])
203
  conf = torch.from_numpy(outputs[1])
204
  landms = torch.from_numpy(outputs[2])
@@ -215,8 +215,8 @@ def postprocess(cfg, img, outputs, scale, resize, confidence_threshold, nms_thre
215
  scores = conf.squeeze(0).data.cpu().numpy()[:, 1]
216
  landms = decode_landm(landms.squeeze(0), prior_data, cfg["variance"])
217
  scale1 = torch.Tensor(
218
- [img.shape[3], img.shape[2], img.shape[3], img.shape[2], img.shape[3],
219
- img.shape[2], img.shape[3], img.shape[2], img.shape[3], img.shape[2],]
220
  )
221
  scale1 = scale1.to(device)
222
  landms = landms * scale1 / resize
 
198
  Returns:
199
  detetcion results
200
  """
201
+ _, im_height, im_width, _= img.shape
202
  loc = torch.from_numpy(outputs[0])
203
  conf = torch.from_numpy(outputs[1])
204
  landms = torch.from_numpy(outputs[2])
 
215
  scores = conf.squeeze(0).data.cpu().numpy()[:, 1]
216
  landms = decode_landm(landms.squeeze(0), prior_data, cfg["variance"])
217
  scale1 = torch.Tensor(
218
+ [img.shape[2], img.shape[1], img.shape[2], img.shape[1], img.shape[2],
219
+ img.shape[1], img.shape[2], img.shape[1], img.shape[2], img.shape[1],]
220
  )
221
  scale1 = scale1.to(device)
222
  landms = landms * scale1 / resize