Following a doctor's advice isn't the same thing as your mother dragging you out into a public place to be loudly berated. Its a doctor's job to tell you whatever is medically necessary, and there's doctor-patient confidentiality. I mean its not like your doctor has influence over your personal social relationships.IDK, I'm working out and following about 70% of what my nutritionist tells me, and I am pretty sure that my main motivation is to one day be skinny enough to fat shame others.
(That and avoiding diabetes, but mostly the fat-shaming).
Anyway I kinda agree with @daleks_exterminate . I think there are some personalities it may work on, probably specifically on those who are easily motivated by social status. But in a way, even that is a form of self-motivation. I don't think fat-shaming worked in your case. You're losing weight to elevate your status above others, you're not losing weight because of the feeling of shame /humiliation itself.