匿名用户2024年07月31日
72阅读

技术信息

官网地址
https://www.zhipu.ai
开源地址
https://modelscope.cn/models/ZhipuAI/ImageReward
授权协议
apache-2.0

作品详情

ImageReward

Github Repo • ? Twitter • ? Paper

ImageReward: Learig ad Evaluatig Huma Prefereces for Text-to-Image Geeratio

ImageReward is the first geeral-purpose text-to-image huma preferece RM which is traied o i total 137k pairs of expert comparisos, based o text prompts ad correspodig model outputs from DiffusioDB. We demostrate that ImageReward outperforms existig text-image scorig methods, such as CLIP, Aesthetic, ad BLIP, i terms of uderstadig huma preferece i text-to-image sythesis through extesive aalysis ad experimets.

ImageReward

Quick Start

Istall Depedecy

We have itegrated the whole repository to a sigle pytho package image-reward. Followig the commads below to prepare the eviromet:

# Cloe the ImageReward repository (cotaiig data for testig)
git cloe https://github.com/THUDM/ImageReward.git
cd ImageReward

# Istall the itegrated package `image-reward`
pip istall image-reward

Example Use

We provide example images i the assets/images directory of this repo. The example prompt is:

a paitig of a ocea with clouds ad birds, day time, low depth field effect

Use the followig code to get the huma preferece scores from ImageReward:

import os
import torch
import ImageReward as reward

if __ame__ == "__mai__":
    prompt = "a paitig of a ocea with clouds ad birds, day time, low depth field effect"
    img_prefix = "assets/images"
    geeratios = [f"{pic_id}.webp" for pic_id i rage(1, 5)]
    img_list = [os.path.joi(img_prefix, img) for img i geeratios]
    model = reward.load("ImageReward-v1.0")
    with torch.o_grad():
        rakig, rewards = model.iferece_rak(prompt, img_list)
        # Prit the result
        prit("\Preferece predictios:\")
        prit(f"rakig = {rakig}")
        prit(f"rewards = {rewards}")
        for idex i rage(le(img_list)):
            score = model.score(prompt, img_list[idex])
            prit(f"{geeratios[idex]:>16s}: {score:.2f}")

The output should be like as follow (the exact umbers may be slightly differet depedig o the compute device):

Preferece predictios:

rakig = [1, 2, 3, 4]
rewards = [[0.5811622738838196], [0.2745276093482971], [-1.4131819009780884], [-2.029569625854492]]
          1.webp: 0.58
          2.webp: 0.27
          3.webp: -1.41
          4.webp: -2.03

Citatio

@misc{xu2023imagereward,
      title={ImageReward: Learig ad Evaluatig Huma Prefereces for Text-to-Image Geeratio}, 
      author={Jiazheg Xu ad Xiao Liu ad Yuche Wu ad Yuxua Tog ad Qikai Li ad Mig Dig ad Jie Tag ad Yuxiao Dog},
      year={2023},
      eprit={2304.05977},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

功能介绍

ImageReward Github Repo • ? Twitter • ? Paper ImageReward: Learning and Evaluating Human Prefe

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论