-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_thermal.py
More file actions
22 lines (17 loc) · 898 Bytes
/
Copy pathget_thermal.py
File metadata and controls
22 lines (17 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Creator: Gabriela Vidal
# Objective: This code gets only the thermal images from the folder and puts them into /Dataset/train/images or Dataset/test/images
# It is used to get the correct dataset to train YOLO v7
import os
import shutil
import re
# txt_train = [f for f in os.listdir("Dataset/train/") if '.txt' in f.lower()]
images_train = [f for f in os.listdir("Dataset/train/DJI_202304131658_003-20230417T175200Z-001\DJI_202304131658_003") if '.jpg' in f.lower()]
# os.mkdir('Dataset/train/images')
# for text in txt_test:
# new_path = 'Dataset/test/images/' + text
# shutil.move('Dataset/test/'+text, new_path)
os.mkdir('Dataset/train/images')
for image in images_train:
new_path = 'Dataset/train/images/' + image
if re.search(r'\b((\w+)_T)\b', image):
shutil.move('Dataset/train/DJI_202304131658_003-20230417T175200Z-001\DJI_202304131658_003/'+image, new_path)