When using `set_parameters`, some parameters are set several times
Code snippet
import pyotb
import os
sources = ...
os.environ["OTB_TF_NSOURCES"] = str(len(sources))
infer = pyotb.TensorFlowModelServe()
# Set inputs
for i, source in enumerate(sources):
infer.set_parameters({f"source{i}.il"): [source]})
set_parameters
does 2 things:
- update the attribute
self.parameters
- set all key/value of
self.parameters
On the first pass of the loop this is fine. However, on following passes, all previous source{k} for k<i
will be set again. And for images list, the behavior is to append. Thus, in the end, there are some duplicates, something like:
source1.il=[source1, source1, source1], source2.il=[source2, source2], source3.il=[source3].
This was causing in my case some tensorflow errors such as: Invalid argument: input depth must be evenly divisible by filter depth: 20 vs 6