data_io.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:TPN 作者: myfavouritekk 项目源码 文件源码
def save_track_proto_to_zip(track_proto, save_file):
    zf = zipfile.ZipFile(save_file, 'w', allowZip64=True)
    print "Writing to zip file {}...".format(save_file)
    track_id = 0
    for track in track_proto['tracks']:
        track_obj = {}
        for key in track[0]:
            try:
                track_obj[key] = np.asarray([box[key] for box in track])
            except KeyError:
                continue
        zf.writestr('{:06d}.pkl'.format(track_id),
            cPickle.dumps(track_obj, cPickle.HIGHEST_PROTOCOL))
        track_id += 1
        if (track_id + 1) % 1000 == 0:
            print "\t{} tracks written.".format(track_id + 1)
    print "\tTotally {} tracks written.".format(track_id + 1)
    zf.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号