Pretty simple. As a serving US Navy Officer and Trekkie, my answer (verify for yourself if you wish) is yes, the pips are rather closely based on US Navy (USN) rank...to a point.
An Ensign on TNG has one gold pip, USN has a 1/2" sleeve stripe. Junior Grade in TNG has gold and black, USN has 1/2" with 1/4" stripe. Lieutenant: TNG has 2 gold, USN has 2 stripes. LT Cmdr: TNG has 2 gold and a black, USN has two 1/2" and a 1/4" (odd though, since the smaller stripe is between the thicker. It'd be like a gold pip, a black pip, and a gold pip). Commander: TNG has 3 gold, USN has three 1/2" stripes. Captain: TNG has 4 gold, USN has four 1/2" stripes.
Imagine a gold pip is equal to a 1/2" stripe, and a black pip is equal to a 1/4" stripe.
For admirals, switch a little. Yes, US Navy Admirals have sleeve braids, but this time look at their stars. One star/pip with box is a Rear Admiral (lower half), two star/pip with box is a Rear Admiral, three is a Vice Admiral, four an Admiral, five stars/pips in a box is a Fleet Admiral. just change stars into pips in a box.
Enlisted pips do not correspond to USN enlisted rank. Sorry. However, it's my understanding that in later episodes of DS9 an enlisted system was formed that is somewhat close. That would require a more lengthy explaination that what one can do here. Interestingly, while Star Trek: Enterprise keeps the USN derived ranks for the Officers (including Admirals), they seem to have gone with a US Air Force derived rank for their enlisted personnel.
Hope that helps. Remember, a gold pip is a 1/2" braid and a black pip is a 1/4" braid. Pips in a box equal stars.