你可以写个python把他转化成imagenet格式吗?数据集目录是mntdisk1gjhdataSCENESUN397对于mntdisk1gjhdataSCENESUN397bbasketball_courtoutdoor部分细分为indoor和outdoor的类别将indoor或者outdoor加入到原类名构成新类目录名字改成basketball_court_outdoor这样的形式。你不用写
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/jbiS 著作权归作者所有。请勿转载和采集!