Not too difficult to do.
All you need is to get a mate online, set up a player match and get them to go a "Heavy Gunner" or "Spec Ops" catagory of soldier. These are the only soldiers that wear hats. Then all you must do is shoot their head so that their hat flies off. Then repeat this 20 times. Must be done in one match.