After my first day of class, when I started my Master's, I went home conviced I was the worst student in class. Everybody knew what they were going to reseach, they all seemed so smart and confident and I was lost as hell. Back then, I didn't know about impostor syndrom, so I felt terrible for a very long time. I just hated myself and thought I was going to fail. It turned out I had a 4.0 GPA and was the first one to defend. =)
I just told all this story to say that maybe you're just being too hard on yourself.