GANs are not supposed to do that, all they do is use surfaces. If you want 3D GAN you are going to have to create it
Machine Learning
Community Rules:
- Be nice. No offensive behavior, insults or attacks: we encourage a diverse community in which members feel safe and have a voice.
- Make your post clear and comprehensive: posts that lack insight or effort will be removed. (ex: questions which are easily googled)
- Beginner or career related questions go elsewhere. This community is focused in discussion of research and new projects that advance the state-of-the-art.
- Limit self-promotion. Comments and posts should be first and foremost about topics of interest to ML observers and practitioners. Limited self-promotion is tolerated, but the sub is not here as merely a source for free advertisement. Such posts will be removed at the discretion of the mods.
there are too many people in the city that can't seem to see the problem.
GANs indeed learn to generate samples from the data distribution.
VAEs learn how to encode samples to parameters (mean, variance) of a latent-distribution. De VAE-decoder then maps samples from that latent-distribution back to input samples. If basically an autoencoder that tries to do "input->code->reconstructed input", but with the code being a compact probability distribution instead of a point.
You can use a VAE as an outlier detectors by looking at the reconstruction error. If you e.g. have trained a cat-image VAE then if will ouput cat images. You can generate random code samples and run those through the decoder sttep and then you'll get random cat pictures. If you feed it a cat picture, encode it, and then decode it, you get something similar to your original input cat image out again. This is because it is an auto-encoder. The reconstruction error is small in this case. If you however feed it a dog image, then the encoder will try to map it to a cat-code, however, the decoder will then still always generate a cat image. In this case the input dog image and the ouput cat image will have a larger distance / reconstruction error.
There is yet another type of generative models called "flow models" that explicitely model the data density. Flow models use invertible function and allow you to evaluate the pdf directy, whereas VAEs only tell you how well it can auto-encode a sample, and it will be trained to do that (only) well for samples from the trainset.
thank you for the detailed answer!
"GANs indeed learn to generate samples from the data distribution."
So GANs do have estimation capabilities? Can I use the trained discriminator to detect anomalous images? I guess the discriminator should mark them as "fake" due to not being prevalent in the dataset?
Yes, indeed, good point. You can also use the discriminator or a GAN for anomaly detection.
GANs can generate samples from the data distribution, but not estimate them.
GANs learn to generate samples in similar ratios as the original data: if there's 10% dogs, there will be 10% dogs in the samples. But they don't work backwards from a dog image to 10%, you might say - they are 'likelihood-free'. They just generate plausible images. They don't know how plausible an existing image is.
In theory, a VAE can tell you this and look at a dog image and say '10% likelihood' and look at a weird pseudoimage and say 'wtf this is like, 0.00000001% likely', and you could use it to eliminate all your pseudoimages. In practice, they don't always work that well for outlier detection and seem to be fragile. So, the advantage of VAEs there may be less compelling than it sounds on a slide.
In theory, can I use the discriminator of the GAN for this?
It will look at a weird picture and say: this looks fake?
Can I use the trained discriminator to detect anomalous images? I guess the discriminator should mark them as "fake" due to not being prevalent in the dataset?
Generally, no. What a Discriminator learns seems to be weirder than that. It seems to be closer to 'is this datapoint in the dataset' (the original dataset, not the distribution). You can look at the ranking of a Discriminator over a dataset and this can be useful for finding datapoints to look at more closely, but it's weird: https://gwern.net/face#discriminator-ranking
She might be refering to the findings in this paper: https://proceedings.neurips.cc/paper_files/paper/2019/file/959ab9a0695c467e7caf75431a872e5c-Paper.pdf
I learned GAN recently too so take it with a grain of salt.
The generative network learns a function that takes random noise as an input and returns a generated sample. As a consequence, the network learns the distribution of the true samples, but that information is hard to retrieve because it is encoded as weights of neural networks. So yes, it learns the distribution, but we cannot use it because it is in a hard-to-use format.
but that information is hard to retrieve
that makes sense!
GANs are implicit probabilistic models. This means that they do not learn the distribution of data but rather a mapping from a known distribution (standard Gaussian) to the data distribution. As a result, there is no density estimate because it isn't modeling the density.
VAEs, on the other hand, can approximate the density indirectly, since they also do not learn the distribution of the data directly. Rather, it learns an encoder which estimates p(z|x) and a decoder p(x|z). However, using simple probabilistic rules, we can derive p(x) = integral of p(x,z) over z. We break down p(x,z) to p(x|z)p(z). We approximate integral of p(x|z)p(z) dz with the monte carlo approximation via sampling to arrive at an estimate of p(x).
If you look at the review: https://arxiv.org/pdf/2103.04922.pdf in Table 1, you'll see in the rightmost column GANs don't have any "NLL" - this stands for the negative log likelihood, or if you like the model's density fit over the distribution. Other classes of models, like VAEs, only give bounds on the density (approximate densities). Flows and autoregressive token predictors can give exact densities. The discriminator of GAN just estimates if something is real or fake, not estimating true probabilities (densities). Adversarial training can, however, be used for anomaly detection (and works quite well, e.g. GANomoly and successors).
thanks!
there is so much stuff to learn!