-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchange_name.py
31 lines (26 loc) · 1.25 KB
/
change_name.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Copyright (c) 한승은. All rights reserved.
import os
upper_path = os.path.join(r'D:\Dataset\230703_tagging_samples\CCTV_DB_Dataset\annotations')
# type_list = os.listdir(upper_path)
# for type in type_list:
# image_path = os.path.join(upper_path, type)
# image_list = os.listdir(image_path)
# for image in image_list:
# if "llip" in image:
# # print(os.path.join(image_path, image))
# # print(os.path.join(image_path, image[:-4] + "_flip+crop256" + image[-4:]))
# print(image)
# # print('_'.join(image.split('_')[:-1])+"_l_eye.png")
#
# os.renames(os.path.join(image_path, image), os.path.join(image_path, '_'.join(image.split('_')[:-1]) + "_l_lip.png"))
# print("end")
image_list = os.listdir(upper_path)
for image in image_list:
# if "hand" not in image:
# # print(image, image[:-4] + "_kf94" + image[-4:])
# os.renames(os.path.join(upper_path, image), os.path.join(upper_path, image[:-4]+"_hand"+image[-4:]))
if "r-ear" in image:
print(image)
# print('_'.join(image.split('_')[:-1]) + "_l_lip.png")
os.renames(os.path.join(upper_path, image), os.path.join(upper_path, '_'.join(image.split('_')[:-1]) + "_r_ear.png"))
print("end")