Start from the top left end. The top two boxes and the bottom two boxes are rectangles so you can omit them.

The 2nd row of boxes has 4 squares. The 3rd row has 4 squares.

Now count the larger squares taking into account two rows. Top two rows contain 2 large squares, bottom two rows contain 2 large squares, 2nd and 3 row contain 3 large squares, totally 7.