rsax commited on
Commit
845d7e1
·
verified ·
1 Parent(s): 396f805

Update visualization/plot_3d_global.py

Browse files
Files changed (1) hide show
  1. visualization/plot_3d_global.py +2 -3
visualization/plot_3d_global.py CHANGED
@@ -104,7 +104,6 @@ def plot_3d_motion(args, figsize=(10, 10), fps=120, radius=4):
104
  print(f"Image shape: {img_array.shape}") # Debug: Check the image shape
105
  return img_array
106
 
107
-
108
  frame_number = data.shape[0]
109
  out = [update(i) for i in range(frame_number)]
110
  out = np.stack(out, axis=0)
@@ -120,7 +119,6 @@ def draw_to_batch(smpl_joints_batch, title_batch=None, outname=None):
120
  out = []
121
  for i in range(batch_size):
122
  try:
123
- # Directly generate GIF data from the motion data for each batch
124
  gif_data = plot_3d_motion([smpl_joints_batch[i], None, title_batch[i] if title_batch is not None else None])
125
  if isinstance(gif_data, bytes):
126
  out.append(gif_data)
@@ -128,12 +126,13 @@ def draw_to_batch(smpl_joints_batch, title_batch=None, outname=None):
128
  else:
129
  raise ValueError("Generated data is not in the correct format.")
130
  except Exception as e:
131
- # Log the error to understand what might be going wrong
132
  error_msg = f"Failed to generate GIF for batch {i+1}: {str(e)}"
133
  print(error_msg)
134
  out.append(bytes(error_msg, 'utf-8')) # Convert error message to bytes for consistency
135
  return out[0] if out else bytes("Failed to generate any GIFs.", 'utf-8')
136
 
 
 
137
 
138
  # if out_name is not None :
139
  # plt.savefig(out_name, dpi=96)
 
104
  print(f"Image shape: {img_array.shape}") # Debug: Check the image shape
105
  return img_array
106
 
 
107
  frame_number = data.shape[0]
108
  out = [update(i) for i in range(frame_number)]
109
  out = np.stack(out, axis=0)
 
119
  out = []
120
  for i in range(batch_size):
121
  try:
 
122
  gif_data = plot_3d_motion([smpl_joints_batch[i], None, title_batch[i] if title_batch is not None else None])
123
  if isinstance(gif_data, bytes):
124
  out.append(gif_data)
 
126
  else:
127
  raise ValueError("Generated data is not in the correct format.")
128
  except Exception as e:
 
129
  error_msg = f"Failed to generate GIF for batch {i+1}: {str(e)}"
130
  print(error_msg)
131
  out.append(bytes(error_msg, 'utf-8')) # Convert error message to bytes for consistency
132
  return out[0] if out else bytes("Failed to generate any GIFs.", 'utf-8')
133
 
134
+
135
+
136
 
137
  # if out_name is not None :
138
  # plt.savefig(out_name, dpi=96)