All Projects → Po-Hsun-Su → Pytorch Ssim

Po-Hsun-Su / Pytorch Ssim

Licence: other
pytorch structural similarity (SSIM) loss

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pytorch Ssim

Sod
An Embedded Computer Vision & Machine Learning Library (CPU Optimized & IoT Capable)
Stars: ✭ 1,460 (+38%)
Mutual labels:  image-processing, image-analysis
Imageprocessing
MicaSense RedEdge and Altum image processing tutorials
Stars: ✭ 139 (-86.86%)
Mutual labels:  image-processing, image-analysis
Blind image quality toolbox
Collection of Blind Image Quality Metrics in Matlab
Stars: ✭ 105 (-90.08%)
Mutual labels:  image-processing, image-analysis
Pixlab
PixLab Resources & Sample Set
Stars: ✭ 74 (-93.01%)
Mutual labels:  image-processing, image-analysis
Menyoki
Screen{shot,cast} and perform ImageOps on the command line 🌱 🏞️
Stars: ✭ 255 (-75.9%)
Mutual labels:  image-processing, image-analysis
Resdet
Detect source resolution of upscaled images
Stars: ✭ 191 (-81.95%)
Mutual labels:  image-processing, image-analysis
Mindboggle
Automated anatomical brain label/shape analysis software (+ website)
Stars: ✭ 112 (-89.41%)
Mutual labels:  image-processing, image-analysis
Simpleitk
SimpleITK: a layer built on top of the Insight Toolkit (ITK), intended to simplify and facilitate ITK's use in rapid prototyping, education and interpreted languages.
Stars: ✭ 458 (-56.71%)
Mutual labels:  image-processing, image-analysis
Image Js
Image processing and manipulation in JavaScript
Stars: ✭ 241 (-77.22%)
Mutual labels:  image-processing, image-analysis
Pyimsegm
Image segmentation - general superpixel segmentation & center detection & region growing
Stars: ✭ 213 (-79.87%)
Mutual labels:  image-processing, image-analysis
Image Similarity
计算图片之间的相似度
Stars: ✭ 292 (-72.4%)
Mutual labels:  image-processing, image-analysis
Segment Open
Segment Source Distribution
Stars: ✭ 34 (-96.79%)
Mutual labels:  image-processing, image-analysis
Photoassessment
Photo Assessment using Core ML and Metal.
Stars: ✭ 40 (-96.22%)
Mutual labels:  image-analysis
Nimp
Nimp - Node-based image manipulation program.
Stars: ✭ 45 (-95.75%)
Mutual labels:  image-processing
Rapiddraw
A simple artificial intelligence experiment to find out if mobile neural networks can recognize human-made doodles
Stars: ✭ 39 (-96.31%)
Mutual labels:  image-processing
Pan card ocr project
To extract details from Indian National Identification Cards such as PAN (completed) & Aadhar, Passport, Driving License (WIP) in a structured format
Stars: ✭ 39 (-96.31%)
Mutual labels:  image-processing
Seeds Revised
Implementation of the superpixel algorithm called SEEDS [1].
Stars: ✭ 48 (-95.46%)
Mutual labels:  image-processing
React Filepond
🔌 A handy FilePond adapter component for React
Stars: ✭ 1,024 (-3.21%)
Mutual labels:  image-processing
Openexr
The OpenEXR project provides the specification and reference implementation of the EXR file format, the professional-grade image storage format of the motion picture industry.
Stars: ✭ 992 (-6.24%)
Mutual labels:  image-processing
Itkexamples
Cookbook examples for the Insight Toolkit documented with Sphinx
Stars: ✭ 38 (-96.41%)
Mutual labels:  image-analysis

pytorch-ssim

Differentiable structural similarity (SSIM) index.

einstein Max_ssim

Installation

  1. Clone this repo.
  2. Copy "pytorch_ssim" folder in your project.

Example

basic usage

import pytorch_ssim
import torch
from torch.autograd import Variable

img1 = Variable(torch.rand(1, 1, 256, 256))
img2 = Variable(torch.rand(1, 1, 256, 256))

if torch.cuda.is_available():
    img1 = img1.cuda()
    img2 = img2.cuda()

print(pytorch_ssim.ssim(img1, img2))

ssim_loss = pytorch_ssim.SSIM(window_size = 11)

print(ssim_loss(img1, img2))

maximize ssim

import pytorch_ssim
import torch
from torch.autograd import Variable
from torch import optim
import cv2
import numpy as np

npImg1 = cv2.imread("einstein.png")

img1 = torch.from_numpy(np.rollaxis(npImg1, 2)).float().unsqueeze(0)/255.0
img2 = torch.rand(img1.size())

if torch.cuda.is_available():
    img1 = img1.cuda()
    img2 = img2.cuda()


img1 = Variable( img1,  requires_grad=False)
img2 = Variable( img2, requires_grad = True)


# Functional: pytorch_ssim.ssim(img1, img2, window_size = 11, size_average = True)
ssim_value = pytorch_ssim.ssim(img1, img2).data[0]
print("Initial ssim:", ssim_value)

# Module: pytorch_ssim.SSIM(window_size = 11, size_average = True)
ssim_loss = pytorch_ssim.SSIM()

optimizer = optim.Adam([img2], lr=0.01)

while ssim_value < 0.95:
    optimizer.zero_grad()
    ssim_out = -ssim_loss(img1, img2)
    ssim_value = - ssim_out.data[0]
    print(ssim_value)
    ssim_out.backward()
    optimizer.step()

Reference

https://ece.uwaterloo.ca/~z70wang/research/ssim/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].