-
Notifications
You must be signed in to change notification settings - Fork 53
/
protxt_gen_c3d.py
37 lines (33 loc) · 1.02 KB
/
protxt_gen_c3d.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
from os import walk
import os
import cv2
import numpy as np
f = []
mypath = "/home/alpha/MLProject/c3d_feature_extraction/Input"
for (dirpath, dirnames, filenames) in walk(mypath):
for (dirpath, dirnames, filenames) in walk(dirpath):
f.extend(dirpath for x in filenames)
break
print(len(f))
f = set(f)
f = list(f)
def getSettingFiles(list):
input_frm = open('input_list_frm.txt', 'w')
output_frm = open('output_list_prefix.txt', 'w')
for fl in list:
num = len(os.listdir(fl))
j = int(num/16)
temp = fl.split('/')
temp[-3] = 'FInput'
file_pre = '/'.join(temp[-3:])
if not os.path.exists(file_pre):
os.makedirs(file_pre)
bla = fl.split('/')
ula = '/'.join(bla[-3:])
for i in range (0,j):
pf = str(1+ i*16) + " 0"
name = ula + "/ " + pf
input_frm.write("%s\n" % name)
out = file_pre + "/" + str(1+i*16).zfill(6)
output_frm.write('%s\n' % out)
getSettingFiles(f)