votuongquan2004@gmail.com commited on
Commit
5362fbc
1 Parent(s): 7ec94e0

update data.py

Browse files
Files changed (2) hide show
  1. app.py +2 -1
  2. utils/data.py +1 -4
app.py CHANGED
@@ -71,7 +71,7 @@ def inference(
71
  end_time = time.time()
72
  model_time = end_time - start_time
73
 
74
- output_message += f'Input shape: {inputs.shape}\n'
75
 
76
  if len(predictions) == 0:
77
  output_message = 'No sign language detected in the video. Please try again.'
@@ -82,6 +82,7 @@ def inference(
82
  output_message += f'Data processing time: {data_time:.2f} seconds\n'
83
  output_message += f'Model inference time: {model_time:.2f} seconds\n'
84
  output_message += f'Total time: {data_time + model_time:.2f} seconds'
 
85
 
86
  progress(1/2, desc='Completed')
87
 
 
71
  end_time = time.time()
72
  model_time = end_time - start_time
73
 
74
+
75
 
76
  if len(predictions) == 0:
77
  output_message = 'No sign language detected in the video. Please try again.'
 
82
  output_message += f'Data processing time: {data_time:.2f} seconds\n'
83
  output_message += f'Model inference time: {model_time:.2f} seconds\n'
84
  output_message += f'Total time: {data_time + model_time:.2f} seconds'
85
+ output_message += f'Input shape: {inputs.shape}\n'
86
 
87
  progress(1/2, desc='Completed')
88
 
utils/data.py CHANGED
@@ -177,10 +177,7 @@ def preprocess(
177
  # inputs[0, :, :, :] = inputs[0, :, :, :] - inputs[0, :, 0, 0].mean(axis=0)
178
  # inputs[1, :, :, :] = inputs[1, :, :, :] - inputs[1, :, 0, 0].mean(axis=0)
179
 
180
- temp = np.squeeze(inputs).transpose(1, 2, 0).astype(np.float32)
181
- data = temp.reshape(1, temp.shape[2], temp.shape[0], temp.shape[1], 1)
182
-
183
- return data
184
 
185
 
186
  def random_sample_np(data: np.ndarray, size: int) -> np.ndarray:
 
177
  # inputs[0, :, :, :] = inputs[0, :, :, :] - inputs[0, :, 0, 0].mean(axis=0)
178
  # inputs[1, :, :, :] = inputs[1, :, :, :] - inputs[1, :, 0, 0].mean(axis=0)
179
 
180
+ return inputs[np.newaxis, :].astype(np.float32)
 
 
 
181
 
182
 
183
  def random_sample_np(data: np.ndarray, size: int) -> np.ndarray: