1. Home
  2. Explore
  3. Computer Science
  4. Self-Supervised Learning

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Self-Supervised Learning

Transcript

- Lecture seven of Deep Unsupervised Learning. Today we'll be talking about Self-Supervised Learning and it is going to be pretty different from the previous lectures we've had so far. So far you've been looking at a lot of generative models how to use various classes of generative models to generate high dimensional data like images, audio text and so forth, however, unsupervised learning is a much broader goal than just being able to generate data and one of the goals of unsupervised learning

is to be able to learn rich features from raw unlabeled data such that they can be useful for a lot of downstream tasks. And this lecture is gonna get at that and recently people have started calling this self-supervised learning where the data creates its own supervision and so we are gonna look at all the various classes of techniques that allow us to do self-supervised learning.

So, so far we've seen density modeling where we've covered Autoregressive models, flow models and we also talked about variational inference and we've also looked at implicit generative models like GANs and energy based models and both these classes of techniques allow you to learn generative models, which is you are gonna be able to generate images and be able to report (mumbles) scores and so on. But other than that, we mainly looked at applications of generative models to various modalities of data and we haven't actually seen how to use unsupervised learning to learn features.

So that's the motivation for today's lecture. How do we learn rich and useful features from raw unlabeled data, such that it can be useful for a wide variety of downstream tasks and we're also gonna ask ourselves the question of what are these various pretexts or proxy tasks that can be used to learn representations from raw unlabeled data and if we are able to learn good representations. How can we leverage that and improve the data efficiency and performance of downstream tasks with a good pre-training model.

So here is a figure from, in Goodfellow's "Deep Learning" textbook. The focus here is how do we learn good representations and here's a simple case study of why representations matter. See you have a bunch of points, two-dimensional and if you visualize this as an XY coordinate the Cartesian coordinate they're clearly two separate clusters but it's harder to visualize how to linearly separate them. But the moment you visualize them in the polar coordinates you can clearly say that there are two different radii and a lot of different angles. And so you can draw linearly separable hyperplane between them. So it's clear that representation matters so once you move from the Cartesian representation to polar coordinate representation things become a lot easier to handle.

You know, you can actually use this linear SVM so logistic regression to learn a classifier on this particular polar coordinate representation. So what is deep learning doing? Deep learning is basically using depth and repeated computation to iteratingly refine the features as you move there, by there, by there over. So the bottom most there is using the raw pixels as input and here it's trying to make sense that there is a person in the photograph and, you know, it's looking at all the background pixels and understanding that there is a face. So the way it starts, it starts with the highest frequency information at the bottom

and it refines at the next level to edges and it refines the next level to corners and contours and then the next level to actual object parts and finally it's able to figure out the identity of the objects present in the actual image. So, just like how we saw, representations matter. So representations at the higher levels are more semantic representations at the lower levels are more fine-grain and detailed and high frequency. So the detail on that can be thought of as writing its own representations at every layer every successive layer is written on top of the previous layer which is more abstract than the raw input and that allows you to do downstream tasks if you take the topmost layers.

So here's the Venn diagram that being Goodfellow suggests for deeper, how to think about deep learning. So deep learning is a subset of representation learning which is a subset of machine learning which can be considered as sort of AI in general. And so the goal of deep learning itself nothing to do with unsupervised learning is to learn good representations of raw data. So what is deep unsupervised learning? So unsupervised learning is concerned with learning these representations without labels.

So it can be considered as another subset of deep learning which is doing deep learning without labels, basically. So we are gonna get at the goal of representation learning without labels and thus deep unsupervised learning so it sort of gets at the core goal of the class and recently it's been called a self-supervised learning and it's used interchangeably with unsupervised learning. The exact terminology of what itself and what is un doesn't matter it's basically concerned with learning representations without labels and self usually refers to the scenario where you can create your own supervision based on the data but at the end of the day it can be considered as as another way to reprime tries unsupervised learning.

So why self-supervised learning? The expense of producing a new dataset for each task is really high, so, there are actually billion dollar startups just doing data annotation for people, who can just upload their images say what kind of labels they want and overnight or within an hour or fortnight you can get like high quality labels created by humans who would annotate this data on the client side. So, sorry, on the server side. So basically you need to prepare labeling manuals you need to figure out what categories of objects you want you need to have someone else hiring humans you need to hire your humans to annotate data and whoever is doing that job you need to create good graphical user interfaces so that the process of annotation is really fast.

You also need to create good storage pipelines so that every, you know, let's say people are annotating usually it's like a lot of mouse clicks per minute or second and every mouse click is automatically recorded and converted to appropriate data storage formats and stored efficiently into, probably the cloud. So there are lots of back-end engineering you need to do not that this is a bad thing to do, it is good unlike if we really need to work on better and better pipelines for data creation

however, good supervision may not be cheap. For example, annotating what are the objects contained in an image is probably something that you can take for granted now because people have created a lot of datasets but if you move to another domain like medicine or legal creating another data set may actually be pretty hard. So taking advantage of vast amount of unlabeled data on the Internet is something supervised learning cannot do. So, no matter how much you can appreciate the success of supervised learning

there is still a lot more unlabeled data than there is the amount of label data and it would be nice if we can leverage the power of unlabeled data to further improve the performance of systems that work on label data. So, it doesn't have to be a dichotomy between hey, we just wanna do unsupervised learning or we just wanted to supervised learning but rather we wanna figure out how to take advantage of large amounts of unlabeled data order billions of images for lots of text or audio samples or YouTube videos and learn amazing features and then make the process of doing supervised learning much more cost and compute and time efficient.

And finally, there's this cognitive motivation which is how babies or animals learn. In that, like when they mostly learn by experimenting and without actually having labels. So, a child can just look at other people doing things or its own experience, moving its own hands or looking at other people around in the house or like, you know, modern days children grow up with gadgets so they can look at videos and already start learning good features without actually knowing this is a cat

this is a cat, this is a cat, like hundreds of times that's how a missionary classifier is learned. So that was a really nice quote by Pierre Sermanet who's one of the leading researchers in the field, which is "Give a robot a label and you feed it for a second "but teach a robot to label "and you feed it for a lifetime." What he means by this is that if you taught the robot the underlying aspects of various objects in a completely self-supervised fashion it knows what, like a cat or dog is without actually being taught so that means that it can actually generalize much better. So, labels are cheap but then it may not be the most optimal way to learn representations.

So, what exactly is self-supervised learning? It is a version of unsupervised learning where data provides its own supervision. So, in general the way it could work is you withhold some part of the data and you task a neural net to predict a bit from the withheld portion from the remaining parts so this could be like you occlude some part of the image you look at the remaining pixels and you try to predict the occluded version or you have a video and you just hide some frames in the video, you hide the other frames and you try to fill in the blanks of the missing frames or you have a sentence and you mask out some words and you ask the neural network to fill in those words or you just ask to predict the future from the past or the past from the future or present from the past like lots, a various different versions depending on the mask, so this way the data is creating its own supervision

you can ask a neural network it'll learn a lot more than just predicting labels. So the details obviously decide what is a proxy loss or what is the pretext task. You can think about all these withhold and predict classes some kind of pretext task and you can think of whatever details you use whatever loss functions or whatever tasks you create depending on that the quality of the task could be different and therefore the quality of the underlying representations that you uncover could also be different. And so that is basically this whole topic which is how can we create these really good tasks which make the neural network to learn a lot of useful things and therefore be very useful in downstream tasks.

Another motivation of why we want to learn good features is. One of the biggest reasons for supervised learning to really take off, not just as a research topic but also as an industry of practice ,is that you can use a pre trained classifier for a lot of commercial and downstream tasks. So a pre-trained ImageNet state-of-the-art ImageNet classifier like a rest at 50 can just be taken and the same backbone can be taken and put into a faster R-CNN or a Mask R-CNN or a retina net and can be used for object detection or instant segmentation or it can also be used in a fully convolutional neural net with the backbone is the rest in 5O for a semantic segmentation, so this way you're able to solve a lot of harder computer vision problems

collecting label data is much harder and you can actually just retrain a good classifier take those features and start the underlying downstream tasks with a much better prior and you don't need so much label data now and you can also converge much faster on these harder problems. So that way, the recipe is very clear so you just collect a large label data set the trainer model, you deploy and as long as you have a lot of good data and you have sufficient data it is basically all you need in terms of getting some automation on production. So most of your industry usage of computer vision

like in video surveillance or in robotics where people have to detect objects or in shopping, automated shopping. Where you wanna detect what people pick which objects people pick. It's basically just object detection and to get a very good object detector all you need is a lot of labels and a lot of good patron features. So, what is the goal of self-supervised learning? The goal is to learn equally good if not even better features without supervision and be able to deploy similar quality systems as what is currently in production without relying on too many labels. So what if instead of collecting 10000 labels now you could just collect 1000 labels or 100 labels that makes the process of production much faster much more efficient and you don't have to spend as much and it's also much simpler to maintain and you can keep on bootstrapping more and more data.

You don't have to rely on high quality expert labeling and you can still uncover the same level of features as you have currently with all the effort required to collect labels. So, it could also generalize much better potentially because by doing some harder pretext task than just predicting labels you are expected to learn more about the world and therefore generalizing in the long tail scenario is likely to be better, so that is the hope and that's why people wanna make self-supervised learning really work.

So this has been really, you know, very nicely put together as a more inspiring slide by Yann Lecun and it's often referred to as the Lecun cake which we saw in the introduction to the class. Which is, you can think of self-supervised learning as the cake, intelligence of the cake. You can think of self-supervised learning as the cake and you can think of supervised learning as the icing on the cake and you can think of reinforcement learning as the cherry on the cake. And the argument is that most of the useful bits can come from doing really hard pretext tasks just from data

and where the machine is predicting some part for missing parts and you get millions of bits that way whereas in supervised learning, consider ImageNet you have 1000 classes, so that's 10 bits per image and if you have a million images you have basically a million times 10 bit space key that's basically your whole data set and whereas if you're just doing generative modeling you're modeling all possible bits in your data set so that's too huge, right? So self-supervised learning is trying to find a middle ground between these two and it's possible that the bits you get from self-supervised learning ae more useful. That said, there is a caveat that self-supervised learning, the bits you get from there are not as high-quality bits

as the bits you get from supervised tasks. When human is telling you that there is a cat here or there is a dog here or like there is a cat exactly at this coordinate there's a dog, there's a bounding box around a human that's very higher quality bit than just saying these two pixels are of the same color or like, this is a flipped version of that image or this image is a 90 degree rotated version of the other image, things like that. So it's not just a number of bits that matter the quality of the bits is equally important. So you should take this slide with not too seriously it's just for inspiration, making the bits argument as a way to like work on unsupervised learning is fundamentally flawed because the label data bits are much much much more useful much more grounded in the real world utility.

So, here is Yann Lecun's suggestion for how to do unsupervised or self-supervised learning which is creating your own proxy task and you can think of various different versions of that. Let's say like there's a video you could predict the top from the bottom bottom from the top, left from the right right from the left. It's basically mask some part of your input predict the masked part from the unmask part and obviously depending on the mask the model's gonna learn something trivial or non-trivial. So usually, like for instance in a video if you're just masking a couple of frames in between it may be very easy to fill it up by just using the optical flow information and just using the reference frames and just interpolating between the pixels. The model doesn't necessarily have to capture what an object is and whereas if you have a sentence and if you are predicting the missing words or sub words in a sentence

it's possible that the model learns a lot more about the grammar and the syntax and semantics of collective language because it's not possible to just copy-paste previous words to fill in the sentence because language is already syntactic and grammatical and separate, like every sentence, every word is conveying something new whereas pixels are more high-frequency there are more natural signals and so there is a spatial temporal correlation this is already available naturally. So the model may not really learn the actual high level information that you want it to learn unless you carefully engineer what are the masks that you wanna use.

So for the actual technical content we are gonna separate it into three parts so the first part is, we're gonna learn about we're gonna separate the various cognitive principles basically. The first principle is you corrupt your data and you try to predict the actual data from the corrupted version. And the corruption can just be like you add some noise to your input or it could be like you hide some part for your input and you predict the missing part or it could be like you take your data and you basically do some signal separation. So it could be like, hey, an image is basically a grayscale in the color

so you could predict the color from the grayscale or you have the depth image and you have the color image and you could try to predict the depth image from the color image where let's say you're recording everything from your Kinect, so it could be source separation and then you try to predict the separated version. So that is the first principle, the second principle is we're gonna do something like visual common sense tasks, where it's more ad hoc and you just trying to create tasks from data in a very creative way and see what kind of features the model can learn and there we are gonna look at three different techniques relative patch prediction, jigsaw puzzles and rotation.

And finally we are gonna look at contrast learning which is really the version of self-supervised or unsupervised learning that's been taking off very very recently and we're gonna look at a foundational work called Word2vec which explains a lot of these foundational ideas like noise contrast loss and then we're gonna look at a version that's been used in images called CPC or contrast to predictive coding and we're also gonna look at follow-ups to that that made the CPC pipeline much simpler like Instance Discrimination and where is state-of-the-art instantiations of that.

Note that in this lecture we are not gonna cover the more popular self-supervised techniques like BERT or anything to do with the latest language pre-training pipelines arguably self-supervised learning has taken off way more a language than computer vision. But the focus of this lecture is gonna be more on computer vision because language pre-training will be covered separately in a guest lecture by Alec Radford and we're also not gonna look at how unsupervised learning helps for reinforcement learning that will also be covered separately by Peter in another lecture.

Okay, so now let's go to denoising auto-encoders. So denoising auto-encoder, the basic idea is add some noise to your input and try to remove the noise and decode the actual image. So here you see a denoised digit and you see the noisy input on the left and you see the denoised image on the right and the encoder takes in the noisy image puts it into a smaller latent representation which is the features that we care about and the decoder is trying to use these features to get back the original input. So you hope that the encoder gets the high level details, removes the noise and the decoder can up sample that and get you back to the actual image. So depending on the kind of noise you add you wanna learn more non-trivial things. If you don't add any noise you're just gonna learn an identity function that's just an Auto-encoder but if you add some level of noise

it's possible that you learn more useful features because you're learning. So separate noise from the actual signal, right and if you have too much noise then it may actually be a really hard task because the signal-to-noise ratio will be low. So this is the general computation graph of a denoising auto-encoder, where X tilde refers to the noise version and F theta you basically are the ground truth x and you're trying to figure out how to reconstruct that back and get the Layton's in a very useful way.

So there are various different versions of noise that you can add to an input in a denoising auto-encoder. So in the original denoising auto-encoder paper they considered (mumbles). They considered three different noises additive isotropic Gaussian noise where you basically just adding Gaussian noise to the pixels and another version is the masking noise where you basically, some fraction of your input pixels are just chosen at random and you just force them to zero which you just mask them out and they're gonna be black

and finally, there's a salt-and-pepper noise where some fraction of the elements are chosen at random and you can basically set them either to the minimum possible value or maximum possible value. So instead of, basically it's a version of masking where instead of just assigning mask to be 0 you can randomly assign a mask to be 0 or 1 so these are 3 different noises to consider in the paper. You can note that as pixel level noise so you can think of denoising auto-encoders

basically learning a tangent hyperplane on your data manifold where around every input X there is a distortion radius created around it based on the noise that you're trying to add so it's very easy to understand in the case of additive Gaussian noise because you can think of Gaussian as a spherical distortion around your every input and you can think of the decoders trying to put the distorted version back onto the tangent hyperplane. So you can think of the whole denoising auto-encoder pipeline as trying to learn this tangent hyperplane that describes the data manifold so that it's able to put back the distortions around the hyperplane back to the correct like back to the data manifold and that way it uncovers the shape of the data manifold by operating at these local hyper planes at arraigned visual point.

So here is the loss function of the denoising auto-encoder so you can you can clearly see that there is a version where you can use the reconstruction error for the available pixels which are not having any noise and the reconstruction error for the pixels that have been noise and you can also rate them based on, you know, like you can prioritize the reconstruction of the noise versions as compared to the versions that have not been noised. So if you have and MNIST image

and you're like adding noise like 10% of the pixels you could prioritize the reconstruction error of those pixels more than the other pixels, so that the model is not incentivized to learn identity function or around what is like already available without noise well and the model is actually striving hard to like, get the details right at the noise pixels. So and you could also imagine optimizing two different versions of the loss. One version of the loss is using the mean squared error and the other version of the loss is using a binary sigma across entropy loss and both are equally good. In MNIST it makes more sense to use the cross entropy loss but the mean squared error loss is also very likely to work well as long as you let it train with the right sort of hyper parameters.

So stacked denoising auto-encoder is basically the version of denoising auto-encoder where you're gonna do this layer by layer by layer. So you take your original MNIST image you have one hidden layer and you run a denoising auto-encoder and you get that hidden layer. Now you can take that hidden layer as you're like version of the image that you wanna use instead of the actual pixels, you can add noise at the hidden feature level and learn a denoising auto-encoder for that feature, right so and if you do this iteratively the denoising auto-encoder is now operating on more more abstract inputs instead of the raw pixels. So that's basically the idea in a stacked denoising auto-encoder and the hope is that, as you keep stacking more layers the higher layers get more and more semantic.

But you should also be careful in thinking about what kind of noise you can add to the features so if back in those days people used to use neural networks with Sigma non-linearities so in that case, it's easy to add a noise like masking because Sigma can be considered as you know, the neurons firing or not firing. But now neural nets and like the way the neural nets are designed is much different like the kind of non-linearities used are very different. So this may not be particularly an appealing idea to use in the current infrastructure.

So finally, one utility of the denoising auto-encoder is that once you've learned sufficient layers with a stacked denoising auto-encoder you could basically have a target like a class label and just freeze all the features that you've learned from the auto encoder and have a supervised layer on top make a single linear layer that just predicts the class logits and you could use that to perform a classification task and this was particularly appealing back then because back then it was really hard to train deep neural networks to just do supervised learning even if you had a lot of data because directly training deep neural networks was not something that was particularly working well

and like innovations were needed in terms of using momentum optimizers and bigger math sizes and etc. Convolutional neural network, so as far as hidden here like feed-forward neural networks goes this was a standard recipe to even do supervised learning back then because you needed some reasonably high level features to operate with to train a good supervised model. So here are the filters that you learn with a denoising auto-encoder for various levels of noises and you can clearly see that the ones where you actually add more noise is learning more of these digit edges whereas the ones you don't have any noise you're hardly learning anything because it's mostly gonna do an identity map.

And this is also visualized for a particular neuron magnified and you can see that the filters are like more visible for the higher masking ratios. You can also see that there's something like a six visible towards the right and it's getting the notions of digit edges or strokes at the hidden level.

So these are various classifiers that you can train on top of these denoising auto-encoders the features that you get from stacked denoising auto-encoders. These are the error rates in MNIST classification it's not particularly relevant now because MNIST is considered solve but then you can clearly see that, you know it's getting like 97% accuracy or something in that range by putting SPMS and top. So this is like a cool result at the time.

So here is another version of corrupting your image and trying to predict corruption or like trying to hide some portion of your image and trying to predict the hidden portion. So this is a paper called context encoders from Deepak Pathak et al work from Alyosha Efros group here at Berkeley. So the way it works since it basically takes an image

mass out a rectangular region and encodes that image now with the mask and has a decoder that tries to reconstruct the actual image now, so that way the model is filling up the details of what's missing in the mask and supervision basically can be constructed from your data itself because you actually knew what part you masked because you had the complete image. So the model is able to learn without any labels by creating its own supervision so that's why it's called self-supervised learning.

So you can have various instantiations of this where you could mask out only the central region and try to fill up the central region or you can mask out various square blocks spread across the image much smaller but lots of mask and you could try to fill them all or you could, if you have access to segmentation mask of actual objects in your image you could segment out particularly the pixels belonging to one particular object like in this case the baseball player and you could just try to fill in those pixels and that assumes access to label data of segmentation masks so that's not something that is completely self-supervised but the other two versions are completely self-supervised.

So they've made the reconstruction last good work is you have a masked region and you have a ground truth for that and you could just apply the reconstruction error on the pixels that have been masked. So you take your decoded image and you apply the inverse of the mask and you get all the other pixels out and then you can just mask out those pixels for the reconstruction error. So there are multiple losses that you can use for the reconstruction objective. One is you could use just a mean squared error that you saw in the previous slide of denoising auto-encoder or one problem that's usually a common with the mean squared error which was also mentioned in the GANs lecture is that they often tend to be blurry. So because you don't want blurry reconstructions you actually want sharp predictions of all these missing pixels

you can actually think of using a GANs loss, which is you have a discriminator and that discriminators is gonna behave like a learn a loss function and you can think of using the discriminator objective and the reconstruction objective together because back in those days training just a discriminator and using adversarial losses wasn't particularly easy. So the authors ended up using a combination of the regular reconstruction objective and the adversarial discriminator objective.

So this is the architecture they adopted where you have your original image 128 by 128 and you just use strided four by four cons and down sample spatial resolutions and you also have to keep up sampling your channel resolutions and you get a flat heading vector of 4,000 dimensions and then you up sample using transpose convolutions back into the actual original image and you can use the reconstruction error.

It could be an L1 or L2 objective and I think the authors tried both, both L1 and L2 and found L1 to be working slightly better as far as reconstruction goes and they also have the discriminator that takes in real data as well as your predicted missing patches and then classifying if it's a real or a fake image. So, you can see that the L2 loss is producing a blurry pixel interpolation basically scrapping all the neighborhood pixels the vacant workers, you just have the missing square and you can just fill up like the borders

based on the pixels that are available immediately to the left or the top or the right or the bottom respectively and once you filled it up you can just fill in the missing regions of the square based on what you've already filled up within the square on the edges and that will look like a reasonable completion very blurry though and if you look at the adversarial loss it's introducing artifacts that are completely new. So as long as the discriminator thinks like it's a real object, it would still work but it may not particularly have a coherence with respect to the actual background image and you've seen this problem in pics to pixels will vary for a conditional ganyo to provide the context in addition to what you're trying to translate to. So that's clearly what's going on there and the joint loss is trying to use both the reconstruction objective and the adversarial objective and it's producing something sharper than just using L2 loss.

So here are some results for what happens, okay let's say you finish this retraining process now you take the encoder out and you wanna use it for a bunch of downstream task so the downstream task could be a classification in detection or semantic segmentation and classification and detection are done on a Pascal dataset, which is much smaller than ImageNet so you can think of the advantage of P training as hey if you don't have too many labels, you know you really need some kind of features to start with to be able to perform the task and semantic segmentation are also on Pascal VOC but a different version of the dataset 2012 and that uses another architecture like fully composition that doing the semantic segmentation part. So this is using the pre-trained part of context encoder as a backbone of our part in the FCN.

So here the results are reasonably good so if you just use ImageNet features which is, you pre-train a classifier on ImageNet and then you fine-tune it on Pascal the results are like 78.2% for classification and then 56.8% for deduction, 48% for segmentation and context encoder, the fine tuning to Pascal classification is not that good it gets only 56.5% which is way lower than supervised but it's reasonably good in the sense that it's able to perform on par with

or actually is quite better than an auto-encoder an auto-encoder gets 53.8% on Pascal classification and detection it gets 42%. So they get two to three percentage points more than doing just a regular auto-encoder and other self-supervision methods that were available at the time. So this was a reasonably interesting result at the time. So next, we look at the principle of predicting one view from another, where you basically do some source separation and you're trying to predict the separated parts from each other. So this is a slide for Richard Zhang who is also the first author of this line of work. So we already saw what a denoising auto-encoder is it basically takes raw data, corrupts it and tries to reconstruct the original data. Now, imagine that you can separate your raw data

under different views, the best way to understand this is an image can be separated into a color image and the grayscale and you could try to predict one view from another. So you could try to predict the color image from the grayscale. separating the grayscale from the color doesn't actually need any deep neural net all you need to do is average two pixels and quantize and you're gonna get something that is reasonably grayscale and in fact, the exact way the conversion is done it's a weighted average of your RGB pixels but the other version which is predicting the color from the grayscale means that you have to add some new information to what's already there because you don't have any information about the color. So, that way you do have to understand that hey if you have a tree, you know, the leaves are green and like the bark is brown. So you have to identify some of the objects and try to like learn features about like edges and so on.

So that's the goal of this line of work. So it's best visually illustrated here so grayscale, so an image can be just like you have RGB there like various different color channel parameterizations of an actual image and instead of using the RGB color space you can use the L ab color space and the L channel will behave like the grayscale image and the ab channels behave like the color image and you can use the L channel, encode it and predict the ab channels and that is basically the tasks considered in the learning to colorize work. So you can see that those yellow light pixels are identifying the eyes of the fish, of the body

but you can also see that because the background is coinciding with the color of the body of the fish it's not able to separate it out so uniformly color is the background but it's able to color the coral reefs around so it's identifying them as green. So you can see that it's able to understand some high-level aspects of the image by doing this task. So that's basically what's going on and to visualize what how the actual image looks like you can just concatenate the two channels and see how it looks like, so that is the version and here the author's first tried the new idea which is take your ground truth and you just do a mean squared between your predicted and the ground truth and that would end up producing a very degenerate like degenerate like colorization of the actual bird

and the ground truth is made more colorful and diverse. So what the author has realized is instead of treating the prediction as a mean squared a regression task, what if you treated it as a classification task? Where you quantize the pixels so you quantize the ab channel information and bit it into a bunch of categories and now instead of predicting some value for the ab channel and just regressing to the ground truth you're gonna actually output a distribution over the possible values because you quantized them you can then do a softmax (mumbles) loss instead of mean squared error loss and it's in general, it works out really well in deep learning to do this. You've also seen how it worked out really well in pixelRNN and where all the pixels were quantized to discrete categories instead of using a Gaussian mean squared error you're gonna use the process to be loss and that produces sharper images.

Here's how it goes, you basically take an image you have the ab channel prediction, you quantized it and now you're gonna use Krauser to be lost to predict your actual ab channel information. So that is basically how the colorization work is done another version of this done by Richard Zhang was trying to do something like a split-brain auto-encoder

a split view auto-encoder which is you've separated the channels in your source you have encoders that try to predict the other channel from the current channel. So where X2 hat is the other channel prediction and X1 hat is the prediction from X2 and now you concatenate these two channels together and you get your actual input again and you wanna make sure that this version matches your original version. So this way it's like ensuring a backward consistency in some sense because it's not just about predicting the color from your grayscale, it's also like, hey the ab channel should also make sense

like whatever you predict from your ab channels to your L channel and whatever you predict from your L channel to the ab channel, together if you look at it it should make sense and it should look like my actual image, so this can make more sense if you're looking at other kinds of views like depth image and color images. So, here's like one way to implement this, which is you separate out, you have two different encoders you predict the other channels, missing channels you concatenate and then you have a loss on the actual predicted image. So and this is how it will work for a color and depth information.

So these are all interesting ideas and we're not gonna really look into the metrics that these methods have because more than the metrics these papers are more famous for the input-output version itself which we looked in (mumbles) where the fact that even colorization can work so well is so appealing but in terms of the metrics, in terms of the numbers we look at them much later when we look at contrast learning.

Here is the other final the second version that we wanted to see, which is introduce some kind of visual common-sense tasks. So here we're gonna look at relative patch prediction this was an idea put forth by Carl Doersch, Abhinav Gupta and Alex A. Efros and so in some sense this was one of the first papers to do self-supervised learning on images at a larger scale and it's considered one of the foundational papers for a lot of the ideas put forth. So basically what is the task the authors considered here the task was, given two patches try to identify the relative position of the two patches which is to say that, if you have a center patch

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent