Discover and mitigate biases in discriminative and generative image models