You must train yourself to view things as they are. If you ate too much over the weekend, you are not an asshole you just ate too much. If you skipped a workout you are not doomed to fail, you just had a bad day.
They key to success is consistency and being able to appropriately deal with roadblocks and setbacks. You cannot progress if you turn every dietary molehill into a mountain of an issue. You are human, you will not be perfect.
Like anything worthwhile this reframing of your mind takes time and consistency.