如果想在转化成coco数据集中添加几个新的参数,比如天气、场景
# add information for COCO dataset
for attribute, value in i['attributes'].items():
if attribute == 'weather':
image['weather'] = value
elif attribute == 'scene':
image['location'] = value
elif attribute == 'timeofday':
image['period'] = value
在给的bdd2coco源码中添加上面一段即可,源码参考bdd100k/bdd100k/bdd2coco.py at master · ucbdrive/bdd100k (github.com)
import os
import json
import argparse
from tqdm import tqdm
def parse_arguments():
parser = argparse.ArgumentParser(description='BDD100K to COCO format')
parser.add_argument(
"-l", "--label_dir",
default="/path/to/bdd/label/",