--- license: afl-3.0 tags: - feature_extraction - image - perceptual_metric datasets: - Jorgvt/TID2008 - TID2013 metrics: - pearsonr model-index: - name: PerceptNet results: - task: type: feature_extraction name: Perceptual Distance dataset: type: image name: tid2013 metrics: - type: pearsonr value: 0.93 name: PearsonR (MOS) --- # PerceptNet PercepNet model trained on TID2008 and validated on TID2013, obtaining 0.97 and 0.93 Pearson Correlation respectively. Link to the run: https://wandb.ai/jorgvt/PerceptNet/runs/28m2cnzj?workspace=user-jorgvt # Usage There are two alternatives to use the model: install our development repo and load the pretrained weights manually, and load the model using `from_pretrained_keras`: ## Loading weights manually As of now to use the model you have to install the [PerceptNet repo](https://github.com/Jorgvt/perceptnet) to get access to the `PerceptNet` class where you will load the weights available here like this: ```python from perceptnet.networks import PerceptNet from tensorflow.keras.utils import get_file weights_path = get_file(fname='perceptnet_rgb.h5', origin='https://huggingface.co/Jorgvt/PerceptNet/resolve/main/tf_model.h5') model = PerceptNet(kernel_initializer='ones', gdn_kernel_size=1, learnable_undersampling=False) model.build(input_shape=(None, 384, 512, 3)) model.load_weights(weights_path) ``` > PerceptNet requires `wandb` to be installed. It's something we're looking into. ## Directly from the Hub As every other *Keras* model in the Hub, it can be loaded as follows: ```python from huggingface_hub import from_pretrained_keras model = from_pretrained_keras("Jorgvt/PerceptNet", compile=False) ``` > Keep in mind that the model uses grouped convolutions and, at least in Colab, `Unimplemented Errors` may arise when using it in CPU.