Our brain is constantly interpreting the environment around us to plan and guide our actions. This requires combining often noisy and contradictory sensory inputs with internal models of the world. We study how this process emerges from networks of neurons in the mouse brain. We focus on the neocortex, a seemingly simple sheet of neurons located at the outermost part of the brain that endows us with our advanced cognitive abilities. Despite its uniform appearance, the neocortex is a complex network of specialized areas. We use the latest techniques to study how these areas interact to combine sensory stimuli and internal factors and give rise to perception.