https://github.com/osmr/fssim
Fused Differentiable SSIM
https://github.com/osmr/fssim
Last synced: 10 months ago
JSON representation
Fused Differentiable SSIM
- Host: GitHub
- URL: https://github.com/osmr/fssim
- Owner: osmr
- License: mit
- Created: 2025-06-30T10:54:23.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2025-07-14T12:45:58.000Z (11 months ago)
- Last Synced: 2025-07-14T14:57:08.556Z (11 months ago)
- Language: Cuda
- Size: 43.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fused Differentiable SSIM
Refactored copy of project https://github.com/rahul-goel/fused-ssim.
## Prerequisites
- python >= 3.10.
- cuda >= 11.8.
- torch.
## Installation
```bash
pip install git+https://github.com/osmr/fused_ssim
```
or
```bash
git clone git@github.com:osmr/fused_ssim.git
cd fused_ssim
# Local compilation case:
pip install .
# Multi-architecture distribution case:
CUDA_VISIBLE_DEVICES="" python -m build
```
## Usage
For training:
```python
import torch
from fused_ssim import fused_ssim
gt_image = torch.rand(2, 3, 1080, 1920).cuda()
predicted_image = torch.nn.Parameter(torch.rand_like(gt_image))
ssim_value = fused_ssim(predicted_image, gt_image)
```
For inference:
```python
with torch.no_grad():
ssim_value = fused_ssim(predicted_image, gt_image, train=False)
```
## Constraints
- Only one of the images is allowed to be differentiable i.e. only the first image can be `nn.Parameter`.
- Limited to 2D images.
- Images must be normalized to range `[0, 1]`.
- Standard `11x11` convolutions supported.