*참고한 논문은 같이 update 해두기
Searching Tip
찾을려는 Metric 목표 (+AI 논문 타겟팅)
- description 풍부한지 (색깔 세세하고 정확하게 // 형용사구)
- syntheti.. (문장이 길어졌을 때 이게 문법적으로 말이 되는지)
IF) metric 이름도 모르는 상황이면,
- ACM DL (https://dl.acm.org/) -IEEE (https://ieeexplore.ieee.org/Xplore/home.jsp) -google scholar
- Color 토픽과 관련하여 검색
- NLP && grammar
- 논문의 Intro나 RW(Related Work)에 달려있는 관련 선행연구
1. Accuracy (오브젝트를 다르게 명명하지 않고, 제대로 명명하는가?)
BLEU
- BLEU는 정답이 되는 reference sentence와 모델로부터 생성된 문장인 generated sentence 간의 단어나 구(phrase)의 일치도를 측정하는 방식
- Example
- generated sentence : “나는 오전에 친구와 밥을 먹으러 갔다.”
- → reference sentence에 포함된 n-gram의 수 : 3
- reference sentence : “나는 / 그날 / 오전에 / 밥을 / 먹었다.”
- → 문장의 전체 n-gram 수 : 5
- →BLEU score(0~1) : 3/5 (0.6)
- Code example
- input 이미지가 아래와 같을 때
- reference sentence = "A contemporary living room featuring a pink sofa, a cozy armchair, and an abstract painting on the wall. The room is decorated with modern lighting and a potted plant, creating a warm and inviting atmosphere."
- High BLEU Score Expected
- candidate sentence(generated sentence) = "This is a modern living room with pink walls and matching pink furniture, including a sofa and two chairs. There is a large painting on the wall and a stylish lamp on a small table."
- Low BLEU Score Expected
- candidate sentence(generated sentence) = “A kitchen with a large table and chairs. There is a window and some appliances on the counter.”



import numpy as np import matplotlib.pyplot as plt from ipywidgets import interactive from nltk.translate.bleu_score import sentence_bleu, SmoothingFunction def bleu_score_only(candidate_sentence, reference_sentence): # BLEU score 계산 reference = [reference_sentence.split()] # reference는 리스트의 리스트 형태여야 합니다. candidate = candidate_sentence.split() bleu_score = sentence_bleu(reference, candidate, smoothing_function=SmoothingFunction().method1) print(f"BLEU Score: {bleu_score:.4f}") interactive_plot = interactive(bleu_score_only, candidate_sentence="This is a modern living room with pink walls and matching pink furniture, including a sofa and two chairs. There is a large painting on the wall and a stylish lamp on a small table.", reference_sentence="A contemporary living room featuring a pink sofa, a cozy armchair, and an abstract painting on the wall. The room is decorated with modern lighting and a potted plant, creating a warm and inviting atmosphere.") output = interactive_plot.children[-1] interactive_plot
→ 연구에 적용할 만한 부분 : BLUE는 언어 모델의 출력이 reference text와 얼마나 유사한지 판단하는 metrix이다. 그렇기에 reference text를 입력 이미지를 모두 표현할 수 있을만한(이미지를 표현하는 풍부한 data) sentences로 작성한 후, generated sentence과 BLUE score를 측정 —> input 이미지와 생성된 문장 간의 정확도를 수치화 가능
*이미지로부터 풍부한 설명을 만들어주는 chat GPT를 이용하여 reference sentence 제작하면 좋을 듯 함
- 한계
- 의미와 문장 구조를 고려하지 않음
- 단어의 존재만을 고려하기에 단어들 사이의 유기 관계와 의미는 고려하지 않음(reference sentence에 속한 키워드만 포함하고 있으면 score가 높아짐)
- 직접 이미지를 설명하는 reference sentence를 추가해 줘야 함
- 이미지로부터 풍부한 설명을 만들어주는 chat GPT를 이용하여 reference sentence 제작하면 좋을 듯함
2. Expression Richness (얼마나 풍부한가?)
*Color Description에 대한 Metric을 찾아보면서 자연스럽게 Metric에 맞는 모델을 같이 찾게됨.
- Aspect Planning(NLG기법) + Lexical Constraints(어휘적 제약기법)
UCEpic은 자연어 생성(Natural Language Generation, NLG) 모델
Aspect Planning: 특정한 분야(Aspect)를 정하고, 그 분야에 따라 텍스트를 생성하는 방법
Ex. 이 논문에서는 "음식의 질", "분위기", "가격”에 대한 측면을 미리 정해놓고 그 부분에 대해 설명하도록 설계함.
Lexical Constraints: 특정 단어를 반드시 포함시키거나 배제시키는 기법
논문에서 다루는 Evaluation Metric들
We evaluate the generated sentences from two aspects: generation quality and diversity. Following Ni et al. [32], Zhang et al. [45], we use n-gram metrics including BLEU (B-1 and B-2) [35], METEOR (M) [1] and ROUGE-L (R-L) [25] which measure the similarity between the generated text and human oracle. As for generation diversity, we use Distinct (D-1 and D-2) [16]. We also introduce BERT-score (BS) [42] as a semantic rather than n-gram metrics.
- Distinct (D-1 and D-2) 인용논문
- Unigram: 텍스트 내의 단일 단어를 의미
- 예를 들어, 문장 "I love AI"에서 "I", "love", "AI"는 각각 unigram
- Bigram: 텍스트 내에서 연속된 두 단어의 조합을 의미
- 예를 들어, 문장 "I love AI"에서 "I love", "love AI"는 각각 bigram
- Unigram과 Bigram 추출: 생성된 텍스트에서 모든 unigram(단일 단어)과 bigram(연속된 두 단어)을 추출
- 고유 Unigram/Bigram의 비율 계산: 전체 unigram과 bigram에서 고유한 항목의 비율을 계산
- D-1 = 고유 unigram의 수 / 전체 unigram의 수
- D-2 = 고유 bigram의 수 / 전체 bigram의 수

A Diversity-Promoting Objective Function for Neural Conversation Models
Sequence-to-sequence neural network models for generation of conversational responses tend to generate safe, commonplace responses (e.g., "I don't know") regardless of the input. We suggest that...
D-1: 생성된 텍스트에서 고유한 unigram(단일 단어)의 비율
D-2: 생성된 텍스트에서 고유한 bigram(2-그램)의 비율
계산 방법:
따라서, Distinct 점수가 높으면 다양한 표현이 사용되었음을 나타냄. (중복된 단어가 전체 문장대비 적을수록 수치 높아짐)
- BERT-score (BS) 인용논문 (진행중)
- 단어 임베딩 생성: 원본 텍스트와 생성된 텍스트를 BERT 모델에 입력하여 각 단어에 대한 임베딩 벡터 획득
- 유사성 계산: 원본 문장과 생성된 문장 사이의 각 단어 쌍에 대해 코사인 유사성 계산
- 최대 매칭: 각 단어에 대해 가장 높은 유사성을 가진 단어를 탐색
- Precision, Recall, F1 Score 계산: 단어 간의 최대 매칭을 기반으로 Precision, Recall,F1 Score를 계산 → BERT-Score 추출

BERTScore: Evaluating Text Generation with BERT
We propose BERTScore, an automatic evaluation metric for text generation. Analogously to common metrics, BERTScore computes a similarity score for each token in the candidate sentence with each...
따라서, BERT-Score가 높으면 생성된 문장이 의미적으로 원본과 유사하다는 의미를 나타냄.