Preheat the oven to 350 °F. Line a 9" square cake pan with parchment paper, or butter and flour the pan.
Use the large holes of a box grater or the large grating disc of a food processor to shred 16 oz zucchini. Spread the zucchini in an even layer on a paper towel and cover with another paper towel. Press to absorb the liquid. Let the zucchini sit while you mix the batter.
Sift together 7 ½ oz all purpose flour, ½ teaspoon baking soda, 1 ½ teaspoons baking powder, 1 ½ teaspoons cinnamon, 1 ½ teaspoons ginger, ½ teaspoon nutmeg, and ½ teaspoon salt. Set aside.
Mix 5 ½ oz vegetable oil, 6 oz granulated sugar, and 6 oz brown sugar until it resembles applesauce. Add 3 large eggs, 1 teaspoon vanilla extract and ½ teaspoon lemon extract. Mix until the batter is smooth and emulsified.
Add the dry ingredients in three batches, scraping the bowl in between. Fold in the zucchini and the optional ground walnuts. Mix until completely combined.
Spread the batter into the pan. Bake until the cake springs back when lightly pressed or a toothpick inserted in the center comes out clean, about 45 minutes.
Cool the cake in the pan for 10 minutes, then turn it out onto a rack to cool completely.
Ice the cooled cake with the cream cheese frosting.