Pre trained model performance is affected by other models

I am trying to integrate Mask RCNN to another code, defining it on the constructor of the class. I am using pre trained weights and using it in the evaluation mode. but I noticed that its predictions are affected by other functions inside the constrctor of the class.

this is my line of initializing the model inside the base code’s constrctor:
self.model_mask = torchvision.models.detection.maskrcnn_resnet50_fpn(weights = “MaskRCNN_ResNet50_FPN_Weights.DEFAULT”)

these are other functions that I think they have a direct effect on its performance that are defined in the constrctor of the class.
fill_fc_weights(…)
pass

when I use mask rcnn model separately it works fine but when I integrate it to the base code it does not give the same predictions even for the same images. I tried to freeze the weights but that did not work. your help is greatly appreciated

If you are initializing (some) weights in a custom way, differences in the output is expected so check what e.g. fill_fc_weights does and if it’s initializing some parameters.

Sorry for the inconvenience. I realized that the problem was that the colors of the image were distorted which was the cause of the model’s unprecise predictions.

Thank you for your attention