I am trying to feed a very large image into Triton server. I need to divide the input image into patches and feed the patches one by one into a tensorflow model. The image has a variable size, so the number of patches N is variable for each call.
I think a Triton ensemble model that calls the following steps would do the job:
- A python model (pre-process) to create the patches
- The segmentation model
- Finally another python model (post-process) to merge the output patches into a big output mask
However, for this, I would have to write a config. pbtxt
file with 1:N
and N:1
relation, meaning the ensemble scheduler needs to call the 2nd step multiple times and the 3rd once with the aggregated output.
Is this possible, or do I need to use some other technique?
Disclaimer
The below answer isn't the actual solution to the above question. I misunderstood the above query. But I'm leaving this response in case of future readers find it useful.
Input
Slice and Stitch
The following functionality is adopted from here. More details and discussion can be found here.. Apart from the original code, we bring together the necessary functionality and put them in a single class (
ImageSliceRejoin
).Initiate Slicing
Verify
Inference
I'm using the Image-Super-Resolution model for demonstration.
Now, the
collect
holds the output of each patch from the model.Rejoin Patches
Verify