Skip to content

Commit 746fd49

Browse files
committed
Make example style transfer working with identity image function.
1 parent 38fd2e8 commit 746fd49

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

demos/video/style-transfer/style_transfer.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,21 @@ int run_webcam_model(torch::jit::Module& module, int cam_index, int max_fps, boo
208208

209209
// output_bgr = to_mat(processed_output);
210210

211-
cv::Mat output_rgb = to_mat(processed_output);
211+
// cv::Mat output_rgb = to_mat(processed_output);
212212
// output_bgr = output_rgb;
213213
// cv::cvtColor(output_rgb, output_bgr, cv::COLOR_RGB2BGR);
214214
// cv::cvtColor(output_rgb, output_bgr, cv::COLOR_RGB2BGR);
215215

216+
// working?
217+
auto out_mps_tensor = mps_tensor.to(torch::kCPU,true);
218+
frame_rgb = to_mat(out_mps_tensor);
219+
cv::cvtColor(frame_rgb, output_bgr, cv::COLOR_RGB2BGR);
216220

217-
cv::cvtColor(frame_rgb, output_bgr, cv::COLOR_RGB2BGR);
221+
222+
223+
// // works
224+
// frame_rgb = to_mat(input_tensor);
225+
// cv::cvtColor(frame_rgb, output_bgr, cv::COLOR_RGB2BGR);
218226

219227

220228

0 commit comments

Comments
 (0)