To count sigma and pi bonds, first you need to know how many single, double and triple bonds are present in the molecule.
A single bond contains one sigma bond (direct head-on overlap of orbitals).
For example, the
A double bond contains one sigma bond and one pi bond (side-on overlap of
In ethylene, the
A triple bond contains one sigma bond and 2 pi bonds.
In acetylene, the
It's just that simple.
Here's a video on counting sigma and pi bonds.