{"id":21946281,"url":"https://github.com/cpldcpu/latentspaceexplorer","last_synced_at":"2026-02-09T01:33:53.220Z","repository":{"id":260702807,"uuid":"882106190","full_name":"cpldcpu/LatentSpaceExplorer","owner":"cpldcpu","description":"Latent Space Explorer for Variational Autoencoders (VAE)","archived":false,"fork":false,"pushed_at":"2025-11-04T19:42:52.000Z","size":16380,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-04T21:19:53.599Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://cpldcpu.github.io/LatentSpaceExplorer/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cpldcpu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-01T22:43:45.000Z","updated_at":"2025-11-04T19:31:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"f7e64462-9ad4-43f8-babd-700fce225a2d","html_url":"https://github.com/cpldcpu/LatentSpaceExplorer","commit_stats":null,"previous_names":["cpldcpu/latentspaceexplorer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cpldcpu/LatentSpaceExplorer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpldcpu%2FLatentSpaceExplorer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpldcpu%2FLatentSpaceExplorer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpldcpu%2FLatentSpaceExplorer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpldcpu%2FLatentSpaceExplorer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cpldcpu","download_url":"https://codeload.github.com/cpldcpu/LatentSpaceExplorer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpldcpu%2FLatentSpaceExplorer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29252979,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T22:49:53.206Z","status":"ssl_error","status_checked_at":"2026-02-08T22:49:51.384Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-29T04:30:11.865Z","updated_at":"2026-02-09T01:33:53.215Z","avatar_url":"https://github.com/cpldcpu.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Latent Space Explorer\n\nA web-based interactive tool for exploring the latent space of a Variational Autoencoder (VAE) trained on the MNIST dataset.\n\n\u003cdiv align=\"center\"\u003e\n\n**[Try it online here](https://cpldcpu.github.io/LatentSpaceExplorer/)**\n\n\u003c/div\u003e\n\n[![LatentSpaceExplorer](screenshot.png)](https://cpldcpu.github.io/LatentSpaceExplorer/)\n\n## Overview\n\nThis project was inspired by [N8's implementation](https://n8python.github.io/mnistLatentSpace/) and developed as a \"speed-prompting\" exercise using Claude Artifact (Sonnet 3.5 New) and GitHub Copilot's editing capabilities. The entire implementation, including training, took approximately 2.5 hours.\n\n### Tech Stack\n- Frontend: TypeScript, React, Tailwind CSS, Vite\n- Inference: ONNX Runtime\n- Training: PyTorch\n- Deployment: Based on [Neural Network Visualizer](https://github.com/cpldcpu/neural-network-visualizer)\n\nThe UI features a cyberpunk-inspired design created with Claude's assistance.\n\n## Features\n\nThe application consists of two main components:\n1. **Latent Space Explorer**: Visualizes the distribution of the latent space in 2D projection, with colors indicating digit classes\n2. **VAE Model Viewer**: Generates images from selected points in the latent space\n\n## Implementation Details\n\n### Training\nThe training code is located in the `train` directory:\n- `train.py`: Trains the VAE and saves checkpoints and test images\n- `export_vae_2_onnx.py`: Converts checkpoint to ONNX format and exports latent space data as msgpack/JSON\n\n### Neural Network Architecture\n\nThe VAE implementation features:\n- Encoder with three convolutional layers\n- Two-dimensional latent space\n- Decoder with two full-resolution layers for improved output clarity\n\nInterestingly, this was one of the parts that was messed up by Claude, so I had to manually fix the padding and channels. Certainly, a smaller model would have also done the job. Having two layers at full resolution in the decoder turned out to be crucial to avoid too blurry output.\n\n```python\n    # Encoder\n    self.encoder = nn.Sequential(\n        nn.Conv2d(1, 32, 3, stride=1, padding=1),  \n        nn.BatchNorm2d(32),\n        nn.ReLU(),\n        nn.Conv2d(32, 32, 3, stride=2, padding=1),  \n        nn.BatchNorm2d(32),\n        nn.ReLU(),\n        nn.Conv2d(32, 32, 3, stride=2, padding=1),  \n        nn.BatchNorm2d(32),\n        nn.ReLU(),\n        nn.Flatten()\n    )\n    \n    # Latent space\n    self.fc_mu = nn.Linear(32 * 7 * 7, latent_dim)\n    self.fc_var = nn.Linear(32 * 7 * 7, latent_dim)\n    \n    # Decoder\n    self.decoder_input = nn.Linear(latent_dim, 32 * 7 * 7)\n    \n    self.decoder = nn.Sequential(\n        nn.ConvTranspose2d(32, 32, 3, stride=2, padding=1,output_padding=1),  \n        nn.BatchNorm2d(32),\n        nn.ReLU(),\n        nn.ConvTranspose2d(32, 32, 3, stride=2, padding=1,output_padding=1),  \n        nn.BatchNorm2d(32),\n        nn.ReLU(),\n        nn.ConvTranspose2d(32, 1, 3, stride=1, padding=1), \n        nn.Sigmoid()\n    )\n```\n\n## Building\n\nThe core code can be found in [`webcode/src/pages/index.tsx`](webcode/src/pages/index.tsx). I used [Claude Artifacts Starter](https://github.com/EndlessReform/claude-artifacts-starter) as a harness to deploy the artifact to a github.io page.\n\nAll web code is in the `webcode` directory. Read Claude Artifacts Starter's [README](webcode/README.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpldcpu%2Flatentspaceexplorer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcpldcpu%2Flatentspaceexplorer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpldcpu%2Flatentspaceexplorer/lists"}