MCPcopy Create free account
hub / github.com/allenai/molmo2 / detect_format

Method detect_format

olmo/eval/object_tracking_utils.py:129–138  ·  view source on GitHub ↗

Heuristic to detect format of the prediction text.

(text)

Source from the content-addressed store, hash-verified

127
128 @staticmethod
129 def detect_format(text) -> str:
130 """ Heuristic to detect format of the prediction text."""
131 if re.search(r'time\s+\d+\.?\d*', text):
132 return 'video_track'
133 elif re.search(r'\d+:\s*\(\s*\[.*?\]\s*,\s*\[.*?\]\s*\)', text):
134 return 'video_ground'
135 elif re.search(r'\[\s*[\d.-]+\s*,\s*[\d.-]+\s*,\s*[\d.-]+\s*\]', text):
136 return 'video_single_point_track'
137 else:
138 raise ValueError("Could not detect format of prediction text.")
139
140def extract_video_point_track_per_frame(text, width, height) -> List[Dict]:
141 """

Callers 1

parse_predictionMethod · 0.80

Calls 1

searchMethod · 0.80

Tested by

no test coverage detected