Detection of Berezinskii-Kosterlitz-Thouless transition via generative adversarial networks