local_recall.py
def local_recall_counts(generated, ref_data):
    """
    Get local recall counts, with a counter for both recalled and missed words,
    split by frequency class.
    """
    recalled_counter = defaultdict(Counter)
    missed_counter = defaultdict(Counter)
    for image, references in ref_data.items():
        # Count the content words in each of the reference descriptions.
        word_counter = Counter()
        for reference in references:
            words = {word for word, tag in reference if content_pos(tag)}
            word_counter.update(words)
        # Create a set of generated words, based on the generated description.
        generated_words = set(generated[image])
        # Loop over the words, and their counts in the reference data.
        for word, count in word_counter.items():
            # We categorize these words by their frequency in the references.
            # In other words: how many descriptions contain this word?
            # If a word is produced by more annotators, we consider it to be more important.
            if word in generated_words:
                # If the word is actually produced, we count that specific word and its frequency class.
                recalled_counter[count][word] += 1
            else:
                # If it's not actually produced, we also count it using a separate counter.
                missed_counter[count][word] += 1
    return recalled_counter, missed_counter

    Get local recall counts, with a counter for both recalled and missed words,
    split by frequency class.
    
Get local recall counts, with a counter for both recalled and missed words,
split by frequency class.
Get local recall counts with a counter for both recalled and missed words split by frequency class .
def local_recall_counts(generated, ref_data):
    recalled_counter = defaultdict(Counter)
    missed_counter = defaultdict(Counter)
    for image, references in ref_data.items():
        word_counter = Counter()
        for reference in references:
            words = {word for word, tag in reference if content_pos(tag)}
            word_counter.update(words)
        generated_words = set(generated[image])
        for word, count in word_counter.items():
            if word in generated_words:
                recalled_counter[count][word] += 1
            else:
                missed_counter[count][word] += 1
    return recalled_counter, missed_counter
def local_recall_counts ( generated , ref_data ) : recalled_counter = defaultdict ( Counter ) missed_counter = defaultdict ( Counter ) for image , references in ref_data . items ( ) : word_counter = Counter ( ) for reference in references : words = { word for word , tag in reference if content_pos ( tag ) } word_counter . update ( words ) generated_words = set ( generated [ image ] ) for word , count in word_counter . items ( ) : if word in generated_words : recalled_counter [ count ] [ word ] += 1 else : missed_counter [ count ] [ word ] += 1 return recalled_counter , missed_counter
Get local recall counts, with a counter for both recalled and missed words,
split by frequency class.
Get local recall counts with a counter for both recalled and missed words split by frequency class .
"""
    Get local recall counts, with a counter for both recalled and missed words,
    split by frequency class.
    """ # Count the content words in each of the reference descriptions. # Create a set of generated words, based on the generated description. # Loop over the words, and their counts in the reference data. # We categorize these words by their frequency in the references. # In other words: how many descriptions contain this word? # If a word is produced by more annotators, we consider it to be more important. # If the word is actually produced, we count that specific word and its frequency class. # If it's not actually produced, we also count it using a separate counter.
generated
ref_data