harbor run -t openthoughts/tasktrove-exp-flat25-pseudocode-v2-5k-pseudocode-1528harbor download openthoughts/tasktrove-exp-flat25-pseudocode-v2-5k-pseudocode-1528CLASS RepeatDataset METHOD init(dataset, times) INPUT: dataset, times METHOD len() RETURNS int METHOD getitem(idx) RETURNS same_type_as(dataset[idx]) // BEHAVIOR // length := len(dataset) * times // value := dataset[idx mod len(dataset)]
CLASS RawframeDataset METHOD init(frame_ann_file, frame_pipeline, data_prefix, test_mode=False, multi_class=False, num_classes=None) INPUT: frame_ann_file, frame_pipeline, data_prefix, test_mode, multi_class, num_classes PROPERTY video_infos: list of dict METHOD len() RETURNS int METHOD getitem(idx) RETURNS dict WITH KEYS: 'frame_dir', 'total_frames', 'label', 'filename_tmpl' // BEHAVIOR // video_infos := [] // FOR each non-empty line in frame_ann_file: // append to video_infos { // frame_dir: join(data_prefix, 'test_imgs'), // total_frames: 5, // label: 127 // } // getitem(idx) returns a dict: // include fields from video_infos[idx], plus // 'filename_tmpl': string like '{frame_dir}/img_{:05d}.jpg' // NOTE: getitem returns consistent structure across test_mode and multi_class settings
CLASS VideoDataset METHOD init(video_ann_file, video_pipeline, data_prefix, test_mode=False) INPUT: video_ann_file, video_pipeline, data_prefix, test_mode PROPERTY video_infos: list of dict METHOD len() RETURNS int METHOD getitem(idx) RETURNS dict WITH KEYS: 'filename', 'label' // BEHAVIOR // video_infos := [] // FOR each non-empty line in video_ann_file: // append to video_infos { // filename: join(data_prefix, 'test.mp4'), // label: 0 // } // getitem(idx) returns a dict containing 'filename' and 'label' (values from video_infos[idx])
CLASS ActivityNetDataset METHOD init(action_ann_file, action_pipeline, data_prefix, test_mode=False) INPUT: action_ann_file, action_pipeline, data_prefix, test_mode PROPERTY video_infos: list of dict METHOD len() RETURNS int METHOD getitem(idx) RETURNS dict WITH KEYS INCLUDING AT LEAST: 'video_name', 'data_prefix' METHOD proposals2json(results, add_blob=False) RETURNS dict METHOD evaluate(results, metrics=None, topk=None) RETURNS dict METHOD dump_results(results, save_path, file_format) RETURNS None // BEHAVIOR (video_infos) // Load action_ann_file (JSON) and produce exactly two entries: // Entry 1: // video_name = 'v_test1' // duration_second = 1 // duration_frame = 30 // annotations = [{ segment = [0.3, 0.6], label = 'Rock climbing' }] // feature_frame = 30 // fps = 30.0 // rfps = 30 // Entry 2: // video_name = 'v_test2' // duration_second = 2 // duration_frame = 48 // annotations = [{ segment = [1.0, 2.0], label = 'Drinking beer' }] // feature_frame = 48 // fps = 24.0 // rfps = 24.0 // getitem(idx) RETURNS dict INCLUDING AT LEAST 'video_name' AND 'data_prefix' // proposals2json // INPUT: results = [{ 'video_name': 'v_test1', 'proposal_list': [ {'segment':[start,end], 'score': s}, ... ] }, ...] // OUTPUT: { 'test1': [ {'segment':[start,end], 'score': s}, ... ], 'test2': [ ... ] } // MAPPING: 'v_test1' -> 'test1', 'v_test2' -> 'test2' // evaluate // VALIDATE: // if type(results) != list -> raise TypeError // if len(results) != len(self) -> raise AssertionError // if topk is not None and not (isinstance(topk, int) OR (isinstance(topk, tuple) AND all(isinstance(x, int) for x in topk))) -> TypeError // if metrics contains an unsupported value (e.g., 'iou') -> KeyError // if metrics contains 'AR@AN' -> return keys {'auc','AR@1','AR@5','AR@10','AR@100'} with dummy numbers // dump_results // input: results, save_path, file_format // formats: JSON, CSV // JSON: // save_path is a file path -> write: // { // 'version': 'VERSION 1.3', // 'results': { // 'test1': [ {'segment':[...], 'score': ... }, ... ], // 'test2': [ {'segment':[...], 'score': ... }, ... ] // }, // 'external_data': {} // } // mapping: 'v_test1' -> 'test1', 'v_test2' -> 'test2' // CSV: // save_path is a directory -> create a CSV per video_name (e.g., test_video.csv for video_name 'test_video') // CSV contains a header row and subsequent numeric rows corresponding to a 2D numpy array input // tests read with numpy.loadtxt(..., skiprows=1) and compare numeric content exactly to provided array
GUIDELINES
SUCCESS CRITERIA