-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransferFiles.py
47 lines (44 loc) · 1.24 KB
/
transferFiles.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
Use this file to move the dataset videos into their respective train and test split folders.
"""
import shutil
import os
import sys
from os import listdir
fromm = './Dataset/' #the sub directory where all the dataset
to = './Dataset/TrainingFeatures/AnomalyFeatures/'
f = open('./Anomaly_Detection_splits/Anomaly_Train.txt', 'r')
list = f.read().split('\n')
f.close()
list = list[:-1] # remove ending empty line
#this file is used to move the features extracted in pickle form into their
#respective sub folders
for i in range(len(list)):
name = list[i].rsplit('/')
folder = name[0]+'Features/'
folder = fromm+folder
name = name[1]
name = name[:-4]
name = name + '.txt'
shutil.move(folder+name, to+name)
print("Moved: ", name)
#The code below is used to compare the two extracted features sub directories and make sure
#For all the videos
"""
AllTest_Video_Path = './Dataset/TrainingFeatures/AnomalyFeatures/'
path = './Dataset/'
All_Test_files= listdir(AllTest_Video_Path)
All_Test_files.sort()
l = len(list)
print(len(All_Test_files))
for i in range(l):
name = list[i].rsplit('/')
name = name[1]
name = name[:-4]
name = name + '.txt'
real = to+name
filee = to+ All_Test_files[i]
if real != filee:
print('Missing File is: \n')
print(real)
"""