Fixed running custom onnx models.
This commit is contained in:
@@ -44,10 +44,12 @@ class SimCC(BaseModel):
|
||||
self.scale = 0
|
||||
|
||||
def preprocess(self, image: np.ndarray):
|
||||
th, tw = self.input_shape[2:]
|
||||
image, self.dx, self.dy, self.scale = letterbox(image, (tw, th))
|
||||
tensor = (image - np.array((103.53, 116.28, 123.675))) / np.array((57.375, 57.12, 58.395))
|
||||
tensor = np.expand_dims(tensor, axis=0).transpose((0, 3, 1, 2)).astype(np.float32)
|
||||
tensor, self.dx, self.dy, self.scale = image, 0, 0, 1
|
||||
tensor -= np.array((123.675, 116.28, 103.53))
|
||||
tensor /= np.array((58.395, 57.12, 57.375))
|
||||
tensor = (
|
||||
np.expand_dims(tensor, axis=0).transpose((0, 3, 1, 2)).astype(np.float32)
|
||||
)
|
||||
return tensor
|
||||
|
||||
def postprocess(self, tensor: List[np.ndarray]):
|
||||
|
||||
Reference in New Issue
Block a user