Preheat your oven to 350°F and prepare a muffin pan by lining it with cupcake liners.
In a large mixing bowl, whisk together flour, granulated sugar, brown sugar, baking soda, baking powder, salt, cinnamon, and nutmeg.
Pour in the vegetable oil and mix well. Then, add the eggs one at a time, fully incorporating each before adding the next.
Blend in the vanilla extract and milk until the mixture is smooth.
Fold in the grated carrots and, if desired, the chopped walnuts until evenly distributed throughout the batter.
Divide the batter among the cupcake liners, filling each about 2/3 to 3/4 full.
Bake in the preheated oven for 20 minutes, or until a toothpick inserted into the center comes out clean or with a few moist crumbs.
Remove the cupcakes from the oven and let them cool in the pan for a few minutes before transferring them to a wire rack to cool completely.
Once cooled, frost with your favorite cream cheese frosting.