Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the olympus-google-fonts domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /customers/2/b/9/gnereus.com/httpd.www/x2024/wp-includes/functions.php on line 6121 Warning: Cannot modify header information - headers already sent by (output started at /customers/2/b/9/gnereus.com/httpd.www/x2024/wp-includes/functions.php:6121) in /customers/2/b/9/gnereus.com/httpd.www/x2024/wp-includes/rest-api/class-wp-rest-server.php on line 1896 Warning: Cannot modify header information - headers already sent by (output started at /customers/2/b/9/gnereus.com/httpd.www/x2024/wp-includes/functions.php:6121) in /customers/2/b/9/gnereus.com/httpd.www/x2024/wp-includes/rest-api/class-wp-rest-server.php on line 1896 Warning: Cannot modify header information - headers already sent by (output started at /customers/2/b/9/gnereus.com/httpd.www/x2024/wp-includes/functions.php:6121) in /customers/2/b/9/gnereus.com/httpd.www/x2024/wp-includes/rest-api/class-wp-rest-server.php on line 1896 Warning: Cannot modify header information - headers already sent by (output started at /customers/2/b/9/gnereus.com/httpd.www/x2024/wp-includes/functions.php:6121) in /customers/2/b/9/gnereus.com/httpd.www/x2024/wp-includes/rest-api/class-wp-rest-server.php on line 1896 Warning: Cannot modify header information - headers already sent by (output started at /customers/2/b/9/gnereus.com/httpd.www/x2024/wp-includes/functions.php:6121) in /customers/2/b/9/gnereus.com/httpd.www/x2024/wp-includes/rest-api/class-wp-rest-server.php on line 1896 Warning: Cannot modify header information - headers already sent by (output started at /customers/2/b/9/gnereus.com/httpd.www/x2024/wp-includes/functions.php:6121) in /customers/2/b/9/gnereus.com/httpd.www/x2024/wp-includes/rest-api/class-wp-rest-server.php on line 1896 Warning: Cannot modify header information - headers already sent by (output started at /customers/2/b/9/gnereus.com/httpd.www/x2024/wp-includes/functions.php:6121) in /customers/2/b/9/gnereus.com/httpd.www/x2024/wp-includes/rest-api/class-wp-rest-server.php on line 1896 Warning: Cannot modify header information - headers already sent by (output started at /customers/2/b/9/gnereus.com/httpd.www/x2024/wp-includes/functions.php:6121) in /customers/2/b/9/gnereus.com/httpd.www/x2024/wp-includes/rest-api/class-wp-rest-server.php on line 1896 {"id":273,"date":"2024-07-30T09:23:53","date_gmt":"2024-07-30T09:23:53","guid":{"rendered":"https:\/\/gnereus.com\/x2024\/?p=273"},"modified":"2024-07-30T09:28:14","modified_gmt":"2024-07-30T09:28:14","slug":"generative-ai-latent-space","status":"publish","type":"post","link":"https:\/\/gnereus.com\/x2024\/2024\/07\/30\/generative-ai-latent-space\/","title":{"rendered":"Generative AI – Latent Space"},"content":{"rendered":"\n

Exploring Latent Space in Generative Models<\/h2>\n\n\n\n

Introduction<\/strong> Latent space is a fundamental concept in generative models, such as GANs (Generative Adversarial Networks) and VAEs (Variational Autoencoders). It refers to the space of hidden variables that the model uses to generate new data instances.<\/p>\n\n\n\n

What is Latent Space?<\/strong> In the context of generative models, latent space is an abstract, lower-dimensional space where each point corresponds to a possible output of the model. The model learns to map these points to high-dimensional data, such as images or text.<\/p>\n\n\n\n

Navigating Latent Space<\/strong> Latent space can be thought of as a compressed representation of the data distribution. By sampling points in latent space and feeding them through the decoder of the model, we can generate new, realistic data instances.<\/p>\n\n\n\n

Example Code: Sampling from Latent Space<\/strong> Here’s an example using a simple VAE to explore latent space:<\/p>\n\n\n\n

import torch\nfrom torch import nn\nfrom torchvision import datasets, transforms\nfrom torch.utils.data import DataLoader\n\n# Define the VAE model\nclass VAE(nn.Module):\n    def __init__(self, latent_dim=2):\n        super(VAE, self).__init__()\n        self.fc1 = nn.Linear(784, 400)\n        self.fc21 = nn.Linear(400, latent_dim)\n        self.fc22 = nn.Linear(400, latent_dim)\n        self.fc3 = nn.Linear(latent_dim, 400)\n        self.fc4 = nn.Linear(400, 784)\n\n    def encode(self, x):\n        h1 = torch.relu(self.fc1(x))\n        return self.fc21(h1), self.fc22(h1)\n\n    def reparameterize(self, mu, logvar):\n        std = torch.exp(0.5 * logvar)\n        eps = torch.randn_like(std)\n        return mu + eps * std\n\n    def decode(self, z):\n        h3 = torch.relu(self.fc3(z))\n        return torch.sigmoid(self.fc4(h3))\n\n    def forward(self, x):\n        mu, logvar = self.encode(x.view(-1, 784))\n        z = self.reparameterize(mu, logvar)\n        return self.decode(z), mu, logvar\n\n# Example usage\nmodel = VAE()\n# Assuming `data_loader` is a DataLoader for MNIST or a similar dataset\nfor batch in data_loader:\n    data, _ = batch\n    recon_batch, mu, logvar = model(data)\n    # Sample from latent space\n    sample = torch.randn(64, 2)  # 64 samples, 2-dimensional latent space\n    generated_images = model.decode(sample)\n<\/code><\/code><\/pre>\n\n\n\n

Latent space provides a powerful way to understand and generate data with generative models. By manipulating points in latent space, we can create diverse and realistic data samples, making it a crucial concept in AI and machine learning.<\/p>\n","protected":false},"excerpt":{"rendered":"

Exploring Latent Space in Generative Models Introduction Latent space is a fundamental concept in generative models, such as GANs (Generative Adversarial Networks) and VAEs (Variational Autoencoders). It refers to the space of hidden variables that the model uses to generate new data instances. What is Latent Space? In the context of generative models, latent space […]<\/p>\n","protected":false},"author":1,"featured_media":270,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,19,26],"tags":[4,20,27],"class_list":["post-273","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai","category-computer-vision","category-generative-ai","tag-ai","tag-computer-vision","tag-generative-ai"],"_links":{"self":[{"href":"https:\/\/gnereus.com\/x2024\/wp-json\/wp\/v2\/posts\/273","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gnereus.com\/x2024\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gnereus.com\/x2024\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gnereus.com\/x2024\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gnereus.com\/x2024\/wp-json\/wp\/v2\/comments?post=273"}],"version-history":[{"count":2,"href":"https:\/\/gnereus.com\/x2024\/wp-json\/wp\/v2\/posts\/273\/revisions"}],"predecessor-version":[{"id":277,"href":"https:\/\/gnereus.com\/x2024\/wp-json\/wp\/v2\/posts\/273\/revisions\/277"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gnereus.com\/x2024\/wp-json\/wp\/v2\/media\/270"}],"wp:attachment":[{"href":"https:\/\/gnereus.com\/x2024\/wp-json\/wp\/v2\/media?parent=273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gnereus.com\/x2024\/wp-json\/wp\/v2\/categories?post=273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gnereus.com\/x2024\/wp-json\/wp\/v2\/tags?post=273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}