A computer-implemented method of training a target encoder (E t) for classifying images into one of a plurality of categories using a classifier trained on images (X s) from a source domain, the method comprising: generating, by a pre-trained source encoder (E s), a source encoder representation for each image of a labeled set of source images (X s) from the source domain, wherein the source encoder (E S) is trained along with the classifier on the images (X s) and their corresponding labels (Y S); generating, by the target encoder (Et), a target encoder representation for each image of an unlabeled set of target images (X t) from a target domain; characterized by: inputting (430A, 430B), into a generative adversarial network, the source encoder representations, the target encoder representations and a latent code (c), the latent code representing the plurality of categories into which the images are to be classified, wherein each of the source encoder representations is combined with the latent code and each of the target encoder representations is combined with the latent code, wherein a discriminator neural network of the generative adversarial network is configured to output (440; 560) a first prediction indicating whether each of the source encoder representations and each of the target encoder representations originate from the source domain or the target domain, and wherein an auxiliary neural network of the generative adversarial network is configured to output (440; 540) a second prediction of a likelihood of the latent code (c) given a respective one of each of the source encoder representations and each of the target encoder representations; adversarially training the target encoder (E t) and the discriminator neural network by repeatedly updating parameters of the target encoder (E t) and the discriminator neural network using respective adversarial loss functions based on the first prediction; and training the auxiliary neural network using a loss function based on the second prediction. generating, by a pre-trained source encoder (E s), a source encoder representation for each image of a labeled set of source images (X s) from the source domain, wherein the source encoder (E S) is trained along with the classifier on the images (X s) and their corresponding labels (Y S); generating, by the target encoder (Et), a target encoder representation for each image of an unlabeled set of target images (X t) from a target domain; characterized by: inputting (430A, 430B), into a generative adversarial network, the source encoder representations, the target encoder representations and a latent code (c), the latent code representing the plurality of categories into which the images are to be classified, wherein each of the source encoder representations is combined with the latent code and each of the target encoder representations is combined with the latent code, wherein a discriminator neural network of the generative adversarial network is configured to output (440; 560) a first prediction indicating whether each of the source encoder representations and each of the target encoder representations originate from the source domain or the target domain, and wherein an auxiliary neural network of the generative adversarial network is configured to output (440; 540) a second prediction of a likelihood of the latent code (c) given a respective one of each of the source encoder representations and each of the target encoder representations; adversarially training the target encoder (E t) and the discriminator neural network by repeatedly updating parameters of the target encoder (E t) and the discriminator neural network using respective adversarial loss functions based on the first prediction; and training the auxiliary neural network using a loss function based on the second prediction. inputting (430A, 430B), into a generative adversarial network, the source encoder representations, the target encoder representations and a latent code (c), the latent code representing the plurality of categories into which the images are to be classified, wherein each of the source encoder representations is combined with the latent code and each of the target encoder representations is combined with the latent code, wherein a discriminator neural network of the generative adversarial network is configured to output (440; 560) a first prediction indicating whether each of the source encoder representations and each of the target encoder representations originate from the source domain or the target domain, and wherein an auxiliary neural network of the generative adversarial network is configured to output (440; 540) a second prediction of a likelihood of the latent code (c) given a respective one of each of the source encoder representations and each of the target encoder representations; adversarially training the target encoder (E t) and the discriminator neural network by repeatedly updating parameters of the target encoder (E t) and the discriminator neural network using respective adversarial loss functions based on the first prediction; and training the auxiliary neural network using a loss function based on the second prediction.