<jupyter_start><jupyter_text>SSIM[git](https://github.com/Po-Hsun-Su/pytorch-ssim)The Structural SIMilarity (SSIM) index is a method for measuring the similarity between two images. The SSIM index can be viewed as a quality measure of one of the images being compared, provided the other image is regarded as of perfect quality. It is an improved version of the universal image quality index proposed before.<jupyter_code>import pytorch_ssim
import torch
from torch.autograd import Variable
from torch import optim
import cv2
import numpy as np
import matplotlib.pyplot as plt
Img1 = cv2.imread(r"C:\Users\CIG\Documents\MATLAB\imgs\img_0_True_52_40662146706809.png")
Img2 = cv2.imread(r"C:\Users\CIG\Documents\MATLAB\imgs\img_7_True_54.02207809591889.png")
plt.imshow(Img1)
plt.imshow(Img2)
img1 = torch.from_numpy(np.rollaxis(Img1, 2)).float().unsqueeze(0)/255.0
img2 = torch.from_numpy(np.rollaxis(Img2, 2)).float().unsqueeze(0)/255.0

pytorch_ssim.ssim(img2, img1)<jupyter_output><empty_output><jupyter_text>Blurring detection in one hour by PyTorch[Medium](https://medium.com/@dmitriiborkin/blurring-detection-in-one-hour-by-pytorch-1d55e47ff84b)  NIMA: Neural Image Assessment[git](https://github.com/idealo/image-quality-assessment)В папке есть сохранненые веса для модели, [загрузка весов](https://www.tensorflow.org/tutorials/keras/save_and_load)```./predict  \--docker-image nima-cpu \--base-model-name MobileNet \--weights-file $(pwd)/models/MobileNet/weights_mobilenet_technical_0.11.hdf5 \--image-source $(pwd)/src/tests/test_images/42039.jpg```[MobileNet](https://github.com/tensorflow/models/tree/master/research/slim/nets/mobilenet)<jupyter_code>#!git clone https://github.com/tensorflow/models
# from __future__ import print_function
# from IPython import display 
# base_name = checkpoint_name = 'mobilenet_v2_1.0_224' #@param
# url = 'https://storage.googleapis.com/mobilenet_v2/checkpoints/' + checkpoint_name + '.tgz'
# print('Downloading from ', url)
# !wget {url}
# print('Unpacking')
# !tar -xvf {checkpoint_name}.tgz
# checkpoint = checkpoint_name + '.ckpt'

# display.clear_output()
# print('Successfully downloaded checkpoint from ', url,
#       '. It is available as', checkpoint)
#!wget https://upload.wikimedia.org/wikipedia/commons/f/fe/Giant_Panda_in_Beijing_Zoo_1.JPG -O panda.jpg
# setup path
# import sys
# sys.path.append(r'C:\Users\CIG\Documents\MATLAB\models\research\slim')
#import tensorflow.compat.v1 as tf
#from nets.mobilenet import mobilenet_v2
import tensorflow as tf
model = tf.keras.applications.MobileNetV2()
# Create a new model instance
#model = 

# Restore the weights
#model.load_weights(r'C:\Users\CIG\Documents\image_quality_assessment_master\models\MobileNet\checkpoints\weights_mobilenet_aesthetic_0.07')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12652329749103944, 'fraction_numerical': 0.03189964157706093, 'mean_word_length': 5.908415841584159, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 8, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '456877', 'license': 'MIT', 'n_tokens_mistral': 1066, 'n_tokens_neox': 996, 'n_words': 190, 'path': 'basler_camera/image_qual_as/Image_quality_assessment.ipynb', 'repo_name': 'cviaai/DASHA', 'size': '2790'}