Ok, here’s the jib:
Pray at least 5 decades of the Rosary every day.
If you think erotic images or feel temptations, lightly strike yourself, not enough to hurt you, but enough to get your mind off of it (saints would throw their selves into bushes and roll in snow to avoid impurity!!), and at the moment of temptation think of Christ crucified in intense detail. Focus on this fact.
As soon as you realize you are being tempted, pray to God for grace to overcome it and not sin.
Go to confession. However, perhaps try to make a confession where the priest sees you. This will make you really want to not keep falling into the same sins.
I would think scruples would make you want to go to confession more. But, trust in God’s mercy and know that you aren’t the thoughts that pop up in your mind.
And pray. Pray a lot, to God. Mental prayer.