mirror of
https://github.com/open-mmlab/mmdeploy.git
synced 2025-01-14 08:09:43 +08:00
Fix SDK backend (#844)
This commit is contained in:
parent
a15365e93f
commit
e12dfddc26
@ -139,8 +139,7 @@ class SDKEnd2EndModel(End2EndModel):
|
||||
list: A list contains predictions.
|
||||
"""
|
||||
|
||||
pred = self.wrapper.invoke(
|
||||
[img[0].contiguous().detach().cpu().numpy()])[0]
|
||||
pred = self.wrapper.invoke(img[0].contiguous().detach().cpu().numpy())
|
||||
pred = np.array(pred, dtype=np.float32)
|
||||
return pred[np.argsort(pred[:, 0])][np.newaxis, :, 1]
|
||||
|
||||
|
@ -637,7 +637,7 @@ class SDKEnd2EndModel(End2EndModel):
|
||||
list: A list contains predictions.
|
||||
"""
|
||||
dets, labels, masks = self.wrapper.invoke(
|
||||
[img[0].contiguous().detach().cpu().numpy()])[0]
|
||||
img[0].contiguous().detach().cpu().numpy())
|
||||
det_results = bbox2result(dets[np.newaxis, ...], labels[np.newaxis,
|
||||
...],
|
||||
len(self.CLASSES))
|
||||
|
@ -223,7 +223,7 @@ class SDKEnd2EndModel(End2EndModel):
|
||||
list | dict: High resolution image or a evaluation results.
|
||||
"""
|
||||
img = tensor2img(lq)
|
||||
output = self.wrapper.invoke([img])[0]
|
||||
output = self.wrapper.invoke(img)
|
||||
if test_mode:
|
||||
output = torch.from_numpy(output)
|
||||
output = output.permute(2, 0, 1)
|
||||
|
@ -169,7 +169,7 @@ class SDKEnd2EndModel(End2EndModel):
|
||||
list: A list contains predictions.
|
||||
"""
|
||||
boundaries = self.wrapper.invoke(
|
||||
[img[0].contiguous().detach().cpu().numpy()])[0]
|
||||
img[0].contiguous().detach().cpu().numpy())
|
||||
boundaries = [list(x) for x in boundaries]
|
||||
return [
|
||||
dict(
|
||||
|
@ -181,9 +181,9 @@ class SDKEnd2EndModel(End2EndModel):
|
||||
Returns:
|
||||
list[str]: Text label result of each image.
|
||||
"""
|
||||
results = self.wrapper.invoke(
|
||||
[img[0].contiguous().detach().cpu().numpy()])
|
||||
results = [dict(text=text, score=score) for text, score in results]
|
||||
text, score = self.wrapper.invoke(
|
||||
img[0].contiguous().detach().cpu().numpy())
|
||||
results = [dict(text=text, score=score)]
|
||||
return results
|
||||
|
||||
|
||||
|
@ -218,8 +218,8 @@ class SDKEnd2EndModel(End2EndModel):
|
||||
image_paths.append(img_meta['image_file'])
|
||||
bbox_ids.append(img_meta['bbox_id'])
|
||||
|
||||
pred = self.wrapper.handle(
|
||||
[img[0].contiguous().detach().cpu().numpy()], [sdk_boxes])[0]
|
||||
pred = self.wrapper.handle(img[0].contiguous().detach().cpu().numpy(),
|
||||
sdk_boxes)
|
||||
|
||||
result = dict(
|
||||
preds=pred,
|
||||
|
@ -212,7 +212,7 @@ class SDKEnd2EndModel(End2EndModel):
|
||||
"""
|
||||
results = []
|
||||
dets, labels = self.wrapper.invoke(
|
||||
[img[0].contiguous().detach().cpu().numpy()])[0]
|
||||
img[0].contiguous().detach().cpu().numpy())
|
||||
dets_results = [dets[labels == i, :] for i in range(len(self.CLASSES))]
|
||||
results.append(dets_results)
|
||||
|
||||
|
@ -166,8 +166,7 @@ class SDKEnd2EndModel(End2EndModel):
|
||||
Returns:
|
||||
list: A list contains predictions.
|
||||
"""
|
||||
masks = self.wrapper.invoke(
|
||||
[img[0].contiguous().detach().cpu().numpy()])[0]
|
||||
masks = self.wrapper.invoke(img[0].contiguous().detach().cpu().numpy())
|
||||
return masks
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user