Hi, I have the same problem. And I even use three libraries :
> import segmentation_models as sm
> from tensorflow.keras.metrics import MeanIoU
and the last library I use in the middle of code for One Hot Encoding
> from keras.utils import to_categorical
After each importing library, restarting kernel happens. As a result, and it forgets the previous one.
I've tried to use all together in the beginning, but it doesn't work.
Also, I try to find something in the settings of Spider to fix it.
If someone had the same issue, please, tell us how to fix it. Thanks!