forked from cvlab-columbia/viper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
53 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
Correct Example: | ||
def execute_command(video, annotation, possible_answers, query)->[str, dict]: | ||
# Trope: Asshole Victim | ||
# Definition: A narrative trope where the victim of a crime or misdeed is someone who had it coming because they were themselves morally dubious or outright villainous. | ||
# Thought Process: | ||
# 1. Frame Selection: This trope involves identifying both the 'victim' and the act leading to their victimhood, suggesting a need for comprehensive analysis throughout the video. | ||
# 2. Character Analysis: Identify the 'victim' character and analyze their actions or character traits that justify the trope's criteria. | ||
# 3. Incident Analysis: Look for an incident within the video that cements the character's role as a victim. | ||
# 4. Morality Check: Determine if there's a narrative or visual cue indicating the victim's negative moral standing. | ||
# 5. Answer Selection: Using the collected data, decide whether the "Asshole Victim" trope is present. | ||
video_segment = VideoSegment(video, annotation) | ||
# Initialize a dictionary to store information collected during analysis | ||
info = {} | ||
for i, frame in enumerate(video_segment.frame_iterator()): | ||
# Assume function exists to identify characters and incidents | ||
if frame.exists("person"): | ||
incident_description = frame.simple_query("Describe the incident happened in the image.") | ||
info[f"Character trait in {i}th frame"] = [] | ||
info[f"Morality check in {i}th frame"] = [] | ||
for person in frame.find("person"): | ||
# Analyze the character's actions or traits | ||
person_trait = person.simple_query("What is the person doing? What are his/her traits?") | ||
morality_query = frame.simple_query(subtitles_info + "Does the he/she show negative moral traits?", to_yesno=True) | ||
# Store the collected information | ||
info[f"Character trait in {i}th frame"].append(character_trait) | ||
info[f"Morality check in {i}th frame"].append(morality_query) | ||
info[f"Incident description in {i}th frame"] = incident_description | ||
# After collecting information, use it to determine the presence of the trope | ||
answer, reason = video_segment.select_answer(info, query, possible_answers) | ||
return answer, reason, info | ||
def execute_command(video, annotation, possible_answers, query)->[str, dict]: | ||
# Trope: Asshole Victim | ||
# Definition: A narrative trope where the victim of a crime or misdeed is someone who had it coming because they were themselves morally dubious or outright villainous. | ||
# Thought Process: | ||
# 1. Frame Selection: This trope involves identifying both the 'victim' and the act leading to their victimhood, suggesting a need for comprehensive analysis throughout the video. | ||
# 2. Character Analysis: Identify the 'victim' character and analyze their actions or character traits that justify the trope's criteria. | ||
# 3. Incident Analysis: Look for an incident within the video that cements the character's role as a victim. | ||
# 4. Morality Check: Determine if there's a narrative or visual cue indicating the victim's negative moral standing. | ||
# 5. Answer Selection: Using the collected data, decide whether the "Asshole Victim" trope is present. | ||
video_segment = VideoSegment(video, annotation) | ||
# Initialize a dictionary to store information collected during analysis | ||
info = {} | ||
for i, frame in enumerate(video_segment.frame_iterator()): | ||
# Assume function exists to identify characters and incidents | ||
if frame.exists("person"): | ||
incident_description = frame.simple_query("Describe the incident happened in the image.") | ||
info[f"Character trait in {i}th frame"] = [] | ||
info[f"Morality check in {i}th frame"] = [] | ||
for person in frame.find("person"): | ||
# Analyze the character's actions or traits | ||
person_trait = person.simple_query("What is the person doing? What are his/her traits?") | ||
morality_query = frame.simple_query("Does the he/she show negative moral traits?", to_yesno=True) | ||
# Store the collected information | ||
info[f"Character trait in {i}th frame"].append(person_trait) | ||
info[f"Morality check in {i}th frame"].append(morality_query) | ||
info[f"Incident description in {i}th frame"] = incident_description | ||
# After collecting information, use it to determine the presence of the trope | ||
answer, reason = video_segment.select_answer(info, query, possible_answers) | ||
return answer, reason, info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
Incorrect Example: | ||
def execute_command(video, annotation, possible_answers, query)->[str, str, dict]: | ||
# Trope: Stealth Pun | ||
# Definition: A joke, typically a pun, is included by the writers but is not highlighted with a punchline or explicit statement. It's hidden within the setup of the joke, requiring the audience to notice and interpret it themselves. | ||
# Thought Process: | ||
# 1. Frame Selection: Analyze each frame for potential visual or audio cues that might indicate a hidden joke or pun. This requires understanding both the context and the elements present in the scene. | ||
# 2. Contextual Analysis: Since the essence of a Stealth Pun lies in the setup and requires audience interpretation, we need to look for elements that are inconspicuously out of place or cleverly integrated into the context but might not be immediately obvious. | ||
# 3. Detecting Puns: This involves analyzing the text or dialogue for play on words, and visual elements for any visual puns or jokes that rely on the visual context but are not explicitly acknowledged in the video. | ||
# 4. Answer Selection: Use the select_answer API to determine the most probable answer based on the analyzed data, considering the subtlety and clever integration of puns within the video content. | ||
video_segment = VideoSegment(video, annotation) | ||
# Create an info dictionary to hold detected elements that might contribute to a Stealth Pun | ||
info = {} | ||
for i, frame in enumerate(video_segment.frame_iterator()): | ||
# Assuming functions exist for detecting puns in dialogue or visual elements | ||
has_pun_in_dialogue = frame.simple_query("Are there any puns in the dialogue?", to_yesno=True) | ||
has_visual_pun = frame.simple_query("Are there any visual puns?", to_yesno=True) | ||
# If either dialogue or visual analysis suggests a pun, collect this information | ||
if "yes" in has_pun_in_dialogue.lower() or "yes" in has_visual_pun.lower(): | ||
dialogue_analysis = frame.simple_query("What pun is in the dialogue?") | ||
visual_pun_analysis = frame.simple_query("What visual pun is in the frame?") | ||
info[f"Pun in dialogue at frame {i}"] = dialogue_analysis | ||
info[f"Visual pun at frame {i}"] = visual_pun_analysis | ||
# Since Stealth Puns are about subtlety and not explicitly pointing out the joke, we need to balance detection with the likelihood of an actual pun being present without explicit acknowledgment. | ||
answer, reason = video_segment.select_answer(info, query, possible_answers) | ||
return answer, reason, info | ||
def execute_command(video, annotation, possible_answers, query)->[str, str, dict]: | ||
# Trope: Stealth Pun | ||
# Definition: A joke, typically a pun, is included by the writers but is not highlighted with a punchline or explicit statement. It's hidden within the setup of the joke, requiring the audience to notice and interpret it themselves. | ||
# Thought Process: | ||
# 1. Frame Selection: Analyze each frame for potential visual or audio cues that might indicate a hidden joke or pun. This requires understanding both the context and the elements present in the scene. | ||
# 2. Contextual Analysis: Since the essence of a Stealth Pun lies in the setup and requires audience interpretation, we need to look for elements that are inconspicuously out of place or cleverly integrated into the context but might not be immediately obvious. | ||
# 3. Detecting Puns: This involves analyzing the text or dialogue for play on words, and visual elements for any visual puns or jokes that rely on the visual context but are not explicitly acknowledged in the video. | ||
# 4. Answer Selection: Use the select_answer API to determine the most probable answer based on the analyzed data, considering the subtlety and clever integration of puns within the video content. | ||
video_segment = VideoSegment(video, annotation) | ||
# Create an info dictionary to hold detected elements that might contribute to a Stealth Pun | ||
info = {} | ||
for i, frame in enumerate(video_segment.frame_iterator()): | ||
# Assuming functions exist for detecting puns in dialogue or visual elements | ||
has_pun_in_dialogue = frame.simple_query("Are there any puns in the dialogue?", to_yesno=True) | ||
has_visual_pun = frame.simple_query("Are there any visual puns?", to_yesno=True) | ||
# If either dialogue or visual analysis suggests a pun, collect this information | ||
if "yes" in has_pun_in_dialogue.lower() or "yes" in has_visual_pun.lower(): | ||
dialogue_analysis = frame.simple_query("What pun is in the dialogue?") | ||
visual_pun_analysis = frame.simple_query("What visual pun is in the frame?") | ||
info[f"Pun in dialogue at frame {i}"] = dialogue_analysis | ||
info[f"Visual pun at frame {i}"] = visual_pun_analysis | ||
# Since Stealth Puns are about subtlety and not explicitly pointing out the joke, we need to balance detection with the likelihood of an actual pun being present without explicit acknowledgment. | ||
answer, reason = video_segment.select_answer(info, query, possible_answers) | ||
return answer, reason, info |