add trained model and predict alg
This commit is contained in:
parent
f15da632de
commit
ac2b203dd7
1
RNN/label.txt
Normal file
1
RNN/label.txt
Normal file
|
@ -0,0 +1 @@
|
|||
001 002 043 044 045 046 054 159 160 161
|
BIN
RNN/model.h5
Normal file
BIN
RNN/model.h5
Normal file
Binary file not shown.
87
RNN/predict.py
Normal file
87
RNN/predict.py
Normal file
|
@ -0,0 +1,87 @@
|
|||
import os
|
||||
import numpy as np
|
||||
import tensorflow as tf
|
||||
import argparse
|
||||
|
||||
def load_data(dirname):
|
||||
if dirname[-1] != '/':
|
||||
dirname=dirname+'/'
|
||||
listfile=os.listdir(dirname)
|
||||
X = []
|
||||
Y = []
|
||||
for text in listfile:
|
||||
textname = dirname + text
|
||||
numbers=[]
|
||||
with open(textname, mode = 'r') as t:
|
||||
numbers = [float(num) for num in t.read().split()]
|
||||
for i in range(len(numbers),25200):
|
||||
numbers.extend([0.000])
|
||||
landmark_frame=[]
|
||||
row=0
|
||||
for i in range(0,70):
|
||||
landmark_frame.extend(numbers[row:row+84])
|
||||
row += 84
|
||||
landmark_frame=np.array(landmark_frame)
|
||||
landmark_frame=landmark_frame.reshape(-1,84)
|
||||
X.append(np.array(landmark_frame))
|
||||
Y.append(text)
|
||||
X = np.array(X)
|
||||
Y = np.array(Y)
|
||||
# print(Y)
|
||||
x_train = X
|
||||
x_train=np.array(x_train)
|
||||
return x_train,Y
|
||||
|
||||
def load_label():
|
||||
listfile=[]
|
||||
with open("label.txt",mode='r') as l:
|
||||
listfile=[i for i in l.read().split()]
|
||||
label = {}
|
||||
count = 1
|
||||
for l in listfile:
|
||||
if "_" in l:
|
||||
continue
|
||||
label[l] = count
|
||||
count += 1
|
||||
return label
|
||||
|
||||
def main(input_data_path, output_data_path):
|
||||
comp = 'bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 \
|
||||
mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu'
|
||||
|
||||
cmd = 'GLOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/hand_tracking/hand_tracking_cpu \
|
||||
--calculator_graph_config_file=mediapipe/graphs/hand_tracking/hand_tracking_desktop_live.pbtxt'
|
||||
|
||||
output_dir = output_data_path
|
||||
x_test, Y = load_data(output_dir)
|
||||
new_model = tf.keras.models.load_model('model.h5')
|
||||
# new_model.summary()
|
||||
|
||||
labels=load_label()
|
||||
xhat = x_test
|
||||
print(xhat)
|
||||
|
||||
yhat = new_model.predict(xhat)
|
||||
|
||||
print(yhat)
|
||||
predictions = np.array([np.argmax(pred) for pred in yhat])
|
||||
rev_labels = dict(zip(list(labels.values()), list(labels.keys())))
|
||||
s=0
|
||||
filel = np.array(Y)
|
||||
txtpath=output_data_path+"result.txt"
|
||||
with open(txtpath, "w") as f:
|
||||
for i in predictions:
|
||||
f.write(Y[s])
|
||||
f.write(" ")
|
||||
f.write(rev_labels[i])
|
||||
f.write("\n")
|
||||
s+=1
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='Predict Sign language with 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)
|
1
RNN/test/Absolute/001/P0_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P0_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P0_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P0_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P0_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P0_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P0_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P0_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P0_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P0_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P10_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P10_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P10_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P10_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P10_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P10_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P10_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P10_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P10_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P10_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P11_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P11_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P11_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P11_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P11_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P11_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P11_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P11_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P11_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P11_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P12_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P12_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P12_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P12_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P12_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P12_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P12_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P12_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P12_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P12_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P13_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P13_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P13_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P13_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P13_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P13_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P13_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P13_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P13_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P13_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P14_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P14_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P14_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P14_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P14_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P14_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P14_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P14_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P14_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P14_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P15_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P15_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P15_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P15_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P15_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P15_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P15_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P15_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P15_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P15_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P16_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P16_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P16_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P16_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P16_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P16_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P16_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P16_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P16_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P16_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P17_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P17_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P17_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P17_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P17_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P17_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P17_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P17_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P17_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P17_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P18_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P18_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P18_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P18_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P18_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P18_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P18_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P18_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P18_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P18_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P19_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P19_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P19_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P19_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P19_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P19_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P19_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P19_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P19_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P19_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P1_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P1_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P1_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P1_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P1_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P1_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P1_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P1_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P1_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P1_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P20_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P20_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P20_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P20_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P20_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P20_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P20_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P20_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P20_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P20_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P21_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P21_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P21_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P21_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P21_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P21_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P21_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P21_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P21_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P21_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P22_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P22_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P22_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P22_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P22_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P22_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P22_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P22_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P22_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P22_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P23_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P23_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P23_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P23_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P23_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P23_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P23_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P23_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P23_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P23_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P24_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P24_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P24_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P24_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P24_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P24_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P24_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P24_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P24_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P24_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P25_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P25_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P25_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P25_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P25_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P25_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P25_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P25_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P25_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P25_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P26_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P26_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P26_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P26_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P26_S001_02.txt
Normal file
1
RNN/test/Absolute/001/P26_S001_02.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P26_S001_03.txt
Normal file
1
RNN/test/Absolute/001/P26_S001_03.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P26_S001_04.txt
Normal file
1
RNN/test/Absolute/001/P26_S001_04.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P27_S001_00.txt
Normal file
1
RNN/test/Absolute/001/P27_S001_00.txt
Normal file
File diff suppressed because one or more lines are too long
1
RNN/test/Absolute/001/P27_S001_01.txt
Normal file
1
RNN/test/Absolute/001/P27_S001_01.txt
Normal file
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user