triton-inference-server / server

The Triton Inference Server provides an optimized cloud and edge inferencing solution.
https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/index.html
BSD 3-Clause "New" or "Revised" License
8.04k stars 1.44k forks source link

Why does the client scale the image nparray with particular models? #1723

Closed rithd closed 4 years ago

rithd commented 4 years ago

The code of the client is that:

if scaling == 'INCEPTION': scaled = (typed / 128) - 1 elif scaling == 'VGG': if c == 1: scaled = typed - np.asarray((128,), dtype=npdtype) else: scaled = typed - np.asarray((123, 117, 104), dtype=npdtype) else: scaled = typed

Before the client sends the array to server, it scales the array with its rule. And if I deploy the Inception or VGG models with local tf enviorment, I needn't to scale the image. So if the scaling is only need for triton?

And I also find that, for a MobileNet image classfication model , if I didn't scale the image, it couldn't classfy the image in order. But if I scaled the array as Inception, it works. Why?

CoderHam commented 4 years ago

It is a part of the pre-processing done to the image. Since the input images were pre-processed similarly while training it is necessary to perform these operations on the inputs before passing to the model for inference as well.