Preheat your oven to 350°F (175°C).
In a large bowl, whisk together flour, granulated sugar, brown sugar, baking powder, cinnamon, and salt until combined.
In another bowl, mix vegetable oil and eggs until well blended. Stir in grated carrots and walnuts if using.
Pour the wet mixture into the dry ingredients and stir gently until just combined.
Spoon the batter into greased mini muffin tins or cupcake liners, filling each about two-thirds full. Bake for 15-20 minutes or until a toothpick inserted comes out clean.
Allow to cool completely before frosting with cream cheese.