Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gsahonero/dists.jl
A Julia implementation of Deep Image Structure and Texture Similarity (DISTS) metric
https://github.com/gsahonero/dists.jl
deep-learning dists image-metrics julia metrics
Last synced: about 1 month ago
JSON representation
A Julia implementation of Deep Image Structure and Texture Similarity (DISTS) metric
- Host: GitHub
- URL: https://github.com/gsahonero/dists.jl
- Owner: gsahonero
- License: mit
- Created: 2024-11-15T15:54:10.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-18T20:48:06.000Z (about 2 months ago)
- Last Synced: 2024-11-26T06:08:20.976Z (about 1 month ago)
- Topics: deep-learning, dists, image-metrics, julia, metrics
- Language: Julia
- Homepage:
- Size: 51.3 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DISTS.jl
[![Build Status](https://github.com/gsahonero/DISTS.jl/actions/workflows/CI.yml/badge.svg?branch=master)](https://github.com/gsahonero/DISTS.jl/actions/workflows/CI.yml?query=branch%3Amaster)A Julia implementation of Deep Image Structure and Texture Similarity (DISTS) metric. This implementation follows the logic implemented in [DISTS](https://github.com/dingkeyan93/DISTS/tree/master). Please, check [comments](#comments) before using.
## Setup
For now:```julia
using Pkg;
Pkg.add(url="https://github.com/gsahonero/DISTS.jl")
Pkg.dev("DISTS")
```## Usage
The classic example:
```julia
using DISTS
using Images# Read images
ref = Images.load("../images/r0.png")
dist = Images.load("../images/r1.png")# Load the pretrained network parameters and perceptual weights
net_params, weights = load_weights("../DISTS/weights/net_param.mat", "../DISTS/weights/alpha_beta.mat")# Define resize image flag and use_gpu flag
resize_img = false # If required. Its usage is not trivial.
use_gpu = false # GPU acceleration is not implemented yet# Calculate the perceptual quality score (DISTS)
score = DISTS_score(ref, dist, net_params, weights, resize_img, use_gpu; pretraining = "DISTS")# Output the score
println("Perceptual quality score: ", score)
```## Parameters of `DISTS_score`
- `ref`:`Image` - reference image
- `dist`:`Image` - distorted image
- `net_params`: `Dict` - holds the weights from `net_params.mat` available at the original repository.
- `weights`: `Dict` - holds the alpha-beta weights from `alpha_beta.mat`.
- `resize_img`: `Boolean` - to enable the use of `imresize` when applies
- `use_gpu`: `Boolean` - to enable GPU acceleration (not implemented yet)
- `pretraining`:`String` - defines which pretraining setup will be used. By default set to "DISTS". It supports "Flux" an "Mixed". "Flux" loads the 16 layers of VGG without modification. "Mixed" loads the convolutional layers of VGG without modification, but the pooling layers weights use the weights from `net_params.mat`## Comments
- (AFAIK) Julia does not have an implementation of the DISTS metric, this "package" should do the trick.
- Flux implementation seems to produce different results with respect to PyTorch and MATLAB despite having the same weights. The results are similar and consistent, though.
- The DISTS score between two equal images is near to zero.
- Pooling layers from DISTS are implemented as DepthwiseConvolutions.