Unsupervised Learning of Visual Representations by Solving Jigsaw Puzzles

03/30/2016 ∙ by Mehdi Noroozi, et al. ∙ Universität Bern 0

In this paper we study the problem of image representation learning without human annotation. By following the principles of self-supervision, we build a convolutional neural network (CNN) that can be trained to solve Jigsaw puzzles as a pretext task, which requires no manual labeling, and then later repurposed to solve object classification and detection. To maintain the compatibility across tasks we introduce the context-free network (CFN), a siamese-ennead CNN. The CFN takes image tiles as input and explicitly limits the receptive field (or context) of its early processing units to one tile at a time. We show that the CFN includes fewer parameters than AlexNet while preserving the same semantic learning capabilities. By training the CFN to solve Jigsaw puzzles, we learn both a feature mapping of object parts as well as their correct spatial arrangement. Our experimental evaluations show that the learned features capture semantically relevant content. Our proposed method for learning visual representations outperforms state of the art methods in several transfer learning benchmarks.



There are no comments yet.


page 2

page 5

page 11

page 14

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Visual tasks, such as object classification and detection, have been successfully approached through the supervised learning paradigm [1, 11, 25, 35]

, where one uses labeled data to train a parametric model. However, as manually labeled data can be costly, unsupervised learning methods are gaining momentum.

Recently, Doersch et al. [10], Wang and Gupta [38] and Agrawal et al. [2] have explored a novel paradigm for unsupervised learning called self-supervised learning. The main idea is to exploit different labelings that are freely available besides or within visual data, and to use them as intrinsic reward signals to learn general-purpose features. [10] uses the relative spatial co-location of patches in images as a label. [38] uses object correspondence obtained through tracking in videos, and [2] uses ego-motion information obtained by a mobile agent such as the Google car [7]. The features obtained with these approaches have been successfully transferred to classification and detections tasks, and their performance is very encouraging when compared to features trained in a supervised manner.

(a) (b) (c)
Figure 1: Learning image representations by solving jigsaw puzzles. (a) The image from which the tiles (marked with green lines) are extracted. (b) A puzzle obtained by shuffling the tiles. Some tiles might be directly identifiable as object parts, but others are ambiguous (e.g., have similar patterns) and their identification is much more reliable when all tiles are jointly evaluated. In contrast, with reference to (c), determining the relative position between the central tile and the top two tiles from the left can be very challenging [10].

A fundamental difference between [10] and [38, 2] is that the former method uses single images as the training set and the other two methods exploit multiple images related either through a temporal or a viewpoint transformation. While it is true that biological agents typically make use of multiple images and also integrate additional sensory information, such as ego-motion, it is also true that single snapshots may carry more information than we have been able to extract so far. This work shows that this is indeed the case. We introduce a novel self-supervised task, the Jigsaw puzzle reassembly problem (see Fig. 1), which builds features that yield high performance when transferred to detection and classification tasks.

We argue that solving Jigsaw puzzles can be used to teach a system that an object is made of parts and what these parts are. The association of each separate puzze tile to a precise object part might be ambiguous. However, when all the tiles are observed, the ambiguities might be eliminated more easily because the tile placement is mutually exclusive. This argument is supported by our experimental validation. Training a Jigsaw puzzle solver takes about days compared to weeks of [10]. Also, there is no need to handle chromatic aberration or to build robustness to pixelation. Moreover, the features are highly transferrable to detection and classification and yield the highest performance to date for an unsupervised method. In object classification these features lead to the best accuracy () when compared to other existing features trained via self-supervised learning on the ILSRV 2012 dataset. Moreover, these features used as pre-training in the Fast R-CNN pipeline [16] achieve mAP for detection and for classification on PASCAL VOC 2007. This performance is close to that obtained in the supervised case by AlexNet [25] ( mAP for detection and in classification).

2 Related work

This work falls in the area of representation/feature learning, which is an unsupervised learning problem [3]

. Representation learning is concerned with building intermediate representations of data useful to solve machine learning tasks. It also involves

transfer learning [40], as one applies and repurposes features that have been learned by solving the Jigsaw puzzle to other tasks such as object classification and detection. In our experiments we do so via the pre-training + fine-tuning scheme, as in prior work [2]. Pre-training corresponds to the feature learning that we obtain with our Jigsaw puzzle solver. Fine-tuning is instead the process of updating the weights obtained during pre-training to solve another task (object classification or detection).

Unsupervised Learning.

There is a rich literature in unsupervised learning of visual representations [5]. Most techniques build representations by exploiting general-purpose priors such as smoothness, sharing of factors, factors organized hierarchically, belonging to a low-dimension manifold, temporal and spatial coherence, and sparsity. Unfortunately, a general criterion to design a visual representation is not available. Nonetheless, a natural choice is the goal of disentangling factors of variation. For example, several factors such as the object shapes, the object materials, and the light sources, combine to create complex effects such as shadows, shading, color patterns and reflections in images. Ideal features would separate each of these factors so that other learning tasks (e.g., classification based on just shape or surface materials) can be handled more easily. In this work we design features to separate the appearance from the arrangement (geometry) of parts of objects.

Because of the relevance to contemporary research and to this work, we discuss mainly methods in deep learning. In general one can group unsupervised learning methods into: probabilistic, direct mapping (autoencoders), and manifold learning ones. Probabilistic methods divide variables of a network into observed and latent ones. Learning is then associated with determining model parameters that maximize the likelihood of the latent variables given the observations. A family of popular probabilistic models is the

Restricted Boltzmann Machine (RBM) [36, 18], which makes training tractable by imposing a bipartite graph between latent and observed variables. Unfortunately, these models become intractable when multiple layers are present and are not designed to produce features in an efficient manner. The direct mapping approach focuses on the latter aspect and is typically built via autoencoders [6, 19, 28]

. Autoencoders specify explicitly the feature extraction function (encoder) in a parametric form as well as the mapping from the feature back to the input (decoder). These direct mappings are trained by minimizing the reconstruction error between the input and the output produced by the autoencoder (obtained by applying the encoder and decoder sequentially). A remarkable example of a very large scale autoencoder is the work of Le

et al. [26]. Their results showed that robust human and cat faces as well as human body detectors could be built without human labeling.

If the data structure suggests that data points might concentrate around a manifold, then manifold learning techniques can be employed [33, 4]. This representation allows to map directly smooth variations of the factors to smooth variations of the observations. Some of the issues with manifold learning techniques are that they might require computing nearest neighbors (which scales quadratically with the number of samples) and that they need a sufficiently high density of samples around the manifold (and this becomes more difficult to achieve with high-dimensional manifolds).

In the context of Computer Vision, it is worth mentioning some early work on unsupervised learning of models for classification. For instance

[13, 39] introduced methods to build a probabilistic representation of objects as constellations of parts. A limitation is the high computational complexity of these models. As we will see later, training the Jigsaw puzzle solver also amounts to building a model of both appearance and configuration of the parts.

Self-supervised Learning.

This learning strategy is a recent variation on the unsupervised learning theme that exploits labeling that comes for “free” with the data [10, 38, 2]. We make a distinction between labels that are easily accessible and are associated with a non-visual signal (for example, ego-motion [2], but also one could consider audio, text and so on), and labels that are obtained from the structure of the data [10, 38]. Our work relates to the latter case as we simply re-use the input images and exploit the pixel arrangement as a label.

Doersch et al. [10]

train a convolutional network to classify the relative position between two image patches. One tile is kept in the middle of a

grid and the other tile can be placed in any of the other available locations (up to some small random shift). In Fig. 1 (c) we show an example where the relative location between the central tile and the top-left and top-middle tiles is ambiguous. In contrast, the Jigsaw puzzle problem is solved by observing all the tiles at the same time. This allows the trained network to intersect all ambiguity sets and possibly reduce them to a singleton.

The method of Wang and Gupta [38] builds a metric to define similarity between patches. Three patches are used as input, where two patches are matched via tracking in a video and the third one is arbitrarily chosen. The main advantage of this method is that labeling requires just using a tracking method (they use SURF interest points to detect initial bounding boxes and then tracking via the KCF method [17]

). The matched patches will have intraclass variability due to changes in illumination, occlusion, viewpoint, pose, occlusions, and clutter factors. However, because the underlying object is the same, the estimated features may not necessarily cluster patches with two different instances of the same object (

i.e., based on their semantic content). The method proposed by Agrawal et al. [2] exploits labeling (egomotion) provided by other sensors. The advantage is that this labeling is freely available in most cases or is quite easy to obtain. They show that egomotion is a useful supervisory signal when learning features. They train a siamese network to estimate egomotion from two image frames and compare it to the egomotion measured with odometry sensors. The trained features will build an invariance similar to that of [38]. However, because the object identity is the same in both images, the intraclass variability may be limited. With two images of the same instance, learned features focus on their similarities (such as color and texture) rather than their high-level structure. In contrast, the Jigsaw puzzle approach ignores similarities between tiles (such as color and texture), as they do not help their localization, and focuses instead on their differences. In Fig. 2 we illustrate this concept with two examples: Two cars that have different colors and two dogs with different fur patterns. The features learned to solve puzzles in one (car/dog) image will apply also to the other (car/dog) image as they will be invariant to shared patterns. The ability of the Jigsaw puzzle solver to cluster together object parts can be seen in the top 16 activations shown in Fig. 4

and in the image retrieval samples in Fig. 


Figure 2: Most of the shape of these pairs of images is the same (two separate instances within the same categories). However, some low-level statistics are different (color and texture). The Jigsaw puzzle solver learns to ignore such statistics when they do not help the localization of parts.

Jigsaw Puzzles.

Jigsaw puzzles have been associated with learning since their inception. They were introduced in 1760 by John Spilsbury as a pretext to help children learn geography. The first puzzle was a map attached to a wooden board, which was then sawed in pieces corresponding to countries [37]. Studies in Psychonomic show that Jigsaw puzzles can be used to assess visuospatial processing in humans [32]. Indeed, the Hooper Visual Organization Test [20] is routinely used to measures an individual’s ability to organize visual stimuli. This test uses puzzles with line drawings of simple objects and requires the patient to recognize the object without moving the tiles. Instead of using Jigsaw puzzles to assess someone’s visuospatial processing ability, in this paper we propose to use Jigsaw puzzles to develop a visuospatial representation of objects in the context of CNNs.

There is also a sizeable literature on solving Jigsaw puzzles computationally (see, for example, [31, 14, 30]). However, these methods rely on the shape of the tiles or on texture especially in the proximity of the borders of the tiles. These are cues that we avoid when training the Jigsaw puzzle solver, as they do not carry useful information when learning a part detector.

Recently, a new data initialization technique for training convolutional neural networks by Krähenbühl et al. [24] has been applied to [10, 38, 2] with a remarkable increase in performance for object detection on PASCAL VOC 2007. The performance of the method of Doersch et al. [10] gains considerably with this data initialization method, and goes from mAP to mAP, which however is still below our mAP performance. Moreover, our training time is quite low: [10] takes weeks while our method takes only days (for completeness, [38] takes week and [2] takes hours).

3 Solving Jigsaw Puzzles

At the present time, the design of convolutional neural networks (CNN) is still an art that relies on extensive experience. Here we provide a brief discussion of how we arrived at a convolutional architecture capable of solving Jigsaw puzzles while learning general-purpose features.

An immediate approach to solve Jigsaw puzzles is to stack the tiles of the puzzle along the channels (i.e., the input data would have channels) and then correspondingly increase the depth of the filters of the first convolutional layer in AlexNet [25]. The problem with this design is that the network prefers to identify correlations between low-level texture statistics across tiles rather than between the high-level statistics. Low-level statistics, such as similar structural patterns and texture close to the boundaries of the tile, are simple cues that humans actually use to solve Jigsaw puzzles. However, solving a Jigsaw puzzle based on these cues does not require any understanding of the global object. Thus, here we present a network that delays the computation of statistics across different tiles (see Fig. 3). The network first computes features based only on the pixels within each tile (one row in Fig. 3). Then, it finds the parts arrangement just by using these features (last fully connected layers in Fig. 3). The objective is to force the network to learn features that are as representative and discriminative as possible of each object part for the purpose of determining their relative location.

3.1 The Context-Free Architecture

Figure 3: Context Free Network. The figure illustrates how a puzzle is generated and solved. We randomly crop a pixel window from image (red dashed box), divide it into a grid, and randomly pick a pixel tiles from each

pixel cell. These 9 tiles are reordered via a randomly chosen permutation from a predefined permutation set and are then fed to the CFN. The task is to predict the index of the chosen permutation (technically, we define as output a probability vector with

at the -th location and

elsewhere). CFN is a siamese-ennead CNN. For simplicity, we do not indicate the max-pooling and ReLU layers. These shared layers are implemented exactly as in AlexNet


. The only difference is that we set the stride of the first layer to

instead of .

We build a siamese-ennead convolutional network (see Fig. 3) where each row up to the first fully connected layer (fc6) uses the AlexNet architecture [25] with shared weights. Similar schemes were used in prior work [10, 38, 2]. The outputs of all fc6 layers are concatenated and given as input to . All the layers in the rows share the same weights up to and including fc6.

We call this architecture the context-free network

(CFN) because the data flow of each patch is explicitly separated until the fully connected layer and context is handled only in the last fully connected layers. We verify that this architecture performs as well as AlexNet in the classification task on the ImageNet 2012 dataset

[8]. In this test we resize the input images to pixels, split them into a grid and then feed the full tiles to the network. We find that the CFN achieves top-1 accuracy while AlexNet achieves top-1 accuracy (see Table 2). However, the CFN architecture is more compact than AlexNet. It depends on only M parameters, while AlexNet uses M parameters. The fc6 layer includes M parameters while the fc6 layer of AlexNet includes M parameters. However, the fc7 layer in our architecture includes M parameters more than the same layer in AlexNet.

This network can thus be used interchangeably for different tasks including detection and classification. In the next section we show how to train the CFN for the Jigsaw puzzle reassembly.

3.2 The Jigsaw Puzzle Task

To train the CFN we define a set of Jigsaw puzzle permutations, e.g., a tile configuration , and assign an index to each entry. We randomly pick one such permutation, rearrange the input patches according to that permutation, and ask the CFN to return a vector with the probability value for each index. Given tiles, there are possible permutations. While these are manageable with current computing capabilities, it turns out that it is not necessary to consider the whole space of permutations. We use only a subset of permutations and select them based on their Hamming distance (i.e., the number of different tile locations between permutations and divided by ). From our experimental validation, we can see that the average Hamming distance between permutations controls the difficulty of the Jigsaw puzzle reassembly task, and it also correlates with the object detection performance. We find that as the average Hamming distance increases, the CFN yields lower Jigsaw puzzle solving errors and lower object detection errors with fine-tuning. In the Experiments section we compare the performance on object detection of CFNs trained with choices for the Hamming distance: minimal, average and maximal (see Table 4). From those tests we can see that large Hamming distances are desirable.

We generate this permutation set iteratively via a greedy algorithm. We begin with an empty permutation set and at each iteration select the one that has the desired Hamming distance to the current permutation set. Algorithm 1 provides more details about the algorithm. For the minimal and middle case, the function at line is replaced by and uniform sampling respectively. Note that the permutation set is generated before training.


Algorithm 1. Generation of the maximal Hamming distance permutation set
1: all permutations is a matrix
3: uniform sample out of permutations
5: repeat
6: add permutation to
7: remove from
8: is an matrix
9: is a row vector
10: denotes the -th entry of
12: until

3.3 Training the CFN

The output of the CFN can be seen as the conditional probability density function (pdf) of the spatial arrangement of object parts (or scene parts) in a part-based model,



where is the configuration of the tiles, is the -th part appearance of the object, and form the intermediate feature representation. Our objective is to train the CFN so that the features have semantic attributes that can identify the relative position between parts.

Given the limited amount of data that we can use to build an approximation of this very high-dimensional pdf, close attention must be paid to the training strategy. One problem is when the CFN learns to associate each appearance to an absolute position. In this case, the features would carry no semantic meaning, but just information to an arbitrary 2D position. This problem could happen if we generate just Jigsaw puzzle per image. Then, the CFN could learn to cluster patches only based on their absolute position in the puzzle, and not on their textural/structural content. If we write the configuration as a list of tile positions then in this case the conditional pdf would factorize into independent terms


where each tile location is fully determined by the corresponding feature . The CFN would not have learned the correlation between different tiles.

To avoid these issues we feed multiple Jigsaw puzzles of the same image to the CFN (an average of out of possible puzzle configurations) and make sure that the tiles are shuffled as much as possible by choosing configurations with sufficiently large average Hamming distance. In this way the same tile would have to be assigned to multiple positions (possibly all ) thus making the mapping of features to any absolute position equally likely.

As previously mentioned earlier on, we also leave a random gap between the tiles to discourage the CFN from learning low-level statistics. This was also done in [10]. During training we resize each input image until either the height or the width matches pixels and preserve the original aspect ratio. Then, we crop a random region from the resized image of size and split it into a grid of pixels tiles. We then extract a region from each tile by introducing random shifts and feed them to the network. Thus, we have an average gap of pixels between the tiles. However, the gaps may range from a minimum of pixels to a maximum of pixels.

No color dropping or filling image channels with noise was needed. We used Caffe

[23] and modified the code to choose random image patches and permutations during the training time. This allowed us to keep the dataset small (M images from ImageNet) and the training efficient, while the CFN could see an average of different puzzles per image (that is about M different Jigsaw puzzles).

3.4 Implementation Details

We use stochastic gradient descent without batch normalization

[21] on one Titan X GPU. The training uses M color images of pixels and mini-batches with a batch size of images. The images are resized by preserving the aspect ratio until either the height or the width matches pixels. Then the other dimension is cropped to pixels. The training converges after K iterations with a basic learning rate of and takes hours in total ( days). If we take as the best possible performance ratio between the Titan X and the Tesla K40 (used for [10]) we can predict that the CFN would have taken hours ( days) on a Tesla K40. We compute that on average each image is used times. That is, we solve on average Jigsaw puzzles per image.

3.5 CFN filter activations

Some recent work has devoted efforts towards the visualization of CNNs to better understand how they work and how we can exploit them [41, 34, 27, 22]. Some of these works and also Google Inceptionism111See http://googleresearch.blogspot.co.uk/2015/06/
aim at obtaining the input image that best represents a category according to a given neural network. This has shown that CNNs retain important information about the categories. Here instead we analyze the CFN by considering the units at each layer as object part detectors as in [15]. We extract M patches from the ImageNet validation set ( randomly sampled patches) and feed them as input to the CFN. At each layer (conv1, conv2, conv3, conv4, conv5) we consider the outputs of one channel and compute their norm. We then rank the patches based on the norm and select the top ones that belong to different images. Since each layer has several channels, we hand-pick the most significant ones. In Fig. 4 we show the top-16 activation patches for only channels per layer. These activations show that the CFN features correspond to patterns sharing similar shapes and that there is a good correspondence based on object parts (in particular see the conv4 activations for dog parts). Some channels seem to be good face detectors (see conv3, but the same detectors can be seen in other channels, not shown, in conv4 and conv5) and others seem to be good texture detectors (e.g., grass, water, fur). In Fig. 4(f) we also show the filters of the conv1 layer of the CFN. We can see that these filters are quite strong and our transfer learning experiments in the next sections show that they are as effective as those trained in a supervised manner.

(a) conv1 activations
(b) conv2 activations
(c) conv3 activations
(d) conv4 activations
(e) conv5 activations
(f) conv1 filters
Figure 4: Visualization of the top activations for units of the conv1, conv2, conv3, conv4, conv5 layers in our CFN. (f) we show the filters of conv1, which look quite strong. The selection of the top activations is identical to the visualization method of Girshick et al. [15], except that we compute the average response rather than the maximum. We show some of the most significant units. We can see that in the first (a) and second (b) layers the filters specialize on different types of textures. On the third layer (c) the filters become more specialized and we have a first face detector (later layers will also have face detectors in some units) and some part detectors (e.g., the bottom corner of the butterflies wing). On the fourth layer (d) we have already quite a number of part detectors. We purposefully choose all the dog part detectors: head top, head center, neck, back legs, and front legs. Notice the intraclass variation of the parts. Lastly, the fifth convolutional layer (e) has some other part detectors and some scene part detectors.

4 Experiments

We evaluate our learned features by using transfer learning [40] on the object classification task on ImageNet and as pre-trained weights for classification and detection tasks on PASCAL VOC 2007 [12]. We also perform a novel experiment to understand whether semantic classification is useful to solve Jigsaw puzzles, and thus to see how much object classification and Jigsaw puzzle reassembly tasks are related. We take the pre-trained AlexNet and transfer its features to solve Jigsaw puzzles. We also use the same locking scheme to see the transferability of features at different layers. The performance is shown in Table 1. Compared to the maximum accuracy of the CFN, , we can see that semantic training is quite helpful towards recognizing object parts. Indeed, the performance is very high up to conv4.

conv1 conv2 conv3 conv4 conv5
AlexNet [25] 88 87 86 83 74
Table 1: Transfer learning of AlexNet from a classification task to the Jigsaw puzzle reassembly problem. The -th column indicates that all layers from conv1 to conv- were locked and all subsequent layers were randomly initialized and retrained. Notice how the first layers provide very good features for solving puzzles. This shows that object classification and the Jigsaw puzzle problems are related.

Finally, we also compare the CFN features with those of [10, 38] both qualitatively and quantitatively on image retrieval.

4.1 ImageNet Classification

Yosinski et al. [40] have shown that the last layers of AlexNet are specific to the task and dataset used for training, while the first layers are general-purpose. In the context of transfer learning, this transition from general-purpose to task-specific determines where in the network one should extract the features. In this section we try to understand where this transition occurs in the CFN. We repurpose the CFN, [10], and [38] to the classification task on the ImageNet 2012 dataset [8] and Table 2 summarizes the results. The analysis consists of training each network with the labeled data from ImageNet 2012 by locking a subset of the layers and by initializing the unlocked layers with random values. If we train AlexNet we obtain the reference maximum accuracy of . Our method achieves when only fully connected layers are trained, which is higher than the next best performing algorithm [10]. There is a significant improvement (from to ) when the conv5 layer is also trained. This shows that the conv5 layer starts to be specialized in the Jigsaw puzzle reassembly task.

conv1 conv2 conv3 conv4 conv5
CFN 57.1 56.0 52.4 48.3 38.1
Doersch et al. [10] 53.1 47.6 48.7 45.6 30.4
Wang and Gupta [38] 51.8 46.9 42.8 38.8 29.8
Random 48.5 41.0 34.8 27.1 12.0
Table 2: Comparison of classification results on ImageNet LSVRC 2012 [9].

4.2 Pascal VOC 2007 Classification and Detection

We use the CFN features for object detection,with Fast R-CNN [16], and classification tasks on PASCAL VOC 2007. For both tasks we use the same baseline used by Krähenbühl et al. [24]. Because our fully connected layers are different from those used in Fast R-CNN, we select one row of the CFN (up to conv5), copy only the weights of the convolutional layers, and fill the fully connected layers with Gaussian random weights with mean

and standard deviation

. The results are summarized in Table 3.

We evaluate the impact of different configurations on detection task in Table 4. We consider two cases for the CFN pre-trained with the Jigsaw puzzle task: one based on a tile grid (denoted CFN-4) and one based on a tile grid (denoted CFN-9). The average performance shows that CFN-9 learns better features. We also analyze the impact of the average Hamming distance between permutations on the detection task. We generate cases for the average Hamming distance: (CFN-9(min)), (CFN-9(middle)), and (CFN-9(max)). As shown in Table 4 the feature map extracted from CFN-9(max) is the best performing one. We also use as a reference the CFN pre-trained on ImageNet with labels and call it CFN-Sup in Table 4. This test is done only to show the full potential of the network when trained in a supervised manner for classification. Indeed, we get mAP for detection which is almost the same as that of AlexNet ( mAP). CFN-9(max) features achieve mAP in detection, and in classification, thus outperforming all other methods and closing the gap with features obtained with supervision.

max width= Method Pretraining time Supervision Classification Detection Krizhevskyet al. [25] 3 days 1000 class labels 78.2% 56.8% Wang and Gupta[38] 1 week motion 58.4% 44.0% Doersch et al. [10] 4 weeks context 55.3% 46.6% Pathak et al. [29] 14 hours context 56.5% 44.5% CFN-9(max) 2.5 days context 68.6% 51.8%

Table 3: Results on PASCAL VOC 2007 Detection and Classification. The results of the other methods are taken from Pathak et al. [29].
CFN-4 CFN-9(min) CFN-9(middle) CFN-9(max) CFN-sup
49.8% 51.0% 51.2% 51.8% 56.3%

Table 4: Object detection results on Pascal VOC 2007 for different configurations of the CFN. We compare the grid (trained on all permutations) and grid with different average Hamming distances. We can see that the grid achieves better results. Moreover, the average Hamming distance between permutations has a direct impact on the performance of the learned features.

4.3 Image Retrieval

We also evaluate the features qualitatively (see Fig. 5) and quantitatively (see Fig. 6) for image retrieval with a simple image ranking.

We find the nearest neighbors (NN) of pool5 features using the bounding boxes of the PASCAL VOC 2007 test set as query and bounding boxes of the trainval set as the retrieval entries. We discard bounding boxes with fewer than K pixels inside. In Fig. 5 we show some examples of image retrievals (top-4) obtained by ranking the images based on the inner product between normalized features of a query image and normalized features of the retrieval set. We can see that the features of the CFN are very sensitive to objects with similar shape and often these are within the same category. In Fig. 6 we compare CFN with the pre-trained AlexNet, [10], [38], and AlexNet with random weights. The precision-recall plots show that [10] and CFN features perform equally well. However, the real potential of CFN features is demonstrated when the feature metric is learned. In Table 2 we can see how CFN features surpass other features trained in an unsupervised way by a good margin. In that test the dataset (ImageNet) is more challenging because there are more categories and the bounding box is not used.

Figure 5: Image retrieval (qualitative evaluation). (a) query images; (b) top-4 matches with AlexNet; (c) top-4 matches with the CFN; (d) top-4 matches with Doersch et al. [10]; (e) top-4 matches with Wang and Gupta [38]; (f) top-4 matches with AlexNet with random weights.
Figure 6: Image retrieval (quantitative evaluation). We compare the precision-recall for image retrieval on the PASCAL VOC 2007. The ranking of the retrieved images is based on the inner products between normalized features extracted from a pre-trained AlexNet, the CFN, Doersch et al. [10], Wang and Gupta [38] and from AlexNet with random weights. The performance of CFN and [10] are very similar when using this simple ranking metric. When the metric is instead learned with two fully connected layers, then we see that CFN features yield a clearly higher performance than all other features from self-supervised learning methods (see Table 2).

5 Conclusions

We have introduced the context-free network (CFN), a CNN whose features can be easily transferred between detection/classification and Jigsaw puzzle reassembly tasks. The network is trained in an unsupervised manner by using the Jigsaw puzzle as a pretext task. We have built a training scheme that generates, on average, puzzles for M images and converges in only days. The key idea is that by solving Jigsaw puzzles the CFN learns to identify each tile as an object part and how parts are assembled in an object. The learned features are evaluated on both classification and detection and the experiments show that we outperform the previous state of the art. More importantly, the performance of these features is closing the gap with those learned in a supervised manner. We believe that there is a lot of untapped potential in self-supervised learning and in the future it will provide a valid alternative to costly human annotation.

6 Acknowledgements

We thank Philipp Krähenbühl for his assistance with the experiments on Pascal VOC 2007 and for kindly evaluating our CFN weights on his configuration for classification with Pascal VOC 2007.


  • [1] Agrawal, P., Girshick, R., Malik, J.: Analyzing the performance of multilayer neural networks for object recognition. ECCV (2014)
  • [2] Agrawal, P., Carreira, J., Malik, J.: Learning to see by moving. ICCV (2015)
  • [3] Barlow, H.B.: Unsupervised learning. Neural Computation (1989)
  • [4] Belkin, M., Niyogi, P.: Laplacian eigenmaps for dimensionality reduction and data representation. Neural Computation (2003)
  • [5] Bengio, Y., Courville, A., Vincent, P.: Representation learning: A review and new perspectives. PAMI (2013)
  • [6]

    Boulard, H., Kamp, Y.: Auto-association by multilayer perceptrons and singular value decomposition. Biological Cybernetics (1988)

  • [7] Chen, D.M., Baatz, G., Koser, K., Tsai, S.S., Vedantham, R., Pylvanainen, T., Roimela, K., Chen, X., Bach, J., Pollefeys, M., Girod, B., Grzeszczuk, R.: City-scale landmark identification on mobile devices. CVPR (2011)
  • [8] Deng, J., Dong, W., Socher, R., Li, L.J., Li, K., Fei-Fei, L.: Imagenet: A large-scale hierarchical image database. CVPR (2009)
  • [9] Deng, J., Dong, W., Socher, R., Li, L.J., Li, K., , Fei-Fei, L.: Imagenet: A large-scale hierarchical image database. CVPR (2009)
  • [10] Doersch, C., Gupta, A., Efros, A.A.: Unsupervised visual representation learning by context prediction. ICCV (2015)
  • [11] Donahue, J., Jia, Y., Vinyals, O., Hoffman, J., Zhang, N., Tzeng, E., Darrell, T.: Decaf: A deep convolutional activation feature for generic visual recognition. ICML (2014)
  • [12] Everingham, M., Eslami, S.M.A., Gool, L.V., Williams, C.K.I., Winn, J., Zisserman, A.: The pascal visual object classes challenge: A retrospective. IJCV (2014)
  • [13] Fergus, R., Perona, P., Zisserman, A.: Object class recognition by unsupervised scale-invariant learning. CVPR (2003)
  • [14]

    Freeman, H., Garder, L.: Apictorial jigsaw puzzles: The computer solution of a problem in pattern recognition. IEEE Transactions on Electronic Computers (1964)

  • [15] Girshick, R., Donahue, J., Darrell, T., Malik, J.: Rich feature hierarchies for accurate object detection and semantic segmentation. CVPR (2014)
  • [16] Girshick, R.: Fast r-cnn. ICCV (2015)
  • [17] Henriques, J.F., Caseiro, R., Martins, P., Batista, J.: High-speed tracking with kernelized correlation filters. PAMI (2015)
  • [18] Hinton, G.E., Sejnowski, T.J.: Learning and relearning in boltzmann machines. Parallel Distributed Processing: Explorations in the Microstructure of Cognition, Vol. 1 (1986)
  • [19] Hinton, G.E., Zemel, R.S.: Autoencoders, minimum description length and helmholtz free energy. NIPS (1993)
  • [20] Hooper, H.: The Hooper Visual Organization Test. Western Psychological Services, Los Angeles, CA (1983)
  • [21] Ioffe, S., Szegedy, C.: Batch normalization: Accelerating deep network training by reducing internal covariate shift. ICML (2015)
  • [22] Jason, Y., Jeff, C., Anh, N., Thomas, F., Hod, L.: Understanding neural networks through deep visualization. Deep Learning Workshop, ICML (2015)
  • [23] Jia, Y., Shelhamer, E., Donahue, J., Karayev, S., Long, J., Girshick, R., Guadarrama, S., Darrell, T.: Caffe: Convolutional architecture for fast feature embedding. ACM-MM (2014)
  • [24] Krähenbühl, P., Doersch, C., Donahue, J., Darrell, T.: Data-dependent initializations of convolutional neural networks. ICLR (2016)
  • [25] Krizhevsky, A., Sutskever, I., Hinton, G.E.: Imagenet classification with deep convolutional neural networks. NIPS (2012)
  • [26] Le, Q., Ranzato, M., Monga, R., Devin, M., Chen, K., Corrado, G., Dean, J., Ng, A.: Building high-level features using large scale unsupervised learning. ICML (2012)
  • [27] Mahendran, A., Vedaldi, A.: Understanding deep image representations by inverting them. CVPR (2015)
  • [28] Olshausen, B.A., Field, D.J.: ”sparse coding with an overcomplete basis set: A strategy employed by v1? ”. Vision Research (1997)
  • [29] Pathak, D., Krähenbühl, P., Donahue, J., Darrell, T., Efros, A.A.: Context encoders: Feature learning by inpainting. CVPR (2016)
  • [30] Pomeranz, D., Shemesh, M., Ben-Shahar, O.: A fully automated greedy square jigsaw puzzle solver. CVPR (2011)
  • [31] Pomeranz, D.: Solving the square jigsaw problem. Ph.D. thesis, Ben-Gurion University of the Negev (2012)
  • [32] Richardson, J., Vecchi, T.: A jigsaw-puzzle imagery task for assessing active visuospatial processes in old and young people. Behavior Research Methods, Instruments, & Computers (2002)
  • [33] Roweis, S.T., Saul, L.K.: Nonlinear dimensionality reduction by locally linear embedding. Science (2000)
  • [34] Simonyan, K., Vedaldi, A., Zisserman, A.: Deep inside convolutional networks: Visualising image classification models and saliency maps. ICLR (2014)
  • [35] Simonyan, K., Zisserman, A.: Two-stream convolutional networks for action recognition in videos. NIPS (2014)
  • [36] Smolensky, P.: Information processing in dynamical systems: Foundations of harmony theory. Parallel Distributed Processing (1986)
  • [37] Tybon, R.: Generating Solutions to the Jigsaw Puzzle Problem. Ph.D. thesis, Griffith University (2004)
  • [38] Wang, X., Gupta, A.: Unsupervised learning of visual representations using videos. ICCV (2015)
  • [39] Weber, M., Weilling, M., Perona, P.: Unsupervised learning of models for recognition. ECCV (2000)
  • [40] Yosinski, J., Clune, J., Bengio, Y., Lipson, H.: How transferable are features in deep neural networks? NIPS (2014)
  • [41] Zeiler, M.D., Fergus, R.: Visualizing and understanding convolutional networks. ECCV (2014)