def copy_images_for_classification():
ground_truth_dates = pickle.load(open(data_dir + 'ground_truth_dates.pickle', "rb"))
ground_truth_dates = sorted(ground_truth_dates, key=lambda x: x[3], reverse=False)
if not os.path.exists(classify_dir):
os.mkdir(classify_dir)
for seed_id, coin_id, result, labeled_date, bad_angle, bad_image in ground_truth_dates:
if labeled_date < 1900:
continue
dir = crop_dir + str(coin_id / 100) + '/'
new_dir = classify_dir + str(labeled_date) + '/'
if not os.path.exists(new_dir):
os.mkdir(new_dir)
for image_id in range(0,57):
filename = str(coin_id).zfill(5) + str(image_id).zfill(2) + '.png'
old_filename = dir + filename
new_filename = new_dir + filename
shutil.copyfile(old_filename,new_filename)
评论列表
文章目录