Patent Description:
The development of deep neural networks including deep convolutional neural networks (CNN) has boosted a large number of computer vision applications. Significant advances that deep neural networks have achieved in various computer vision applications are to a large extent due to the availability of large-scaled labeled data. However, the manual annotation of massive training data for various applications remains expensive. Further, neural networks trained on one set of images do not generalize well to novel sets of images and tasks. This is due to domain shift, the differences between the data distributions of the two domains from which the sets of images are sampled. For example, a neural network trained on synthetic images of objects will not generalize well to photographs of the objects in the real world that include different backgrounds as well as light and shadow. Accordingly, the aim of domain adaptation is to generalize the learned knowledge from a labeled source domain to a new unlabeled domain, called the target domain.

Unsupervised domain adaptation (UDA) aims at compensating the data shift between different domains by learning domain-invariant feature representations using labeled data of the source domain and unlabeled data of the target domain. Deep networks contribute to UDA by disentangling explanatory factors of variations underlying domains to learn more transferable features. Features are transferable (or domain invariant) if they are designed in such a way they can be used in both source and target domains without an accuracy drop.

More specifically, labeled source images Xs having labels Ys are drawn from a source domain distribution ps(x, y) and unlabeled target images Xt are drawn from a target domain distribution pt(x). Due to the domain shift, the data distributions of the source domain and the target domain are different, i.e. ps(x) ≠ pt(x). Moreover, the label space, Ys, formed by source labels Ys is often different from the target label space, Yt.

Most prior art approaches rely on the comparison of marginal distributions between the source and target domains (i.e., where p(x, y), the marginal distribution variables x, given as the probability distribution p(x) = Σyp(x,y)), and until recently, they implicitly assumed a good class alignment between the source and target domains, such that reducing distribution divergence makes the transfer between domains easier. In the class alignment case, the two spaces are identical, Yt = Ys, and the source and target class distributions are similar, pt(y) ≈ ps(y). Under such an assumption, different families of domain adaptation methods have been developed, by matching the statistic moments, by optimal transportation between the domains, or by relying on domain adversarial networks. However, such an alignment assumption is invalidated in real-world scenarios where source classes are often under-represented or simply absent in the target domain. This shift between the source domain and the target domain is referred to as the class imbalance problem.

There are several main families of prior art approaches in domain adaptation research. One big family includes methods trying to match statistic moments on domain distributions, i.e. maximum mean discrepancy (MMD) and its joint and conditional variants (<NPL>; <NPL>; <NPL>).

Another approach is to align representations in source and target domains using optimal transportation or by associating source and target data in an embedding space (<NPL>).

A third family of methods is based on adversarial learning (<NPL>; <NPL>). Borrowing the idea of Generative Adversarial Networks (GAN) (<NPL>), these methods encourage samples from different domains to be non-discriminative with respect to domain labels.

<NPL> proposes an unsupervised domain adaptation method that combines adversarial learning with discriminative feature learning. Specifically, a discriminative mapping of target images to the source feature space (target encoder) is learned by fooling a domain discriminator that tries to distinguish the encoded target images from source examples. A source encoder CNN is first pre-trained using labeled source image examples. Next, adversarial adaptation is performed by learning a target encoder CNN such that a discriminator that sees encoded source and target examples cannot reliably predict their domain label. During testing, target images are mapped with the target encoder to the shared feature space and classified by the source classifier.

<NPL>, teaches that generative adversarial nets can be extended to a conditional model if both the generator and discriminator are conditioned on some extra information y. y could be any kind of auxiliary information, such as class labels or data from other modalities. The conditioning can be performed by feeding y into both the discriminator and the generator as an additional input layer.

<NPL>, proposes a framework that simultaneously trains two models: a generative model G that captures the data distribution, and a discriminative model D that estimates the probability that a sample came from the training data rather than G. The training procedure for G is to maximize the probability of D making a mistake. This framework corresponds to a minimax two-player game.

Class imbalance occurs when each class does not make up an equal portion of the dataset. Early methods to address the class imbalance in domain adaptation were based on projecting source and target data into a subspace and selecting a set of source subspaces that are most relevant to the target domain.

In the moment based family of domain adaptation methods, Yan et al. (<NPL>) were first to explicitly take into account the class imbalance. They proposed a weighted MMD model that introduces an auxiliary weight for each class in the source domain when the class weights in the target domain are not the same as those in the source domain. The class weights are either known or estimated from iterative soft labeling of the target instances using the EM method.

In the adversarial learning family, the partial domain adaptation relaxes the fully shared label space assumption to that the source label space subsumes the target label space. (<NPL>) proposed the Selective Adversarial Network (SAN) in order to distinguish between the relevant and irrelevant (outlier) source classes.

Another strategy to identify the importance score of source samples is proposed by Yosinski et al. Specifically, it deploys two domain classifiers, where the activations of first domain classifier are used as an indicator of the importance of each source sample to the target domain. By using these activations as weights, the weighted source samples and target samples are fed into the second domain classifier for optimizing the feature extractor.

The relevant problem of selective bias has been systematically studied in semi-supervised learning (<NPL>) and deep learning with noisy labels (<NPL>). Selection bias refers to the difference between the training and the test data. Specifically, selection bias causes the distribution of collected data used in training data to deviate from the overall distribution. Most predictive models are sensitive to selection bias and current approaches try to correct this bias by adding pseudo-labeled data to the training sample, while instance weighting is used to make training samples similar to the distribution observed in the test data.

The iterative self-training procedure, where the problem is formulated as latent variable loss minimization, can be solved by alternatively generating pseudo labels on target data and retraining the model with these labels (<NPL>). However, jointly learning the model and optimizing pseudo-labels on unlabeled data is naturally difficult as it is impossible to guarantee the correctness of the generated pseudo-labels. Semi-supervised learning can correct modest selection bias, but if the domain gap is too wide, initial predictions in the target domain will be poor, and there is a high risk to increase bias during the training rather than decrease it.

Class imbalance (CI) may be measured as the Kullback-Leibler (KL) divergence of target class distribution pt(x) from the source class distribution ps(y). A KL divergence of <NUM> indicates similar behavior of two different distributions, while a KL divergence of <NUM> indicates that the two distributions behave in such a different manner that the expectation given the first distribution approaches zero.

<FIG> illustrates the impact of class imbalance on the performance of three prior art domain adaptation methods: optimal transport (<NPL>), adversarial discriminative domain adaptation (ADDA) (<NPL>) and correlation alignment (COREL) (<NPL>). Specifically, <FIG> plots the classification accuracy as the function of CI values for the six domain adaptation tasks of the Office31 dataset (shown in <FIG>). Large circles indicate the accuracy domain class alignment, where CI values lie between <NUM> and <NUM>. It is obvious that comparing the UDA methods for small CI says little about their resistance to severe class imbalance. Meanwhile, when CI values approach <NUM>, the accuracy drop is <NUM>% to <NUM>%.

Under a severe class imbalance, it is impossible to reduce the domain shift by comparing source and target distributions directly. In other words, reducing distribution shift will not benefit the target task, since the marginal distributions between domains should not be the same.

In this case, a natural way to transfer from the source domain to the target domain is re-weighting the source domain samples whose classes are likely to appear in the target domain. Since the target domain is unlabeled, it is very challenging to uncover which classes are presented and which source domain samples are important for transferring. Success of any re-weighting schema relies on capacity to correctly estimate the target labels. Straightforward in the alignment case, this is problematic in the severe class imbalance.

Two main approaches to cope with the class imbalance in domain adaptation were identified above. The first approach is based on the source classifier. In all domain adaptation families, methods count on the source classifier to correctly predict the soft target labels. However, if the gap between source and target is too large, iterative optimization with soft labels often suffer from estimation error, bad initialization and convergence to local minima.

The second approach is to count on the discriminator and its activations as an indicator for re-weighting the source instances. However, under the class imbalance, it is hard to distinguish between a poor domain discriminator and a low class probability in the target domain.

Accordingly, there is a need in the art to address the problem of severe class imbalance in unsupervised domain adaptation, when the class spaces in source and target domains diverge considerably.

It is therefore desirable to provide a method of improved image classification that overcomes the above disadvantages of the prior art. Specifically, it is desirable to provide a method of training neural networks trained on labeled images from one domain to be able to accurately classify unlabeled images from another domain.

It is the object of the present invention to provide more efficient and accurate classification of images.

The present disclosure provides for improved image classification by addressing the problem of severe class imbalance in unsupervised domain adaptation, when the class spaces in source and target domains diverge considerably. A new approach to class imbalance that uses latent codes in the adversarial domain adaptation setting is provided, where the latent codes can be used to disentangle the salient structure of the target domain and to identify under-represented classes. The latent code construction can be learned jointly with the learning of the domain invariant domain representation and used for accurately estimating the target labels. The new approach generalizes the absence of some classes in the target domain to the continuous space of divergences between class distributions.

In an embodiment, a computer-implemented method of training a target encoder for classifying images into one of a plurality of categories using a classifier trained on images from a source domain, comprises: generating, by a pre-trained source encoder, a source encoder representation for each image of a labeled set of source images from the source domain; generating by the target encoder, a target encoder representation for each image of an unlabeled set of target images from a target domain; inputting, into a generative adversarial network, the source encoder representations, the target encoder representations, and latent code representing the plurality of categories, wherein the generative adversarial network is configured to output 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 the generative adversarial network is further configured to output a second prediction of the latent code for each of the source encoder representations and each of the target encoder representations; and training the target encoder and the generative adversarial network by repeatedly updating parameters of the target encoder and the generative adversarial network until a first loss function for the first prediction and a second loss function for the second prediction reach a minimum.

According to an aspect, the method further comprises classifying a target image using the trained target encoder and the classifier, wherein the classifier is trained using supervised learning on the labeled set of source images. Classifying a target image using the trained target encoder and the classifier may comprise: inputting a target image into the trained target encoder; generating a target encoder representation of the target image; inputting the target encoder representation of the target image into the trained classifier; and classifying the image by the trained classifier into one of the plurality of categories.

According to another aspect, the method further comprises pre-training the source encoder and the classifier by: inputting the source encoder representations and source labels into the classifier; and pre-training the source encoder and the classifier by repeatedly updating parameters of the source encoder and the classifier until the classification loss function reaches a minimum.

According to an aspect, the generative adversarial network comprises a generator neural network, a discriminator neural network and an auxiliary neural network. The inputting, into the generative adversarial network, the source encoder representations, the target encoder representations, and the latent code, comprises inputting, into the generator neural network, the source encoder representations combined with the latent code and the target encoder representations combined with the latent code. The method comprises computing, by the generator neural network, joint hidden representations for each of the source encoder representations and each of the target encoder representations, each joint hidden representation based on a combination of the latent code and a respective one of the source encoder representations and the target encoder representations; inputting, into the domain discriminator neural network, the joint hidden representations, wherein the domain discriminator neural network is configured to output the first prediction; and inputting, into the auxiliary neural network, the joint hidden representations, wherein the auxiliary neural network is configured to output the second prediction.

In a further embodiment, a computer-readable storage medium having computer-executable instructions stored thereon is provided. When executed by one or more processors, the computer-executable instructions perform the method of training a target encoder described above.

In a further embodiment, an apparatus comprising processing circuitry is provided. The processing circuitry is configured to perform the method of training a target encoder described above.

The accompanying drawings are incorporated into and form a part of the specification for the purpose of explaining the principles of the embodiments. The drawings are not to be construed as limiting the embodiments to only the illustrated and described embodiments of how they can be made and used. Further features and advantages will become apparent from the following and more particularly from the description of the embodiments, as illustrated in the accompanying drawings, wherein:.

Described herein are systems and methods for image classification. For purposes of explanation, numerous examples and specific details are set forth in order to provide a thorough understanding of the described embodiments. Embodiments as defined by the claims may include some or all of the features in these examples alone or in combination with other features described below, and may further include modifications and equivalents of the features and concepts described herein. The illustrative embodiments will be described with reference to the drawings wherein like elements and structures are indicated by like reference numbers. Further, where an embodiment is a method, steps and elements of the method may be combinable in parallel or sequential execution. As far as they are not contradictory, all embodiments described below can be combined with each other.

In the embodiments below, labeled source images Xs having labels Ys are drawn from a source domain distribution ps(x, y) and unlabeled target images Xt are drawn from a target domain distribution pt(x), where ps(x) ≠ pt(x). Moreover, the label space, Ys, formed by source labels Ys is different from the target label space, Yt, where Yt ⊆ Ys, and where the presence of some classes in the target domain is unknown. Consequently, attention is paid to the class imbalance when the target class distribution, pt(y), is very different from the source class distribution, ps(y). Moreover, no difference is made between the under-represented and absent classes.

In adversarial domain adaptation (ADDA) a domain classifier is combined with domain representation learning to form an adversarial domain adaptation network. The main idea here is to learn both class discriminative and domain invariant representations, where the loss of the label predictor of the source image is minimized while the loss of the domain classifier is maximized.

The adversarial domain adaptation framework is similar to the original GAN framework with the following minimax loss: <MAT> where Es is the source encoder, Et is the target encoder, and D is the domain classifier. D corresponds to the discriminator in the original GAN, configured to discriminate between the source and the target domains, with all the source images labelled as <NUM> and all the target images labelled as <NUM>. Maximizing the minimax loss with respect to D yields a tighter lower bound on the true domain distribution divergence, while minimizing the minimax loss with respect to Es, Et, minimizes the distribution divergence in the feature space.

Since no labeled images are available in the target domain, the network is trained in two stages. First, it learns the source encoding Es, along with a source classifier, C. Then it learns how to adapt that model to the target domain. The main goal is to regularize the learning of the source and target encoders, Es and Et, so as to minimize the distance between the source and target encoded distributions, Es(x) and Et(x).

Source and target encoders are designed to capture domain specific representations. In the first stage, the source discriminative model C(Es(x)) is trained for the image classification task by learning the parameters of the source encoder, Es, and the classifier, C, using the standard supervised loss for a source domain classification task.

Once the source encoder is learned and fixed, a domain adversarial loss is used to reduce the discrepancy between the two domains by optimizing the target encoder, Et, and the discriminator, D. There are various different choices of adversarial loss functions, they all train the adversarial discriminator using the domain classification loss, <MAT>: <MAT>.

As more layers using certain activation functions are added to neural networks, the gradients of the loss function approaches zero, making the network hard to train (i.e., the vanishing gradient problem). To address the vanishing gradient problem, the domain classifier can be trained using the standard loss function with inverted labels. This splits optimization into two independent objectives, one for the encoder Et and one for the discriminator, D. <MAT> remains unchanged, and <MAT> is defined as follows: <MAT>.

This loss function has the same properties as the minimax loss but provides stronger gradients to the target mapping. The stronger gradients allow the target encoder to better converge to the optimum. The source encoder Es trained at the first stage is often used as an initialization of the target encoder Et.

The discriminative loss above works well when classes in domains are aligned, ps(y) ≈ pt(y). In the case of class imbalance, the direct sampling x~ps(x), x~pt(x) in equations (<NUM>) to (<NUM>) is replaced with an instance re-weighting in weighted ADDA, that estimates the p (xs)/p (xt) ratio, or by detecting outlier classes in partial domain adaptation, and down-weighting their contribution to the loss.

<FIG> illustrates a block diagram of a Latent code Adversarial Domain Adaptation (LADA) network in accordance with an embodiment. The LADA network comprises: a source coder (Es), a target encoder (Et), a classifier (C), a latent code (c) and a generative adversarial network (A). In some embodiments, one or more of the components of the LADA network (i.e. the source coder (Es), the target encoder (Et), the classifier (C) and the generative adversarial network (A)) are convolutional neural networks (CNN).

The encoders (i.e. the source encoder (Es) and the target encoder (Et)) are each configured to map the source image to their respective encoder feature representation. Thus, the encoders are configured to generate and output a respective encoder representation of the input source image. The respective encoder representations are then output to the generative adversarial network (A) along with the latent code (c).

The generative adversarial network (A) comprises a generator neural network (G), a domain discriminator neural network (D), and an auxiliary neural network (Q). The source encoder representations and the target encoder representations are each combined with the latent code (c), where the generator neural network (G) is configured to receive, as input, the source encoder representations combined with the latent code (c) and the target encoder representations combined with the latent code (c). The encoder representations and the latent code (c) are concatenated, so that these inputs may be expressed generally as z = [E(x), c]. The generator neural network (G) is then configured to generate joint hidden representations based on the input received from the source encoder (Es) and the target encoder (Et). The joint hidden representations are output, by the generator neural network (G), to the discriminator neural network (D) and the auxiliary neural network (Q). In some embodiments, the generator neural network is a convolutional neural network comprising three hidden layers with a ReLU (Rectified Linear Unit) activation function. The layer sizes may be <NUM>, <NUM> and <NUM> neurons, respectively.

The discriminator neural network (D) is configured to discriminate between the source domain and the target domain. In other words, the discriminator neural network is configured to predict whether each joint hidden representation received from the generator neural network (G) is associated with the source domain or the target domain. The latent code (c) enables disentangling of the salient structure of the target domain to boost discriminative learning of the target encoder (Et) and the domain discriminator neural network (D).

Although the latent code (c) is represented by two separate blocks in <FIG>, the same latent code is used as input in the source encoder and the target encoder in an embodiment. Latent code is a vector describing the specific features that should be in an image. For example, points, edges and objects are types of features that may be distinguished in an image. In an embodiment, the latent code (c) is sampled from a distribution P, which can be a pre-defined distribution or given from a data collection. In one embodiment, the latent code represents the plurality of categories, K, into which the images are to be classified. In this case, the latent code comprises a uniform categorical code with K categories.

The auxiliary network (Q) is included for the latent code reconstruction. Specifically, the auxiliary network (Q) is configured to predict, given each joint hidden representation, a probability distribution, Q(c|z), of the latent code (c). Moreover, the auxiliary network (Q) can complement the classifier (C) in estimating image labels.

In some embodiments, the auxiliary neural network (Q) and the domain discriminator neural network (D) share most convolutional layers, where the convolutional layers shared by the auxiliary neural network (Q) and the domain discriminator neural network (D) correspond to the convolutional layers of the generator neural network (G). Here, the output of the generator neural network (G) is mapped to fully connected layers for the discriminator and the auxiliary function with <NUM> and Nc variables, respectively, where Nc is the number of source classes. In some embodiments, the auxiliary neural network (Q) is one final fully connected layer with a softmax function to output parameters for the probability distribution Q(c|z).

The training and operation of the LADA network of <FIG> will be described in more detail below. More specifically, in the embodiments described below with regard to <FIG>, the LADA network is trained so that, after training, the target encoder (Et) and the classifier (C) are able to classify images into one of a plurality of categories.

<FIG> is a process flow diagram of an exemplary method <NUM> of a first training stage for training the LADA network of <FIG> in accordance with an embodiment. The first training stage may also be referred to as the pre-training stage.

At step <NUM>, a source image is input into the source encoder (Es). The source image is a first image of a labeled set of source images (Xs), having source labels (Ys), from the source domain distribution (ps(x, y)). The source encoder (Es) then generates a source encoder representation of the source image (step <NUM>).

The classifier (C) is configured to receive the generated source encoder representations and source image labels (Ys) as input. The source image labels may correspond to one or more categories of a plurality of categories for a corresponding image. In some embodiments, the source image labels correspond to objects shown in the corresponding images e.g. "chair", "table", "horse", "aeroplane" etc. Thus, at step <NUM>, the generated source encoder representation and the corresponding source label is input into the classifier (C).

The classifier (C) is configured to classify source images into one of a plurality of categories (K). Thus, at step <NUM>, the classifier outputs for the source encoder representation input at step <NUM>, a prediction of the category. Since the source images are labeled, the classification objective function is a loss function (<IMG>) associated with the cost of incorrect category predictions. The parameters of the source encoder (Es) and classifier (C) are therefore learned, by training the source encoder (Es) and the classifier (C) in a supervised fashion on the source image and label pairs (x, y) from the source domain distribution ps(x, y), using the following supervised loss function for the source domain classification task: <MAT>.

At step <NUM>, the learnable parameters of the source encoder neural network (Es) and the learnable parameters of the classifier (C) are updated by backpropagation of the relative gradients of the loss function with respect to the learnable parameters. The learnable parameters include the weights and, optionally, the biases of the neurons in the neural networks.

The source encoder (Es) and the classifier (C) are trained by repeating steps <NUM> through <NUM> for each of the sources images in the set until it is determined at step <NUM> that the classification loss function (<IMG>) has reached a minimum (i.e. that <IMG> is close to zero). In other words, pre-training the source encoder (Es) and the classifier (C) comprises minimizing the classification loss function (<IMG>). Once it is determined at step <NUM> that the classification loss function (<IMG>) has been minimized, the first (pre-training) stage is concluded at step <NUM>.

In one embodiment, once the source encoder has been pre-trained during the first training stage, the parameters of the source encoder are fixed. In another embodiment, the parameters of the source encoder are not fixed after pre-training and are updated during the second training stage.

<FIG> is a process flow diagram of an exemplary method <NUM> of a second training stage for training the LADA network of <FIG> in accordance with an embodiment. Specifically, in the embodiment illustrated in <FIG>, the target encoder (Et) is trained for classifying images into one of a plurality of categories using the classifier (C), pre-trained in accordance with the embodiment illustrated by <FIG>.

At step 410A, a source image is input into the pre-trained source encoder (Es). In an embodiment, the source encoder (Es) was pre-trained according to the method described with respect to <FIG>. The source image is sampled from a labeled set of source images (Xs), having source labels (Ys), from the source domain distribution (ps(x, y)). In some embodiments, the set of source images is the same as the set of source images used during the pre-training stage. In other embodiments, the set of source images is a different set of source images than the set of source images used during the pre-training stage.

At step 420A, the pre-trained source encoder (Es) generates a source encoder representation of the source image input into the pre-trained source encoder (Es). The source encoder representation is then output to the adversarial neural network (A). More specifically, as will be discussed with regard to <FIG> below, the generated source encoder representation is output to the generator neural network (G).

The target encoder (Et) is configured to receive, as input, a set of unlabeled target images (Xt) from the target domain distribution, where the target domain distribution is different from the source domain distribution, as discussed above. Specifically, at step 410B, the target encoder (Et) receives a target image.

In some embodiments, the set of source images (Xs) may comprise synthetic images and the set of target images (Xt) may comprise real images (e.g. photographs). In other embodiments, the set of source images (Xs) and the set of target images (Xt) may both comprise real images. For example, the set of source images (Xs) and the set of target images (Xt) may have different resolutions (e.g. the source images may comprise high-resolution images and the target images may comprise low-resolution images). Alternatively the set of source images (Xs) and the set of target images (Xt) may have been taken in different lighting conditions (e.g. the source images may comprise images taken in bright light conditions and the target images may comprise images taken in low light conditions).

The target encoder (Et) is configured to generate, for each input image, a target encoder representation. Thus, at step 420B, the target encoder generates a target encoder representation of the target image. In an embodiment, the target encoder learnable parameters are initialized using the parameters of the pre-trained source encoder. In other words, the initial weights and biases of the target encoder are the same as those of the pre-trained source encoder. Target encoder representations generated by the target encoder (Et) are then output to the adversarial neural network (A).

At step <NUM>, the source encoder representation or the target encoder representation combined with latent code (c) is input into the generative adversarial network (A). Specifically, at step 430A a combination, zs = [Es(x), c], of the source encoder representation generated at step 420A and a latent code is input into the generative adversarial network (A) and at step 430B a combination, zt = [Et(x), c], of the target encoder representation generated at step 420B and a latent code is input into the generative adversarial network (A). As will be discussed in more detail with regard to <FIG> below, the target encoder representations are input to the generator neural network (G).

The generative adversarial network (A) is configured to output a first prediction (also referred to a domain discrimination prediction) indicating whether an input encoder representation originates from the source domain or the target domain. The generative adversarial network (A) is further configured to output a second prediction of the latent code (also referred to as a latent code prediction). As will be discussed in more detail with regard to <FIG> below, the first prediction is computed and output by the discriminator neural network (D) and the second prediction is computed and output by the auxiliary network (Q).

Thus, at step <NUM>, the generative adversarial network (A) outputs a first prediction indicating whether the source encoder representation input at step 430A or whether the target encoder representation input at step 430B originates from the source domain or the target domain. In other words, the generative adversarial network (A) predicts whether the input is based on a source encoder representation or a target encoder representation.

Also at step <NUM>, the generative adversarial network (A) outputs a second prediction of the latent code (c) for the source encoder representation input at step 430A or the target encoder representation input at step 430B. In other words, for each input, the generative adversarial network (A) is configured to predict the latent code (c). The second prediction is a probability distribution of the likelihood of latent code (c) given the input encoder representation E(x), i.e. the likelihood of the latent code input at step 430A or 430B belonging to one of the categories K. Since image labels are not input into the generative adversarial network (and, in any case, are not available for the target images), the loss function is based on the difference between the actual input (the latent code (c)) and the reconstructed input (the second prediction). In other words, the loss function is based on whether the actual input and the reconstructed input are the same or not.

At step <NUM>, based on a first loss function associated with an incorrect first prediction and a second loss function associated with an incorrect second prediction, the learnable parameters (i.e. the weight and, optionally, the biases) of the target encoder (Et) and the generative adversarial network (A) are updated by backpropagation.

The target encoder (Et) and the generative adversarial network (A) are trained by repeating steps <NUM> through <NUM> for each of the source images in the set of source images and for each of the target images in the set of target images until the first loss function and the second loss function have reached a minimum (step <NUM>). Once it is determined at step <NUM> that the first loss function and the second loss function have been minimized, the second training stage is concluded at step <NUM>.

<FIG> is a process flow diagram illustrating in more detail the operation of the generative adversarial network (A) described in <FIG> with regard to its component networks (i.e., the generator neural network (G), the domain discriminator neural network (D) and the auxiliary network (Q)), in accordance with an embodiment.

As discussed above with regard to <FIG>, the inputs to the generative adversarial network (A) are received by the generator neural network (G). More specifically, the generator neural network (G) is configured to receive the source encoder representation combined with latent code as input zs = [Es(x), c]. The generator neural network is further configured to receive the target encoder representation combined with latent code as input zt = [Et(x),c]. Thus, at step <NUM> shown in <FIG> (corresponding to steps 430A and 430B shown in <FIG>), an encoder representation (i.e. a source encoder representation or a target encoder representation) combined with latent code (c) is received as input z = [E(x), c] by the generator neural network (G).

The generator neural network (G) is configured to generate a joint hidden representation for each input, z. Thus, at step <NUM>, the generator neural network (G) computes a joint hidden representation (G(z)) for an input z = [E(x), c]. The joint hidden representations computed by the generator neural network (G) are then output to the auxiliary neural network (Q) and to the discriminator neural network (D).

The generator network (G) can ignore the latent code (c) by finding the trivial solution satisfying PG(x|c) = PG(x). To prevent this, the latent code is made meaningful by maximizing the mutual information, I(c; G(z)), between the latent code and the output, G(z). This mutual information cannot be calculated explicitly, so a lower bound is approximated using standard variational arguments. This consists of introducing an auxiliary distribution Q(c|z), which is modeled as a parameterized neural network (the auxiliary neural network Q), in order to approximate the likelihood of the latent code c given the input representation E(x).

In an embodiment, the mutual information I(c; zs) between the latent codes c and the labeled source images may be increased by using the source labels (Ys) as latent codes. Training the auxiliary neural network Q on labeled source images enables to encode the semantic meaning of the source labels via the latent code (c) by means of increasing the mutual information I(c; zs). Simultaneously, the generator G acquires the source label information indirectly by increasing I(c; zt) and learns to utilize the encoded representations of the target images.

In more detail, at step <NUM>, the joint hidden representation generated by the generator neural network (G) at step <NUM> is input into the auxiliary neural network (Q). At step <NUM>, the auxiliary neural network (Q) outputs a prediction of the latent code (c) for each of the joint hidden representations. Said prediction is the second (latent code) prediction discussed with regard to step <NUM> of <FIG> above. Specifically, the auxiliary network (Q) outputs, for the joint hidden representation, a probability distribution for the latent code given the respective joint hidden representation. The auxiliary loss function (i.e., the loss function to be minimized when training the auxiliary network (Q)) is given by: <MAT>.

In an embodiment, the entropy H(c) is assumed to be constant and it is omitted from the auxiliary loss function <IMG> for simplicity. As discussed above, the latent code (c) is sampled from a distribution P which is assumed to be fixed during the training. If the distribution <IMG> is not fixed, the term H(c) should be differentiable as the regularization term in the auxiliary loss function in equation (<NUM>), where the regularization term H(c) smooths out extreme values of the first (main) term.

At step <NUM>, the joint hidden representation generated by the generator neural network at step <NUM> is input into the domain discriminator neural network (D). At step <NUM>, the domain discriminator neural network (D) predicts, for each joint hidden representation, whether the joint hidden representation is based on a source encoder representation or a target encoder representation. Said prediction is the first (domain discrimination) prediction discussed with regard to step <NUM> of <FIG> above.

The target encoder (Et) and the domain discriminator neural networks (D) are trained adversarially. Therefore, during training, the aim is to maximize the loss function for the domain discriminator neural network (D) and to minimize the loss function for the target encoder (Et). If the domain discriminator neural network (D) is trained using the adversarial loss function (<IMG>) with inverted labels, the optimization can be split into two independent objectives, one for the domain discriminator neural network (D) and one for the target encoder (Et). In other words, the loss function <IMG> may be expressed as the combination of two component loss functions, one associated with the domain discriminator neural network <MAT> and one associated with the target encoder <MAT>, where <MAT>.

The loss function <MAT> is given by a combination of the latent codes with the encoded representations of source and target samples as follows: <MAT>.

The loss function <MAT> is as follows: <MAT>.

At step <NUM>, based on the loss functions in equations (<NUM>) to (<NUM>), the learnable parameters (i.e., the weights and, optionally, the biases) of the target encoder (Et), the domain discriminator neural network (D), the auxiliary neural network (D) and the generator network (G) are updated by backpropagation of the gradients of the loss functions. Step <NUM> corresponds to step <NUM> in <FIG>.

The target encoder (Et), the domain discriminator neural network (D), the auxiliary neural network (D) and the generator network (G) are trained by repeating steps <NUM> through <NUM> for each of the source images in the set of source images and for each of the target images in the set of target images until each of the loss functions in equations (<NUM>) to (<NUM>) has reached a minimum. Once it is determined at step <NUM> that said loss functions have been minimized, the second training stage is concluded at step <NUM>. Steps <NUM> and <NUM> correspond to steps <NUM> and <NUM> in <FIG>, respectively.

In an embodiment, the parameters of the pre-trained source encoder are fixed once the first training stage is complete, before training the target encoder and generative adversarial network at the second training stage. This method of training the LADA network may be referred to as two-stage training or LADA-<NUM>.

However, in another embodiment, the parameters of the pre-trained source encoder are not fixed once the first training stage is complete and the parameters of the pre-trained source encoder are updated during the second training stage. This method of training the LADA network may be referred to as the three-player training mode or LADA-<NUM>.

In the LADA-<NUM> training mode, the source encoder (Es) and the classifier (C) are trained during a first training stage as described with respect to <FIG> above. Then, during the second training stage, as described with respect to <FIG> and <FIG>, the source encoder (Es), the target encoder (Et) and the domain discriminator neural network (D) are trained jointly, by minimizing all the LADA losses given in equations (<NUM>) to (<NUM>), as will be described in more detail below.

More specifically, after the first training stage, the parameters of the source encoder (Et) are used to initialize the parameters of the target encoder (Et) for the second training stage. At the second training stage, the classification loss function (<IMG>), the domain adversarial loss function (<IMG>) and the auxiliary loss function (<IMG>) are alternately minimized. Thus, instead of one call for loss minimization on the sum of the three losses <IMG> at steps <NUM> and <NUM>, there are three calls for the minimization of each of the three losses <IMG>, <IMG>, <IMG> individually. In other words, for each source image input into the source encoder at step 410A and for each target image input into the target encoder at step 410B, the classification loss function (<IMG>), the domain adversarial loss function (<IMG>) and the auxiliary loss function (<IMG>) are each minimized in turn. This allows backpropagation of the gradients of the auxiliary loss function (<IMG>) to the source encoder (Es).

The source encoder (Es) may evolve, sometimes paying a price of doing less well on source images, towards a better domain invariant representation and latent code re-construction in the auxiliary network (Q).

Once the second training stage using LADA-<NUM> or LADA-<NUM> is complete, the target encoder (Et) and the classifier (C), which are now trained, can be used to classify new (test) images.

In some embodiments, once the latent code construction is learned by the auxiliary neural network (Q), it can be used to predict the target labels. However, Q does not duplicate the source classifier C because it counts on the generative adversarial network to be able to uncover the salient structure of the target domain. Accordingly, in an embodiment (illustrated by <FIG>), the trained target encoder and classifier are used to classify images from that target domain.

<FIG> illustrates an exemplary method <NUM> of using the target encoder (Et) and the classifier (C) trained in accordance with the methods described with regard to <FIG> to classify images from the target domain. At this stage, the target encoder (Et) and the classifier (C) may be referred to as the trained target encoder and the trained classifier, respectively.

At step <NUM>, a target image (also referred to as a test image) is input into the trained target encoder. In an embodiment, the target image is an image from the target domain that has not been used during training. At step <NUM>, the trained target encoder generates and outputs a target encoder representation of the target image. The target encoder representation of the test image is then input into the trained classifier (step <NUM>). The trained classifier then classifies the target image into one of the plurality of categories and outputs, a step <NUM>, a prediction of the category of the test image.

The LADA network of <FIG> is implemented using the TensorFlow Library <NUM> with CUDA <NUM>. The LADA network is trained on source images (Xs) conditioned on their class labels (Ys) and unlabeled target images (Xt). Both the source encoder (Es) and the target encoder (Et) are fully connected layers. Domain encoded representations (i.e. the source encoder representation and the target encoder representation) and latent code are mapped to the generator neural network (G), as disclosed above, where the generator neural network (G) is composed of three hidden layers with a ReLU activation function. In an embodiment, the layer sizes are <NUM>, <NUM> and <NUM> neurons, respectively. The output of the generator neural network (G) is then mapped to fully connected layers for the domain discriminator neural network (D) and the auxiliary neural network (Q), having <NUM> and Nc variables, respectively, where Nc is the number of source classes.

The model is trained using stochastic gradient descent (Adam optimizer) with mini-batches of size <NUM> and an initial learning rate of <NUM> at both stages. Dropout with probability of <NUM> is applied to both domain encoders (Es and Et) and to the generator neural network (G). This means that, during training, individual nodes of the encoders (Es and Et) and the generator neural network (G), along with their respective incoming and outgoing connections, are temporarily dropped out of the network with a probability of <NUM>, so that a reduced network is left. The classification accuracy on target images is used as the evaluation metric, as will be discussed in more detail below.

The Kullback-Leibler (KL) divergence is used to measure the divergence of target class distribution pt(y) from the source one ps(y). The class imbalance ratio CI(t,s) is defined as KL(yt || ys). The KL divergence is defined only if, for any class, c, ps(y = c) = <NUM> implies pt(y = c) = <NUM>. If pt(y = c) is zero, the contribution of the c-th term is interpreted as zero because limx→<NUM> + xlog(x) = <NUM>. Therefore, it can cope with both under-represented and absent target classes, when pt(y = c) is very low or simply zero. If the source and target classes are well aligned, the CI(t,s) values are close to zero.

The severe class imbalance is modeled by a controlled sampling from the target collection. A Random CI sampling protocol, which is an extension of the two-class selective bias protocol described in <NPL>, to the multiclass setting, is adopted. Specifically, a KL divergence generator is run and target subsets sampled in such a way that CI(t,s) values follow a uniform distribution, CI(t,s) Unif(<NUM>,<NUM>). By varying CI values in the (<NUM>,<NUM>) range, a better idea of how unsupervised domain adaptation methods resist to the class imbalance is obtained.

The performance of the LADA network disclosed above under the class imbalance is evaluated below.

The baseline is to disregard the latent codes in the LADA network by setting all latent codes to <NUM>. This network is denoted LADA-<NUM>.

The first training option concerns the distribution P for sampling latent codes c. Due to the semi-supervised latent codes in the auxiliary neural network (Q), we use the coupled sampling for the source encoder (Es) i.e., when sampling the source domain as input to the generator neural network (G), x~ps(x), c~<IMG>, the encoded representation Es(x) of source instance x is coupled with the latent code c which is the corresponding labels ys.

Concerning the distribution P for latent codes c, three options are distinguished:.

LADA-T combines the classifier (C) and auxiliary neural network (Q) to estimate the target class distribution p̂t(Y). As entropy H(c) is assumed to be constant in equation (<NUM>), the network with the uniform discrete distribution c ~Unif(Nc) is trained first; then the target class distribution p̂t(y) is estimated and fixed and latent codes, c~p̂t(y), are sampled from it.

The second training option is on the second stage of LADA training. Along with the two-stage training (LADA-<NUM>), the three-player mode (LADA-<NUM>) is also considered, which allows to backpropagate the auxiliary loss to the source encoder and can learn better domain invariant representations.

Finally, to estimate the target class distributions, class probabilities for target images, pC(y|xt), predicted by classifier C can be complemented with the pQ(y|xt) by the auxiliary network Q, as the labels are used as the latent codes. The two predictions are then simply summed. The product rule, commonly used in the class imbalance case (where some classes have very low probabilities), p(y|x) = pC(y|x)pQ (y|x)/p(y), does not work as favoring the rare and absent classes.

Experiments are run on two image benchmark datasets Office31 (OFF31), shown in <FIG>, and VisDA, shown in <FIG>.

Office31 is a standard dataset for comparing visual domain adaptation methods. It includes <NUM> images from three domains, Amazon, DSLR and Webcam, with <NUM> classes in each domain. All domains in the collection are well-aligned.

The VisDA dataset was developed for the Visual Domain Adaptation Challenge <NUM>, with the main focus on the simulation-to-reality shift. In the image classification task, the goal is to first train a model on simulated, synthetic data in the source domain and then adapt it to perform well on real image data in the unlabeled test domain. The VisDA dataset is currently one of the largest for cross-domain classification, with over <NUM> source and <NUM> target images across <NUM> categories. Specifically, ResNet-<NUM> models are pre-trained on the very large public ImageNet collection and then fine-tuned on a smaller image collection using <NUM> deep convolutional activation features as image representations.

The classification accuracy for the six Office31 domain adaptation tasks was computed. For each task, the average over <NUM> runs was taken with the uniformly distributed CI values, when training LADA-<NUM>, LADA-3U and LADA-3T models. Accuracy curves for the six domain adaptation tasks were averaged and are shown in <FIG>. All three LADA versions perform similarly when CI values are inferior to <NUM>. Their performance is comparable to the state of the art methods. In the class alignment case, they are compared to ADDA and Conditional Domain Adversarial Network (CDAN). In the partial domain adaptation case, they are compared to the weighted ADDA (ADDA10), Selective Adversarial Networks (SAN10) and Partial Adversarial Domain Adaptation (PADA10). When the CI values are close to <NUM>, LADA-U and LADA-T behave on average as good or better than methods specifically developed for the partial domain adaptation. The LADA methods however make no assumption on the absence of some classes; they treat equally cases when the classes are under-represented or absent.

For all methods, performance starts decreasing when the CI values approach <NUM>. LADA-3U and LADA-3T resist better to the class imbalance than the baseline LADA-<NUM>. LADA-T limits the target accuracy drop to <NUM>-<NUM>%. It behaves particularly well when CI is close to <NUM>. Surprisingly, it shows a slightly worse performance for low CI values, compared to the other two models.

<FIG> illustrates the classification accuracy for the VisDa dataset. The VisDA dataset is used to run an ablation study and investigate the different options of LADA training; the evaluation results are shown in <FIG>. LADA-<NUM> to LADA-<NUM> and the baseline are compared. As <FIG> shows,.

LADA-<NUM> does not resist to the severe class imbalance. The difference between LADA-<NUM> and LADA-<NUM> is small but statistically significant. Specifically, LADA-<NUM> does not change the parameters of the source encoder while LADA-<NUM> allows some small modifications. Thus, the three-player training allows to maintain the target accuracy, for the price of performing slightly worse on source samples. By optimizing the source encoder at the second stage, the classifier can benefit from the disentangling of the target domain with the auxiliary network (Q). In other words, in LADA-<NUM>, improvement in the target domain (which is more important) can be obtained for the price of slightly worse performance in the source domain (which is less important because, without the domain adaptation task, the good original source encoder trained in the first training stage is always available).

<FIG> illustrates the KL divergence between the true and estimated target class distributions for different CI values. Here, how good the LADA models are at estimating the (unknown) target class distribution is studied. Given an initial CI value, LADA-U is trained and how the target class estimation p̂t(y) diverges from the true target class distribution pt(y) is measured. Again, the KL divergence is used to measure it, KL(p̂t(y)∥pt(y))(thick solid line). The divergence of pt(y) from the source distribution ps(y) (thin solid line) is also tracked.

<FIG> reports LADA-U performance on the class imbalance reduction, with the starting CI values growing from <NUM> to <NUM> (dashed line). It is able to reduce the divergence between p̂t(y) and pt(y) in most cases. However, there exists an incompressible divergence that none of the models seems to be able to break up.

While some specific embodiments have been described in detail above, it will be apparent to those skilled in the art that various modifications, variations and improvements of the embodiments may be made in the light of the above teachings and within the content of the appended claims without departing from the intended scope of the embodiments. In addition, those areas in which it is believed that those of ordinary skill in the art are familiar have not been described herein in order not to unnecessarily obscure the embodiments described herein. Accordingly, it is to be understood that the embodiments are not to be limited by the specific illustrative embodiments, but only by the scope of the appended claims.

Although the above embodiments have been described in the context of method steps, they also represent a description of a corresponding component, module or feature of a corresponding apparatus or system.

Some or all of the method steps may be implemented by a computer in that they are executed by (or using) a processor, a microprocessor, an electronic circuit or processing circuitry.

The embodiments described above may be implemented in hardware or in software. The implementation can be performed using a non-transitory storage medium such as a computer-readable storage medium, for example a floppy disc, a DVD, a Blu-Ray, a CD, a ROM, a PROM, and EPROM, an EEPROM or a FLASH memory. Such computer-readable media can be any available media that can be accessed by a general-purpose or special-purpose computer system.

Generally, embodiments can be implemented as a computer program product with a program code or computer-executable instructions, the program code or computer-executable instructions being operative for performing one of the methods when the computer program product runs on a computer. The program code or the computer-executable instructions may, for example, be stored on a computer-readable storage medium.

In an embodiment, a storage medium (or a data carrier, or a computer-readable medium) comprises, stored thereon, the computer program or the computer-executable instructions for performing one of the methods described herein when it is performed by a processor. In a further embodiment, an apparatus comprises one or more processors and the storage medium mentioned above.

In a further embodiment, an apparatus comprises means, for example processing circuitry like e.g. a processor communicating with a memory, the means being configured to, or adapted to, perform one of the methods described herein.

A further embodiment comprises a computer having installed thereon the computer program or instructions for performing one of the methods described herein.

The above-mentioned methods and embodiments may be implemented within an architecture such as illustrated in <FIG>, which comprises server <NUM> and one or more client devices <NUM> that communicate over a network <NUM> (which may be wireless and/or wired) such as the Internet for data exchange. Server <NUM> and the client devices <NUM> include a data processor <NUM> and memory <NUM> such as a hard disk. The client devices <NUM> may be any device that communicates with server <NUM>, including autonomous vehicle 102b, robot 102c, computer 102d, or cell phone 102e.

Claim 1:
A computer-implemented method of training a target encoder (Et) for classifying images into one of a plurality of categories using a classifier (C) trained on images (Xs) from a source domain, the method comprising:
generating (420A), by a pre-trained source encoder (Es), a source encoder representation for each image of a labeled set of source images (Xs) from the source domain, wherein the source encoder (ES) is trained along with the classifier (C) on the images (Xs) and their corresponding labels (YS);
generating (420B), by the target encoder (Et), a target encoder representation for each image of an unlabeled set of target images (Xt) from a target domain;
characterized by:
inputting (430A, 430B), into a generative adversarial network (A), 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 (D) of the generative adversarial network (A) is configured to output (<NUM>; <NUM>) 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 (Q) of the generative adversarial network (A) is configured to output (<NUM>; <NUM>) 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 (Et) and the discriminator neural network (D) by repeatedly updating parameters of the target encoder (Et) and the discriminator neural network (D) using respective adversarial loss functions based on the first prediction; and
training the auxiliary neural network (Q) using a loss function based on the second prediction.