How to run custom detection and segmentation models

I added some logs but those logs are not printing after compiling also but from my understanding the models which are having dynamic shapes are not working but the models with static shapes are working how can i handle if model output shapes are dynamic. My problem is similar to the link that i shared below but i dont have pth model to add extra dimesions.