Z ERO -S HOT R ECOGNITION THROUGH I MAGE -G UIDED S EMANTIC C LASSIFICATION
Anonymous authors
Paper under double-blind review
A BSTRACT
We present a new visual-semantic embedding method for generalized zero-shot learning.
Existing embedding-based methods aim to learn the correspondence between an image classiﬁer (visual representation) and its class prototype (semantic representation) for each class.
Inspired by the binary relevance method for multilabel classiﬁcation, we learn the mapping between an image and its semantic classiﬁer.
Given an input image, the proposed Image-Guided Semantic Classiﬁcation (IGSC) method creates a label classiﬁer, being applied to all label embeddings to determine whether a label belongs to the input image.
Therefore, a semantic classiﬁer is image conditioned and is generated during inference.
We also show that
IGSC is a unifying framework for two state-of-the-art deep-embedding methods.
We validate our approach with four standard benchmark datasets
I NTRODUCTION
As a feasible solution for addressing the limitations of supervised classiﬁcation methods, zeroshot learning (ZSL) aims to recognize objects whose instances have not been seen during training (Larochelle et al., 2008; Palatucci et al., 2009).
Unseen classes are recognized by associating seen and unseen classes through some form of semantic space ; therefore, the knowledge learned from seen classes is transferred to unseen classes.
In the semantic space, each class has a corresponding vector representation called a class prototype .
Class prototypes can be obtained from human-annotated attributes that describe visual properties of objects (Farhadi et al., 2009; Lampert et al., 2014) or from word embeddings learned in an unsupervised manner from text corpus (Mikolov et al., 2013; Pennington et al., 2014;
Devlin et al., 2018).
A majority of ZSL methods can be viewed using the visual-semantic embedding framework, as displayed in Figure 1 (a).
Images are mapped from the visual space to the semantic space in which all classes reside, or images and labels are projected to a latent space (Yang & Hospedales, 2015; Liu et al., 2018).
Then, the inference is performed in this common space (Akata et al., 2013; Frome et al., 2013; Socher et al., 2013), typically using cosine similarity or Euclidean distance.
Another perspective of embedding-based methods is to construct an image classiﬁer for each unseen class by learning the correspondence between a binary one-versus-rest image classiﬁer (i.e., visual representation of a class) and its class prototype in the semantic space (i.e., semantic representation of a class) (Wang et al., 2019).
Once this correspondence function is learned, a binary one-versus-rest image classiﬁer can be constructed for an unseen class with its prototype (Wang et al., 2019).
For example, a commonly used choice for such correspondence is the bilinear function (Frome et al., 2013;
Akata et al., 2013; 2015; Romera-Paredes & Torr, 2015; Li et al., 2018).
Considerable efforts have been made to extend the linear function to nonlinear ones (Xian et al., 2016;
Wang et al., 2017;
Elhoseiny et al., 2017; Qiao et al., 2016).
Figure 1 (b) illustrates this perspective.
Learning the correspondence between an image classiﬁer and a class prototype has the following drawbacks.
First, the assumption of using a single image classiﬁer for each class is restrictive because the manner for separating classes in both visual and semantic spaces would not be unique.
We argue that semantic classiﬁcation should be conducted dynamically conditioned on an input image.
For example, the visual attribute wheel may be useful for classifying most car images.
Nevertheless, cars with missing wheels should also be correctly recognized using other visual attributes.
Therefore, instance-speciﬁc semantic classiﬁers are more preferable than category-speciﬁc ones because the classiﬁer weights can be adaptively determined based on image content.
Second, the scale of training data for learning the correspondence is constrained to be the number of class labels.
In other words, a training set with C labels has only C visual-semantic classiﬁer pairs to build the correspondence.
This may hinder the robustness of deep models that usually require large-scale training data.
Finally, although class embedding has rich semantic meanings, each class is represented by only a single class prototype to determine where images of that class collapse inevitably (MarcoBaroni, 2016; Fu et al., 2015).
The mapped semantic representations from images may collapse to hubs, which are close to many other points in the semantic space, rather than being similar to the true class label (MarcoBaroni, 2016).
In this paper, we present a new method, named Image-Guided Semantic Classiﬁcation (IGSC), to address these problems.
IGSC aims to learn the correspondence between an image and its corresponding label classiﬁer, as illustrated in Figure 1 (c).
In contrast to existing methods focusing on the learning of visual (or semantic) representations (Zhang et al., 2016; Frome et al., 2013; Socher et al., 2013), IGSC analyzes the input image and seeks for combinations of variables in the semantic space (e.g., combinations of attributes) that distinguish a class (belonging to the input) from other classes.
The proposed IGSC method has the following characteristics:
IGSC learns the correspondence between an image in the visual space and a classiﬁer in the semantic space.
The correspondence can be learned with training pairs in the scale of training images rather than that of classes.
• IGSC performs learning to learn in an end-to-end manner.
Label classiﬁcation is conducted by a semantic classiﬁer whose weights are generated on the ﬂy.
This model is simple yet powerful because of its adaptive nature.
• IGSC uniﬁes visual attribute detection and label classiﬁcation.
This is achieved via the design of a conditional network (the proposed classiﬁer learning method), in which label classiﬁcation is the main task of interest and the conditional input image provides additional information of a speciﬁc situation.
• IGSC alleviates the hubness problem.
The correspondence between an image and a semantic classiﬁer learned from seen classes can be transferred to recognize unseen concepts.
We evaluated IGSC with experiments conducted on four public benchmark datasets, including SUN (Patterson & Hays, 2012), CUB (Patterson & Hays, 2012), AWA2 (Lampert et al., 2014), and aPY (Farhadi et al., 2009).
Experimental results demonstrated that the proposed method achieved promising performance, compared with current state-of-the-art methods.
The remainder of the paper is organized as follows: We brieﬂy review related work in Section 2.
Section 3 presents the proposed framework.
The experimental results and conclusions are provided in Sections 4 and 5, respectively.
R ELATED W ORK
Zero-shot learning has evolved rapidly during the last decade, and therefore documenting the extensive literature with limited pages is rarely possible.
In this section, we review a few representative zero-shot learning methods and refer readers to (Xian et al., 2019a; Wang et al., 2019) for a comprehensive survey.
One pioneering main stream of ZSL uses attributes to infer the label of an image belonging to one of the unseen classes (Lampert et al., 2014;
Al-Halah et al., 2016; Norouzi et al.,
[Table]
The attributes of an image are predicted, then the class label is inferred by searching the class which attains the most similar set of attributes.
For example, the Direct Attribute Prediction (DAP) model (Lampert et al., 2009) estimates the posterior of each attribute for an image by learning probabilistic attribute classiﬁers.
A test sample is then classiﬁed by each attribute classiﬁer alternately, and the class label is predicted by probabilistic estimation.
Similar to the attribute-based methods, the proposed method has the merits of modeling the relationships among classes.
However, IGSC uniﬁes these two steps: attribute classiﬁer learning and inferring from detected attributes to the class.
Furthermore, attribute classiﬁers are jointly learned in IGSC.
A broad family of ZSL methods apply an embedding framework that directly learns a mapping from the visual space to the semantic space (Palatucci et al., 2009; Akata et al., 2013; 2015; RomeraParedes & Torr, 2015).
The visual-to-semantic mapping can be linear (Frome et al., 2013) or nonlinear (Socher et al., 2013).
For example, DeViSE (Frome et al., 2013) learns a linear mapping between the image and semantic spaces using an efﬁcient ranking loss formulation.
Cross-Modal
Transfer (CMT) (Socher et al., 2013) uses a neural network with two hidden layers to learn a nonlinear projection from image feature space to word vector space.
More recently, deep neural network models are proposed to mirror learned semantic relations among classes in the visual domain from the image (Annadani & Biswas, 2018) or from the part (Zhu et al., 2018a) levels.
IGSC is also an embedding-based ZSL method.
IGSC differs signiﬁcantly from existing methods in that IGSC learns the correspondence between an image and its semantic classiﬁer, enabling the possibility of using different classiﬁcation manners to separate class prototypes in the semantic space.
Recent ZSL models adopt the generative adversarial network (GAN) (Goodfellow et al., 2014) or other generative models for synthesizing unseen examples (Bucher et al., 2017; Long et al., 2017;
Jiang et al., 2018; Verma et al., 2018; Xian et al., 2018; Zhu et al., 2018b; Xian et al., 2019b; Verma et al., 2020; Yu et al., 2020; Ma & Hu, 2020) or for reconstructing training images (Chen et al., 2018).
The synthesized images obtained at the training stage can be fed to conventional classiﬁers so that ZSL is converted into the conventional supervised learning problem (Long et al., 2017).
The transformation from attributes to image features require involving generative models such as denoising autoencoders (Bucher et al., 2017), GAN (Xian et al., 2018;
Zhu et al., 2018b) or their variants (Verma et al., 2018; Felix et al., 2018;
Xian et al., 2019b; Yu et al., 2020; Ma & Hu, 2020).
Despite outstanding performances reported in the papers, these works leverage some form of the unseen class information during training.
In view of real-world applications involving recognition in-the-wild, novel classes including the image samples as well as the semantic representations may not be available in model learning.
The proposed method is agnostic to all unseen class information during training.
Furthermore, the proposed method is much simpler in the architecture design and has a much smaller model size, compared with the generative methods.
A PPROACH 3. P ROBLEM D ESCRIPTION
Given a training set S = { ( x n , y n ) , n = 1 . . . N } , with y n ∈ Y s being a class label in the seen class set, the goal of ZSL is to learn a classiﬁer f : X → Y which can generalize to predict any image x to its correct label, which is not only in Y s but also in the unseen class set Y u .
In the prevailing family of compatibility learning ZSL (Xian et al., 2019a; Ba et al., 2015), the prediction is made via:
[Equation]
In particular, if Y = Y u , this is the conventional ZSL setting; if Y = Y s ∪Y u , this is the generalized zero-shot learning (GZSL) setting, which is more practical for real-world applications.
The compatibility function F ( · ) —parameterized by W —is used to associate visual and semantic information.
In the visual space, each image x has a vector representation, denoted by θ ( x ) .
Similarly, each class label y has a vector representation in the semantic space (called the class prototype), denoted by φ ( y ) .
In short, θ ( x ) and φ ( y ) are the image and class embeddings, both of which are given.
3. I MAGE -G UIDED S EMANTIC C LASSIFICATION M ODEL
The compatibility function in this work is achieved by implementing two functions, h ( θ ( x ); W ) and g ( φ ( y ); M ) , as illustrated in Figure 2.
The ﬁrst function h ( · ) receives an image embedding as input and returns parameters M characterizing a label classiﬁer:
[Equation]
In other words, h ( · ) learns the mapping between image representations and model (i.e., semantic classiﬁer) representations.
Each image has its own semantic classiﬁer.
Images of the same class may have different classiﬁer weights.
Different from existing methods where the classiﬁer weights are part of model parameters and thereby being static after training, the classiﬁer weights in IGSC are dynamically generated during test time.
The image-to-classiﬁer mapping can be either linear or nonlinear.
Figure 2 shows an implementation of a nonlinear model that involves two fully connected layers and an output layer.
The dimension of the output layer is set to accommodate the label classiﬁer weights.
We emphasize again that W are the only model parameters required to learn from training data.
The second function g ( · ) is a label classiﬁer, characterized by the parameters outputted by h ( · ) .
This function takes a label vector as input, and returns a prediction score indicating the probability of the label belonging to the input image:
[Equation]
Let s j denote the prediction score for a label j .
In multi-class (single-label) image classiﬁcation, the ﬁnal compatibility score is obtained by normalizing the prediction scores to probabilistic values with softmax:
[Equation]
One image is assigned to the class with the highest compatibility score.
In multi-label image classiﬁcation, we replace softmax by a sigmoid activation function.
The prediction is made by choosing labels whose compatibility score is greater than a threshold.
It is worth noting that the mechanism of IGSC is similar to that of Dynamic Filter Networks (Jia et al., 2016), in which the ﬁlters are generated dynamically conditioned on an input.
A similar mechanism also appears in (Zhao et al., 2018), which predicts a set of adaptive weights from conditional inputs to linearly combine the basis ﬁlters.
The proposed method differs fundamentally in that both (Jia et al., 2016) and (Zhao et al., 2018) focus on learning image representations, while our method aims to learn model representations that are applied to a different modality (i.e., labels).
3. F ORMS OF L ABEL C LASSIFIERS
The image-guided label classiﬁer can be either linear or nonlinear, which receives a label embedding and returns a prediction score of the label.
In this study we experiment with two variations of the label classiﬁer.
The linear label classiﬁer is represented as:
[Equation]
where m ∈ R
d is a weight vector, b is a threshold and M = ( m , b ) .
The dimension d is set to that of the label vector (e.g., d = 300 if using 300-dim word2vec (Mikolov et al., 2013)).
Alternatively, the nonlinear label classiﬁer is implemented using a two-layer neural network:
[Equation]
where M 1 ∈ R h × d , m 2 ∈ R h and M = ( M 1 , b 1 , m 2 , b 2 )
The nonlinear classiﬁer characterizes the d -dim semantic space by using h perceptrons and performs the classiﬁcation task.
As will be shown in Section 4, the nonlinear label classiﬁer outperforms a linear one.
For GZSL, it is beneﬁcial to enable calibrated stacking (Chao et al., 2016), which reduces the scores for seen classes.
This leads to the following modiﬁcation:
[Equation] [Equation]
where 1 [ y ∈ Y s ] ∈ { 0 , 1 } indicates whether or not y is a seen class and γ is a calibration factor.
3. L EARNING M ODEL P ARAMETERS
Recall that the objective of ZSL is to correctly assign the correct label to an image.
This is a typical classiﬁcation problem.
For a training sample x i , Let y i
= { y 1 i , y 2 i , ..., y |Y s | i } ∈ { 0 , 1 } denote the one-hot encoding of the ground truth label and p i
= { p 1 i , p 2 i , ..., p |Y s | i } denote the compatibility scores of x i (Equ. 4).
That is, p ji = F ( x i , y j ; W ) .
The model parameters W are learned by minimizing the cross entropy loss:
[Equation]
The model parameters including W and those of the image/semantic embedding networks can be jointly learned end-to-end; however, the results reported in Section 4 were obtained by freezing the weights of feature extractors for a fair comparison.
That is, all methods under comparison used the same image and semantic representations in the experiments.
3. C ONNECTION TO P REVIOUS M ETHODS
Finally we show how previous supervised visual-semantic embedding methods—DeViSE (Frome et al., 2013) and CMT (Socher et al., 2013)—are special cases of our method.
DeViSE (Frome et al., 2013) uses a projection layer (a linear transformation) that maps a visual vector to the semantic space, and compute a dot-product similarity between the projected visual vector and the vector representation of the correct label.
The behavior is identical to a special case of our method, where both h ( · ) and g ( · ) are linear.
CMT (Socher et al., 2013) uses a neural network with two hidden layers and the standard nonlinearity tanh to learn a nonlinear projection from image feature space to word vector space and compute the Euclidean distances of the L2 normed vectors.
This is identical to the special case of using nonlinear h ( · ) and linear g ( · ) , except that we use ReLU instead of tanh in the nonlinear transformation.
E XPERIMENTS 4. D ATASETS AND E XPERIMENTAL S ETTING
We used four popular benchmark datasets, including coarse-grained and ﬁne-grained datasets, for evaluating the proposed method.
The statistics of the datasets are summarized in Table 1.
Please see (Xian et al., 2019a) for detailed descriptions.
We followed the new split provided by (Xian et al., 2019a) because this split ensured that classes at test should be strictly unseen at training.
[Table]
Visual and semantic embeddings.
For a fair comparison, we used the 2048-dimensional ResNet101 features provided by (Xian et al., 2019a) as image representations.
For label representations, we used the semantic embeddings provided by (Xian et al., 2019a), each of which is an L2-normalized attribute vector.
Note that IGSC is ﬂexible in that the visual and semantic embeddings, h ( · ) and g ( · ) functions can all be customized to meet speciﬁc needs.
Training details.
We used Adaptive Moment Estimation (Adam) for optimizing the model.
We augmented the data by random cropping and mirroring.
The learning rate was set ﬁxed to 10 − 5 .
Training time for a single epoch ranged from 91 seconds to 595 seconds (depending on which dataset was used).
Training the models using four benchmark datasets roughly took 11 hours in total.
The runtime was reported running on a machine with an Intel Core i7-7700 3.6-GHz CPU,
NVIDIA’s GeForce GTX 1080Ti and 32 GB of RAM.
The dimension in the nonlinear variant of the semantic classiﬁer g ( · ) was set to 30 in the experiments.
Evaluation protocols.
We followed the standard evaluation metrics used in the literature.
For
ZSL, we used average per-class top-1 accuracy as the evaluation metric, where the prediction (Eq. 1) is successful if the predicted class is the correct ground truth.
For GZSL, we reported acc s (test images are from seen classes and the prediction labels are the union of seen and unseen classes) and acc u
(test images are from unseen classes and the prediction labels are the union of seen and unseen classes).
We computed the harmonic mean (Xian et al., 2019a) of accuracy rates on seen classes acc s and unseen classes acc u :
[Equation]
The harmonic mean offers a comprehensive metric in evaluating GZSL methods.
The harmonic mean value is high only when both accuracy rates are high.
We reported the average results of three random trials for each ZSL and GZSL experiment.
[Table]
4. A BLATION S TUDY
First, we investigate the effects of different designs of the image-to-classiﬁer mapping function h ( · ) and the label classiﬁer g ( · ) .
We reported the results on the SUN benchmark; however, similar ﬁndings can be found using other datasets.
Table 2 shows the results of the ablation experiment.
In both settings (ZSL and GZSL), using a nonlinear image-to-classiﬁer mapping (i.e., h ( · ) ) is essential to the performance.
A signiﬁcant performance gain was observed when a nonlinear h ( · ) was applied.
The combination of linear h ( · ) and nonlinear g ( · ) performed the worst.
A possible reason is that a linear mapping does not have a sufﬁcient capacity to model the relation between a visual feature and its corresponding semantic classiﬁer, and using a nonlinear g ( · ) exacerbates the overﬁtting problem of learned semantic classiﬁers to seen classes.
While a nonlinear h ( · ) successfully modeled the mapping between a visual
[Table]
All methods are agnostic to both unseen images and unseen semantic vectors training
[Table]
feature and its label classiﬁer, using a nonlinear g ( · ) further improved the recognition performance, especially under the setting of GZSL
[Table]
C OMPARISONS
WITH S TATE - OF - THE - ART A PPROACHES
We compared the IGSC method with a variety of standard and generalized ZSL methods as reported in (Xian et al., 2019a).
These methods can be categorized into 1) attribute-based: DAP
(Lampert et al., 2009), IAP (Lampert et al., 2009), CONSE (Norouzi et al., 2014), SSE (Zhang & Saligrama, 2015), SYNC (Changpinyo et al., 2016); and 2) embedding-based: CMT/CMT* (Socher et al., 2013), LATEM(Xian et al., 2016), ALE(Akata et al., 2013), DeViSE(Frome et al., 2013), SJE(Akata et al., 2015), ESZSL(Romera-Paredes & Torr, 2015), SAE(Kodirov et al., 2017), GFZSL(Verma &
Rai, 2017).
Performances of the methods are directly reported from the paper (Xian et al., 2019a).
Please note that all methods under comparison—including the proposed method—are inductive to both unseen images and unseen semantic vectors .
Only labeled training instances and class prototypes of seen classes are available in this experimental setting.
Alternatively, methods that are transductive for unseen class prototypes and unlabeled unseen test instances can achieve better performances because more information is involved in model learning.
Recent methods in the inductive setting are only inductive to samples (Jiang et al., 2018; Felix et al., 2018; Xian et al., 2019b; Schonfeld et al., 2019; Verma et al., 2020; Yu et al., 2020; Ma & Hu, 2020; Huynh & Elhamifar, 2020).
These methods use unseen class labels during training, which is different to our setting and, therefore, are not compared.
[Table]
We reported the performance the proposed IGSC method with (or without) calibrated stacking (Equ. 7): 1) IGSC uses the nonlinear-nonlinear combination; 2) IGSC+CS enables calibrated stacking.
Table 3 shows the conventional ZSL results.
IGSC has a superior performance to those of other methods on the CUB dataset and achieves comparable performances on the other datasets.
Although
GFZSL (Verma & Rai, 2017) has the best performances on SUN and AWA2, this method performs poorly under the GZSL setting.
Table 4 shows the generalized ZSL results.
In this experiment, recent inductive methods (Chen et al., 2018; Annadani & Biswas, 2018; Xie et al., 2019) are included for comparison.
The semanticspreserving adversarial embedding network (SP-AEN) (Chen et al., 2018) is a GAN-based method, which uses an adversarial objective to reconstruct images from semantic embeddings.
The preserving semantic relations (PSR) method (Annadani & Biswas, 2018) is an embedding-based approach utilizing the structure of the attribute space using a set of relations.
Finally, the attentive region embedding network (AREN) (Xie et al., 2019) uses an attention mechanism to construct the embeddings from the part level (i.e., local regions), which consists of two embedding streams to extract image regions for semantic transfer.
By examining the harmonic mean values, IGSC consistently outperformed other competitive methods on three out of the four datasets.
The performance gain validated the effectiveness of learning image-guided semantic classiﬁers.
Compared with embedding based methods, this novel paradigm not only has more training pairs (in the scale of the training images) for learning the correspondence between an image and its corresponding label classiﬁer but also allows different manners to separate classes based on the content of input image.
In comparison with attribute based methods which take a two-step pipeline to detect attributes from one image and aggregate the detection results for label prediction, IGSC uniﬁes the steps.
Compared with recent methods (Chen et al., 2018; Annadani &
Biswas, 2018; Xie et al., 2019), IGSC is much simpler and therefore has a greater ﬂexibility.
We have not integrated powerful components for GZSL such as generators and attention models, yet it has achieved comparable (or superior) performance to existing sophisticated methods.
An additional reason that explains the improved performance is that the hubness may be alleviated in IGSC, which avoids nearest neighbor searches of class prototypes in the semantic space.
We conducted an experiment to realize whether IGSC reduces hubness.
To measure the degree of hubness, we used the skewness of the empirical N 1 distribution (Radovanovi ´ c et al., 2010; Shigeto et al., 2015).
We conducted this experiment on the SUN benchmark because it is the only dataset containing an equal number of test images per class.
As we hardly found the skewness analyses in recent literature, we implemented DeViSE (Frome et al., 2013) and compare it with the proposed method.
The results are summarized in Table 5.
IGSC produced smaller skewness values.
One possible reason explaining why hubness is alleviated is that the “matching” between a visual representation and a class prototype is more ﬂexible in IGSC than that in nearest neighbor search.
A label is considered correct as long as its embedding is on the right side of the decision surface, learned conditioned on the input image embedding.
[Table]
Res23.
Res-101+CS 39.
Res-152+CS 40.
4. D ISCUSSIONS
In this subsection, we discuss the model ﬂexibility and visualize the classiﬁer weights generated by
IGSC.
Model extendibility.
The proposed IGSC model is ﬂexible in that the visual and semantic embeddings, the h ( · ) and g ( · ) functions can all be customized to meet speciﬁc needs.
We provide a proof of concept analysis, in which we investigate the effect of replacing Res-101 with Res-152.
Table 6 shows the result.
Performance improvements are observed when we use a deeper visual model.
By elaborating other components in IGSC, it seems reasonable to expect this approach should yield even better results.
Model visualization.
Finally, we visualize the “model representations” of the label classiﬁers by using t-SNE (van der Maaten & Hinton, 2008) of the dynamically generated classiﬁer weights.
Figure 3 displays the visualization results using the aPY dataset.
Each point in the ﬁgure represents a label classiﬁer generated on-the-ﬂy by feeding a test image to the IGSC model.
Colors indicate class labels.
Although each image has its own label classiﬁer, the IGSC method tends to generate similar model representations for images of the same class (Fig.
3 (a)).
Please note that this framework allows the learning of a “single” label classiﬁer for each class (class-level classiﬁer), i.e., the model representations for images of the same class are identical.
However, the results show that instancelevel classiﬁers beneﬁt the optimization of recognition accuracy (points are scattered but fall around).
C ONCLUSION
We propose a unifying visual-semantic embedding model that transform an image into a label classiﬁer, consequently used to predict the correct label in the semantic space.
Modeling the correspondence between an image and its label classiﬁer enables a powerful GZSL method that achieves promising performances on four benchmark datasets.
One future research direction we are pursuing is to extend the method for multi-label zero-shot learning, in which images are assigned with multiple labels from an open vocabulary.
This would take full advantage of the semantic space.
Another direction is to explore model learning with a less restricted setting, which can be transductive for speciﬁc unseen classes or test instances