Split Brazilian Coffee Scenes Dataset (BCS)
作者:XD / 发表: 2020年8月3日 21:25 / 更新: 2020年8月3日 21:27 / 科研学习 / 阅读量:2739
Brazilian Coffee Scenes Dataset (BCS) has five folders, and each folder has coffee and uncoffee images. So I wrote a python file to split BCS into two folders - Coffee and Uncoffee.
Here is the splited zip.
Here is the code.
import os, shutil
path = "D:\\brazilian_coffee_scenes\\fold1"
new_path = "D:\\brazilian_coffee_scenes"
cls_dict = {}
path_list = os.listdir(path)
with open("fold1.txt", "r+") as f:
for line in f.readlines():
lst = line.strip().split("ffee.")
if lst[0] not in cls_dict.keys():
cls_dict[lst[0]] = [lst[1]]
else:
cls_dict[lst[0]].append(lst[1])
for name in path_list:
if name[:-4] in cls_dict['co']:
number = "1"
elif name[:-4] in cls_dict['nonco']:
number = "2"
else:
number = "3"
file = os.path.join(path, name)
new_file = os.path.join(new_path, number, name)
shutil.copyfile(file, new_file)
Brazilian Coffee Scenes Dataset (BCS)
- [BCS Dataset Webpage](http://patreo.dcc.ufmg.br/2017/11/12/brazilian-coffee-scenes-dataset/)
- Paper: O. A. B. Penatti, K. Nogueira, J. A. dos Santos. Do Deep Features Generalize from Everyday Objects to Remote Sensing and Aerial Scenes Domains? In: EarthVision 2015, Boston. IEEE Computer Vision and Pattern Recognition Workshops, 2015.