I tried to predict some classes with the resnext50 model using the following call sequence:
arr = np.stack(imagearrays) arr = torch.FloatTensor(arr) arr = arr.transpose(1,3).contiguous() for ii in range(10): res = learn.predict_array(arr=arr) print("R:", res)
I get the following output, which slightly changes for each predict call:
R: [[-0.36225 -1.19109]]
R: [[-0.36265 -1.19016]]
R: [[-0.37965 -1.15233]]
R: [[-0.36384 -1.18745]]
R: [[-0.36067 -1.1947 ]]
I wonder if there is something happening behind the scences. I tried to set random.seed, load the model before each call, call learn.model(…) directly… it did not help.
Has someone an idea or experienced the same?
Edit: once I add the call “learn.model.eval()”, the output stays constant. But the prediction values are then way off, always predicting strongly a single class.