Multimodal CIFAR Dataset
Quick Start
from cifar_rgb.datasets import create_cifar_rgb_loaders
from cifar_rgb.transforms import grayscale
train_loader, test_loader = create_cifar_rgb_loaders(
batch_size=32,
transform=grayscale,
train_ratio=0.8,
random_seed=42
)
for data, target in train_loader:
pass # data shape: (32, 3, 32, 32), target shape: (32,)
Visualization
import matplotlib.pyplot as plt
from cifar_rgb.datasets import create_cifar_rgb_loaders
from cifar_rgb.transforms import grayscale
train_loader, _ = create_cifar_rgb_loaders(
batch_size=4,
transform=grayscale,
train_ratio=0.8,
random_seed=42
)
img_rgb, label = next(iter(train_loader))[0][0], next(iter(train_loader))[1][0].item()
plt.figure(figsize=(10, 3))
plt.subplot(1, 4, 1)
plt.imshow(img_rgb.permute(1, 2, 0).numpy())
plt.title(f"RGB (Label: {label})")
plt.axis('off')
for i, (channel, title) in enumerate(zip(img_rgb, ["R/Mode 1", "G/Mode 2", "B/Mode 3"]), start=2):
plt.subplot(1, 4, i)
plt.imshow(channel.numpy(), cmap='gray')
plt.title(title)
plt.axis('off')
plt.tight_layout()
plt.show()
API Reference
RGBDataset
Wraps three grayscale datasets as RGB.
from cifar_rgb.datasets import RGBDataset
dataset = RGBDataset(
mode1_dataset,
mode2_dataset,
mode3_dataset,
train=True,
train_ratio=0.8,
random_seed=42
)
CIFARRGBData
High-level manager for CIFAR RGB datasets.
from cifar_rgb.datasets import CIFARRGBData
manager = CIFARRGBData(
data_root='./data',
transform=grayscale,
train_ratio=0.8,
random_seed=42
)
train_dataset, test_dataset = manager.get_datasets()
train_loader, test_loader = manager.get_loaders(
batch_size=32,
shuffle_train=True,
shuffle_test=False,
num_workers=0
)
Helper Functions
from cifar_rgb.datasets import create_cifar_rgb_datasets, create_cifar_rgb_loaders
# Datasets
train_dataset, test_dataset = create_cifar_rgb_datasets(
data_root='./data',
transform=grayscale,
train_ratio=0.8,
random_seed=42,
download=True
)
# Loaders
train_loader, test_loader = create_cifar_rgb_loaders(
batch_size=32,
data_root='./data',
transform=grayscale,
train_ratio=0.8,
random_seed=42,
shuffle_train=True,
shuffle_test=False,
num_workers=0,
download=True
)
Transforms
from cifar_rgb.transforms import grayscale
# grayscale = Compose([Grayscale(num_output_channels=1), ToTensor()])
Data Format
- Input: Three grayscale datasets
- Output: RGB images with:
- Red = mode1
- Green = mode2
- Blue = mode3
- Shape: (3, 32, 32)
- Labels: Taken from original datasets
Dependencies
- PyTorch
- torchvision
- matplotlib
- pytest (for tests)
Testing
pytest tests/
Examples
See examples/visualize.py for RGB channel visualization.
Metadata
Release files for mmcifar 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mmcifar-0.0.3.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mmcifar-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.1 kB
Release files / mmcifar-0.0.3.tar.gz
| Download URL | mmcifar-0.0.3.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fce03f0912c92e3495cd4c2ded419fa7234ea0136f57c66ea4351cab63291507
|
|
BLAKE2b-256 checksum How to use checksums |
444c0d0c5e9f7f162fc8d0f6420dc4b49de3f78fbd59280a351fada06dbda169
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 24, 2025.
Transparency logRelease files / mmcifar-0.0.3-py3-none-any.whl
| Download URL | mmcifar-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fdb4dae9b22523c87a09121491a10ec0057916eb9bb8dec501ad964ac58f153b
|
|
BLAKE2b-256 checksum How to use checksums |
147cfaec56e51dfefaa81285944b7d8ac02d0cfe0965c6bc6c0f87d6b0fb770b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 24, 2025.
Transparency log