Don't change you. Change your partner.
I was wondering if maybe you should have a conversation with your husband about why the affection has left your relationship..
9 years is a long time to not have affection and passionate touch and to feel desired. I know some people don't need that side of things and that works for them but you sound like you miss that and the fact you mentioned it makes me think it's having an influence on your confidence
Maybe he hasn't touched you in 9 years because he has body image issues himself or maybe he doesn't come close to you because he feels like you don't want that... You've come to the assumption it's because of your weight.... But what if it isn't and you're putting all this pressure on yourself unnecessarily. You should be able to discuss things like this in a long term relationship so go find out what the issue is, tell him you need affection and to feel wanted and work on it with him.
If you were able to get back on track with a relationship where you both feel desired, fancied and wanted in that way then it might help your self image and give you some confidence back..
Believing the person you love doesn't want you in that way can do disastrous things for self confidence.... IF he doesn't fancy you any more (and it happens to everyone at some point, even those 100% body confident) believe me someone else will delight in making you feel like the most wanted, most beautiful woman in the world so go find that person...
But in the mean time focus on you, do something each day that makes you feel beautiful, read up on self care and self love and take small steps each day to increase your confidence. Don't put pressure on yourself to lose weight, if you want to then maybe change one meal a day to something healthier, or even one ingredient. Get a note pad and write down 3 great things about yourself at the end of each day whether that's your eye lashes looked long and lovely, you made someone smile or your skin smelt amazing from a product you used in the shower... It will help change your thought process to focus on the positives rather than the negatives