Instructions to use hugaagg/IR_expeiment with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use hugaagg/IR_expeiment with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("hugaagg/IR_expeiment", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
File size: 1,320 Bytes
2ecc7ab | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | ## Restormer: Efficient Transformer for High-Resolution Image Restoration
## Syed Waqas Zamir, Aditya Arora, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan, and Ming-Hsuan Yang
## https://arxiv.org/abs/2111.09881
import numpy as np
import os
import cv2
import math
from skimage import metrics
from sklearn.metrics import mean_absolute_error
def MAE(img1, img2):
mae_0=mean_absolute_error(img1[:,:,0], img2[:,:,0],
multioutput='uniform_average')
mae_1=mean_absolute_error(img1[:,:,1], img2[:,:,1],
multioutput='uniform_average')
mae_2=mean_absolute_error(img1[:,:,2], img2[:,:,2],
multioutput='uniform_average')
return np.mean([mae_0,mae_1,mae_2])
def PSNR(img1, img2):
mse_ = np.mean( (img1 - img2) ** 2 )
if mse_ == 0:
return 100
return 10 * math.log10(1 / mse_)
def SSIM(img1, img2):
return metrics.structural_similarity(img1, img2, data_range=1, multichannel=True)
def load_img(filepath):
return cv2.cvtColor(cv2.imread(filepath), cv2.COLOR_BGR2RGB)
def load_img16(filepath):
return cv2.cvtColor(cv2.imread(filepath, -1), cv2.COLOR_BGR2RGB)
def save_img(filepath, img):
cv2.imwrite(filepath,cv2.cvtColor(img, cv2.COLOR_RGB2BGR))
|