Commit
·
f870389
1
Parent(s):
5eca1bd
fix final output 300,300
Browse files
app.py
CHANGED
@@ -130,9 +130,13 @@ def generate_flow_intermediates_streaming(label):
|
|
130 |
if i in [10,20,30,40,48,49]:
|
131 |
#images.append((x + 1) / 2.0)
|
132 |
step_idx = {10: 1, 20: 2, 30: 3, 40: 4, 48: 5, 49:12}[i]
|
133 |
-
|
|
|
|
|
|
|
134 |
yield tuple(outputs)
|
135 |
|
|
|
136 |
# Compute velocity magnitude and convert to numpy for visualization
|
137 |
if i in [0,11,21,31,41,49]:
|
138 |
v_mag = dt*v[0, 0].abs().clamp(0, 3).cpu().numpy() # Clamp to max value for better contrast
|
@@ -140,10 +144,7 @@ def generate_flow_intermediates_streaming(label):
|
|
140 |
vel_colored = plt.get_cmap("coolwarm")(v_mag)[:, :, :3] # (H,W,3)
|
141 |
vel_colored = (vel_colored * 255).astype(np.uint8)
|
142 |
step_idx = {0: 6, 11: 7, 21: 8, 31: 9, 41: 10, 49:11}[i]
|
143 |
-
|
144 |
-
outputs[step_idx] = resize(vel_colored, (400, 400))
|
145 |
-
else:
|
146 |
-
outputs[step_idx] = resize(vel_colored)
|
147 |
yield tuple(outputs)
|
148 |
|
149 |
|
|
|
130 |
if i in [10,20,30,40,48,49]:
|
131 |
#images.append((x + 1) / 2.0)
|
132 |
step_idx = {10: 1, 20: 2, 30: 3, 40: 4, 48: 5, 49:12}[i]
|
133 |
+
if i==49:
|
134 |
+
outputs[step_idx] = resize(((x + 1) / 2.0)[0, 0].clamp(0, 1).cpu().numpy(),(300,300))
|
135 |
+
else:
|
136 |
+
outputs[step_idx] = resize(((x + 1) / 2.0)[0, 0].clamp(0, 1).cpu().numpy())
|
137 |
yield tuple(outputs)
|
138 |
|
139 |
+
|
140 |
# Compute velocity magnitude and convert to numpy for visualization
|
141 |
if i in [0,11,21,31,41,49]:
|
142 |
v_mag = dt*v[0, 0].abs().clamp(0, 3).cpu().numpy() # Clamp to max value for better contrast
|
|
|
144 |
vel_colored = plt.get_cmap("coolwarm")(v_mag)[:, :, :3] # (H,W,3)
|
145 |
vel_colored = (vel_colored * 255).astype(np.uint8)
|
146 |
step_idx = {0: 6, 11: 7, 21: 8, 31: 9, 41: 10, 49:11}[i]
|
147 |
+
outputs[step_idx] = resize(vel_colored)
|
|
|
|
|
|
|
148 |
yield tuple(outputs)
|
149 |
|
150 |
|