SAMScore Similarity Metric
Project description
SAMScore: A Semantic Structural Similarity Metric for Image Translation Evaluation
Yunxiang Li, Meixu Chen, Wenxuan Yang, Kai Wang, Jun Ma, Alan C. Bovik, You Zhang.
Quick start
Run pip install samscore.
pip install samscore
pip install git+https://github.com/facebookresearch/segment-anything.git
The following Python code is all you need.
import requests
import os
import samscore
def download_image(url, save_path):
response = requests.get(url)
response.raise_for_status() # Raise an exception if the request was unsuccessful
with open(save_path, 'wb') as file:
file.write(response.content)
os.makedirs('imgs', exist_ok=True)
# Example usage
image_url = 'https://i.ibb.co/yFFg5pn/n02381460-20-real.png'
save_location = 'imgs/real.png'
download_image(image_url, save_location)
image_url = 'https://i.ibb.co/GCQ2jQy/n02381460-20-fake.png'
save_location = 'imgs/fake.png'
download_image(image_url, save_location)
## Initializing the model
SAMScore_Evaluation = samscore.SAMScore(model_type = "vit_b" )
samscore_result = SAMScore_Evaluation.evaluation_from_path(source_image_path='imgs/real.png', generated_image_path='imgs/fake.png')
print('SAMScore: %.4f'%samscore_result)
Citation
If you find this repository useful for your research, please use the following.
@inproceedings{li2023samscore,
title={SAMScore: A Semantic Structural Similarity Metric for Image Translation Evaluation},
author={Yunxiang Li, Meixu Chen, Wenxuan Yang, Kai Wang, Jun Ma, Alan C. Bovik, You Zhang},
booktitle={arxiv},
year={2023}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
samscore-1.34.tar.gz
(10.8 kB
view details)
File details
Details for the file samscore-1.34.tar.gz.
File metadata
- Download URL: samscore-1.34.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0159a1cc19c8972f7706ad0bfce0f3a397ba65f0499d13c422d090b1904bbf3e
|
|
| MD5 |
00d9aac779ecbf1c1e7e159b66b6fc24
|
|
| BLAKE2b-256 |
afa51acce7de06a4fbbd8f9796656cca68ce004a7fe7e118835d5edc3c301977
|