convolutional-autoencoder-pytorch


Nameconvolutional-autoencoder-pytorch JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA package to simplify the implementing an autoencoder model.
upload_time2025-07-30 11:41:25
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords autoencoder pytorch ml deep learning
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# convolutional-autoencoder-pytorch

A minimal, customizable PyTorch package for building and training convolutional autoencoders based on a simplified U-Net architecture (without skip connections). Ideal for representation learning, image compression, and reconstruction tasks.

## ๐Ÿ”ง Features

- ๐Ÿ“ฆ Modular architecture (`Encoder`, `Decoder`, `AutoEncoder`)
- ๐Ÿ” Symmetric U-Net-like design without skip connections
- โšก Tanh output activation for stable image reconstruction
- ๐Ÿง  Residual blocks with RMS normalization and SiLU activation
- ๐Ÿ“ฑ Designed for image inputs (`3ร—Hร—W`) with configurable channels and latent dim
- ๐Ÿงช Works with batched input tensors (e.g., `torch.Tensor[B, C, H, W]`)

## ๐Ÿ“ฆ Installation

```bash
pip install convolutional-autoencoder-pytorch

```

## ๐Ÿงฉ Package Structure

```bash
convolutional-autoencoder-pytorch/
โ”œโ”€โ”€ convolutional_autoencoder_pytorch/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ module.py          # All architecture classes and logic
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ README.md

```

## ๐Ÿš€ Quick Start

### 1. Import the package and create the model

```python
import torch
from convolutional_autoencoder_pytorch import AutoEncoder

model = AutoEncoder(
    dim=64,
    dim_mults=(1, 2, 4, 8),
    dim_latent=128,
    image_channels=3
)

```

### 2. Forward pass and reconstruction

```python
images = torch.randn(8, 3, 128, 128)  # batch of images
reconstructed, latent = model(images)

# Or just get the reconstruction
recon = model.reconstruct(images)

```

### 3. Training step (sample loop)

```python
import torch.nn.functional as F
optimizer = torch.optim.Adam(model.parameters(), lr=1e-4)

def train_step(images):
    model.train()
    optimizer.zero_grad()
    recon, _ = model(images)
    loss = F.mse_loss(recon, images)
    loss.backward()
    optimizer.step()
    return loss.item()

```

## โš™๏ธ Configuration Options

| Parameter | Description | Default |
|--|--|--|
| `dim` | Base channel size | `64` |
| `dim_mults` | List of multipliers for down/up blocks | `(1, 2, 4, 8)` |
| `dim_latent` | Latent bottleneck dimension | `64` |
| `image_channels` | Input/output image channels (e.g., 3) | `3` |
| `dropout` | Dropout probability | `0.0` |

## ๐Ÿ™‹โ€โ™‚๏ธ Author

Developed by [Mehran Bazrafkan](mailto:mhrn.bzrafkn.dev@gmail.com)
This project is an original implementation of a simplified autoencoder architecture. Some ideas and design inspirations were drawn from the open-source [`denoising-diffusion-pytorch`](https://github.com/lucidrains/denoising-diffusion-pytorch) project by Phil Wang, but the code and architecture were written independently.

## ๐Ÿ“ข Contributions & Feedback

Contributions, issues, and feedback are welcome via [GitHub Issues](https://github.com/MehranBazrafkan/convolutional-autoencoder-pytorch/issues).

## ๐Ÿ“„ License

This project is licensed under the terms of the [MIT LICENSE](https://github.com/MehranBazrafkan/convolutional-autoencoder-pytorch/blob/main/LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "convolutional-autoencoder-pytorch",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "autoencoder, pytorch, ml, deep learning",
    "author": null,
    "author_email": "Mehran Bazrafkan <mhrn.bzrafkn.dev@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/a8/2f/80804c276228810e07c537f06a8191197a47a42e72583b18642d20de3b53/convolutional_autoencoder_pytorch-0.1.0.tar.gz",
    "platform": null,
    "description": "\r\n# convolutional-autoencoder-pytorch\r\n\r\nA minimal, customizable PyTorch package for building and training convolutional autoencoders based on a simplified U-Net architecture (without skip connections). Ideal for representation learning, image compression, and reconstruction tasks.\r\n\r\n## \ud83d\udd27 Features\r\n\r\n- \ud83d\udce6 Modular architecture (`Encoder`, `Decoder`, `AutoEncoder`)\r\n- \ud83d\udd01 Symmetric U-Net-like design without skip connections\r\n- \u26a1 Tanh output activation for stable image reconstruction\r\n- \ud83e\udde0 Residual blocks with RMS normalization and SiLU activation\r\n- \ud83d\udcf1 Designed for image inputs (`3\u00d7H\u00d7W`) with configurable channels and latent dim\r\n- \ud83e\uddea Works with batched input tensors (e.g., `torch.Tensor[B, C, H, W]`)\r\n\r\n## \ud83d\udce6 Installation\r\n\r\n```bash\r\npip install convolutional-autoencoder-pytorch\r\n\r\n```\r\n\r\n## \ud83e\udde9 Package Structure\r\n\r\n```bash\r\nconvolutional-autoencoder-pytorch/\r\n\u251c\u2500\u2500 convolutional_autoencoder_pytorch/\r\n\u2502   \u251c\u2500\u2500 __init__.py\r\n\u2502   \u2514\u2500\u2500 module.py          # All architecture classes and logic\r\n\u251c\u2500\u2500 pyproject.toml\r\n\u251c\u2500\u2500 LICENSE\r\n\u2514\u2500\u2500 README.md\r\n\r\n```\r\n\r\n## \ud83d\ude80 Quick Start\r\n\r\n### 1. Import the package and create the model\r\n\r\n```python\r\nimport torch\r\nfrom convolutional_autoencoder_pytorch import AutoEncoder\r\n\r\nmodel = AutoEncoder(\r\n    dim=64,\r\n    dim_mults=(1, 2, 4, 8),\r\n    dim_latent=128,\r\n    image_channels=3\r\n)\r\n\r\n```\r\n\r\n### 2. Forward pass and reconstruction\r\n\r\n```python\r\nimages = torch.randn(8, 3, 128, 128)  # batch of images\r\nreconstructed, latent = model(images)\r\n\r\n# Or just get the reconstruction\r\nrecon = model.reconstruct(images)\r\n\r\n```\r\n\r\n### 3. Training step (sample loop)\r\n\r\n```python\r\nimport torch.nn.functional as F\r\noptimizer = torch.optim.Adam(model.parameters(), lr=1e-4)\r\n\r\ndef train_step(images):\r\n    model.train()\r\n    optimizer.zero_grad()\r\n    recon, _ = model(images)\r\n    loss = F.mse_loss(recon, images)\r\n    loss.backward()\r\n    optimizer.step()\r\n    return loss.item()\r\n\r\n```\r\n\r\n## \u2699\ufe0f Configuration Options\r\n\r\n| Parameter | Description | Default |\r\n|--|--|--|\r\n| `dim` | Base channel size | `64` |\r\n| `dim_mults` | List of multipliers for down/up blocks | `(1, 2, 4, 8)` |\r\n| `dim_latent` | Latent bottleneck dimension | `64` |\r\n| `image_channels` | Input/output image channels (e.g., 3) | `3` |\r\n| `dropout` | Dropout probability | `0.0` |\r\n\r\n## \ud83d\ude4b\u200d\u2642\ufe0f Author\r\n\r\nDeveloped by [Mehran Bazrafkan](mailto:mhrn.bzrafkn.dev@gmail.com)\r\nThis project is an original implementation of a simplified autoencoder architecture. Some ideas and design inspirations were drawn from the open-source [`denoising-diffusion-pytorch`](https://github.com/lucidrains/denoising-diffusion-pytorch) project by Phil Wang, but the code and architecture were written independently.\r\n\r\n## \ud83d\udce2 Contributions & Feedback\r\n\r\nContributions, issues, and feedback are welcome via [GitHub Issues](https://github.com/MehranBazrafkan/convolutional-autoencoder-pytorch/issues).\r\n\r\n## \ud83d\udcc4 License\r\n\r\nThis project is licensed under the terms of the [MIT LICENSE](https://github.com/MehranBazrafkan/convolutional-autoencoder-pytorch/blob/main/LICENSE).\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A package to simplify the implementing an autoencoder model.",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [
        "autoencoder",
        " pytorch",
        " ml",
        " deep learning"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "330c278f8a4b22b691f32e259b291a52b1d6bf378a8d4fd928d5de2bcb975161",
                "md5": "08a2c6e6738b03df5f9e2db3606e374e",
                "sha256": "f57d197c9fb366ab48a6454ffd9e96a462aa1cbbd2520fd24574a36e259976f7"
            },
            "downloads": -1,
            "filename": "convolutional_autoencoder_pytorch-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "08a2c6e6738b03df5f9e2db3606e374e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 5357,
            "upload_time": "2025-07-30T11:41:23",
            "upload_time_iso_8601": "2025-07-30T11:41:23.747729Z",
            "url": "https://files.pythonhosted.org/packages/33/0c/278f8a4b22b691f32e259b291a52b1d6bf378a8d4fd928d5de2bcb975161/convolutional_autoencoder_pytorch-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a82f80804c276228810e07c537f06a8191197a47a42e72583b18642d20de3b53",
                "md5": "54fdc46671e547fc6d2b7ec6a9447574",
                "sha256": "360a08e30f43a63079743c55d4ad8dc66b5027a86653738af0160bad0635cc08"
            },
            "downloads": -1,
            "filename": "convolutional_autoencoder_pytorch-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "54fdc46671e547fc6d2b7ec6a9447574",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 4607,
            "upload_time": "2025-07-30T11:41:25",
            "upload_time_iso_8601": "2025-07-30T11:41:25.350614Z",
            "url": "https://files.pythonhosted.org/packages/a8/2f/80804c276228810e07c537f06a8191197a47a42e72583b18642d20de3b53/convolutional_autoencoder_pytorch-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-30 11:41:25",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "convolutional-autoencoder-pytorch"
}
        
Elapsed time: 1.48964s