在mongodb的bin目录下, 有一个mongoexport, 可用于数据的导出 [wenbronk@localhost bin]$ ./mongoexport --help Usage: mongoexport <options> Export data from MongoDB in CSV or JSON format. See http://docs.mongodb.org/manual/reference/program/mongoexport/ for more informat…
需求: validationImages.csv文件是存储验证集数据名称和类别信息(labels)的文件, 要生成一个label和类别名一一对应且正序排列的json文件,代码如下: labels_dict = {} with open(os.path.join(os.getcwd(), 'validationImages.csv')) as f: reader = csv.reader(f) for row in reader: if row[0].split(os.sep)[-2][4:] n…