Topological invariants in two and three dimensions