{"id":28184417,"url":"https://github.com/brunoocs/text-to-image-diffusion-model","last_synced_at":"2025-05-16T05:14:48.278Z","repository":{"id":281175135,"uuid":"939331974","full_name":"BrunooCS/Text-To-Image-Diffusion-Model","owner":"BrunooCS","description":"Text to image diffusion model from scratch with Tiny ImageNet dataset, Pytorch and Web interface for image generation.","archived":false,"fork":false,"pushed_at":"2025-03-07T11:09:39.000Z","size":138629,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-07T12:22:57.505Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/BrunooCS.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":"2025-02-26T11:24:02.000Z","updated_at":"2025-03-07T11:09:43.000Z","dependencies_parsed_at":"2025-03-07T12:32:59.272Z","dependency_job_id":null,"html_url":"https://github.com/BrunooCS/Text-To-Image-Diffusion-Model","commit_stats":null,"previous_names":["brunoocs/text-to-image-diffusion-model"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrunooCS%2FText-To-Image-Diffusion-Model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrunooCS%2FText-To-Image-Diffusion-Model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrunooCS%2FText-To-Image-Diffusion-Model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrunooCS%2FText-To-Image-Diffusion-Model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BrunooCS","download_url":"https://codeload.github.com/BrunooCS/Text-To-Image-Diffusion-Model/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254470935,"owners_count":22076588,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2025-05-16T05:14:47.779Z","updated_at":"2025-05-16T05:14:48.272Z","avatar_url":"https://github.com/BrunooCS.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\nDiffusion Model\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"output_ImageNet/forward_diffusion.png\" alt=\"Forward Diffusion Process\" width=\"800\" style=\"border-radius: 6px\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  A powerful conditional diffusion model for image generation from text descriptions.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.python.org/\"\u003e\n    \u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/c/c3/Python-logo-notext.svg\" alt=\"Python\" width=\"50\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://pytorch.org/\"\u003e\n    \u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/1/10/PyTorch_logo_icon.svg\" alt=\"PyTorch\" width=\"50\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.gradio.app/\"\u003e\n    \u003cimg src=\"https://www.gradio.app/_app/immutable/assets/gradio.CHB5adID.svg\" alt=\"Gymnasium\" width=\"200\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n## Overview\n\nThis project implements a conditional diffusion model that generates images from text descriptions. The model learns to gradually denoise random Gaussian noise into coherent images, guided by text prompts.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"output_ImageNet/class_goldfish_generation.gif\" alt=\"Generation Process\" width=\"400\" style=\"border-radius: 12px\"\u003e\n\u003c/p\u003e\n\n## Key Features\n\n- **Text-to-Image Generation**: Convert textual descriptions into high-quality images\n- **Web Interface**: User-friendly interface for image generation\n- **Conditional Generation**: Fine-grained control over generated content\n- **Interactive Process Visualization**: Watch the denoising process in real-time\n- **Multi-Class Support**: Generate images across various categories\n\n## Architecture\n\nThe model consists of several key components:\n\n```\n├── models/\n│   ├── modules.py        # Neural network building blocks\n│   ├── text_encoder.py   # Text embedding module\n│   ├── time_encoder.py   # Timestep encoding module\n│   └── unet.py           # Conditional UNet architecture\n│\n├── output_ImageNet/      # Generated outputs and visualizations\n│\n├── diffusion.py          # Core diffusion model implementation\n├── plot_func.py          # Visualization utilities\n├── preprocess.py         # Data loading and preprocessing\n└── web.py                # Web interface for image generation\n```\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"output_ImageNet/final_class_tarantula.png\" alt=\"Sample Generation\" width=\"450\" style=\"border-radius: 12px\"\u003e\n\u003c/p\u003e\n\n## Web Interface\n\nThe project includes a sleek web interface for easy interaction with the model:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"output_ImageNet/web.png\" alt=\"Web Interface\" width=\"600\" style=\"border-radius: 12px\"\u003e\n\u003c/p\u003e\n\nFeatures:\n- Text prompt input\n- Multiple image generation\n- Process visualization\n- Real-time generation progress\n\n\n## Model Components\n\n### 1. Diffusion Process\n- Forward diffusion adds noise gradually\n- Reverse diffusion learns to remove noise\n- Conditional generation guided by text embeddings\n\n### 2. Architecture Details\n- UNet backbone with skip connections\n- Text conditioning through cross-attention\n- Time embedding using sinusoidal positions\n- Batch normalization for stable training\n\n### 3. Dataset\n- [Tiny ImageNet](https://paperswithcode.com/dataset/tiny-imagenet), over 1Million images and 200 classes\n\n### 3. Training Process\n- Dataset: ImageNet subset\n- Text embeddings: SentenceTransformer\n- Loss: MSE between predicted and actual noise\n- Optimizer: AdamW with gradient scaling\n\n## Sample Generations\n\nGenerate images from text descriptions like:\n- \"red apple\"\n- \"golden retriever\"\n- \"sunset over mountains\"\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunoocs%2Ftext-to-image-diffusion-model","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrunoocs%2Ftext-to-image-diffusion-model","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunoocs%2Ftext-to-image-diffusion-model/lists"}