@@ -0,0 +1,1256 @@
+#!/usr/bin/env python%0A%0Aimport sys%0Aimport os.path as osp%0Aimport os%0Aimport argparse%0Athis_dir = osp.dirname(__file__)%0Asys.path.insert(0, osp.join(this_dir, '../../external/'))%0Afrom vdetlib.utils.protocol import proto_load, frame_path_at, annots_at_frame%0Aimport shutil%0A%0Aif __name__ == '__main__':%0A    parser = argparse.ArgumentParser()%0A    parser.add_argument('vid_proto')%0A    parser.add_argument('annot_proto')%0A    parser.add_argument('save_dir')%0A    args = parser.parse_args()%0A%0A    vid_proto = proto_load(args.vid_proto)%0A    annot_proto = proto_load(args.annot_proto)%0A    if not osp.isdir(args.save_dir):%0A        os.makedirs(args.save_dir)%0A%0A    for frame in vid_proto%5B'frames'%5D:%0A        frame_id = frame%5B'frame'%5D%0A        image_path = frame_path_at(vid_proto, frame_id)%0A        annots = annots_at_frame(annot_proto, frame_id)%0A        cls_idx = %5Bannot%5B'class_index'%5D for annot in annots%5D%0A        uniq_cls = set(cls_idx)%0A        for cls in uniq_cls:%0A            save_dir = osp.join(args.save_dir,%0A                %22%7B:02d%7D%22.format(cls))%0A            if not osp.isdir(save_dir):%0A                os.makedirs(save_dir)%0A            save_path = osp.join(save_dir,%0A                '_'.join(image_path.split('/')%5B-2:%5D))%0A            shutil.copyfile(image_path, save_path)%0A

Add script select class images from video protocols.