-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathbuild.py
43 lines (40 loc) · 1.94 KB
/
build.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
# -*- coding: utf-8 -*-
import os
import sys
import argparse
def main(input_data_path,output_data_path):
comp='bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 \mediapipe/examples/desktop/multi_hand_tracking:multi_hand_tracking_cpu'
cmd='GLOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/multi_hand_tracking/multi_hand_tracking_cpu \
--calculator_graph_config_file=mediapipe/graphs/hand_tracking/multi_hand_tracking_desktop_live.pbtxt'
listfile=os.listdir(input_data_path)
if not(os.path.isdir(output_data_path+"Relative/")):
os.mkdir(output_data_path+"Relative/")
if not(os.path.isdir(output_data_path+"Absolute/")):
os.mkdir(output_data_path+"Absolute/")
for file in listfile:
if not(os.path.isdir(input_data_path+file)): #ignore .DS_Store
continue
word = file+"/"
fullfilename=os.listdir(input_data_path+word)
if not(os.path.isdir(output_data_path+"_"+word)):
os.mkdir(output_data_path+"_"+word)
if not(os.path.isdir(output_data_path+"Relative/"+word)):
os.mkdir(output_data_path+"Relative/"+word)
if not(os.path.isdir(output_data_path+"Absolute/"+word)):
os.mkdir(output_data_path+"Absolute/"+word)
#os.system(comp)
for mp4list in fullfilename:
if ".DS_Store" in mp4list:
continue
inputfilen=' --input_video_path='+input_data_path+word+mp4list
outputfilen=' --output_video_path='+output_data_path+'_'+word+mp4list
cmdret=cmd+inputfilen+outputfilen
os.system(cmdret)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='operating Mediapipe')
parser.add_argument("--input_data_path",help=" ")
parser.add_argument("--output_data_path",help=" ")
args=parser.parse_args()
input_data_path=args.input_data_path
output_data_path=args.output_data_path
main(input_data_path,output_data_path)