Python 脚本将 SUN397 数据集转换为 ImageNet 格式
import os
dataset_dir = '/mnt/disk1/gjh/data/SCENE/SUN397'
for root, dirs, files in os.walk(dataset_dir): for dir in dirs: if '' in dir: class_name, category = dir.split('') new_class_name = class_name + '_' + category new_dir = os.path.join(root, new_class_name) os.rename(os.path.join(root, dir), new_dir)
原文地址: https://www.cveoy.top/t/topic/h5ta 著作权归作者所有。请勿转载和采集!