Skip to content

Commit 29b4c11

Browse files
committed
Swapping color channels working.
1 parent 309589a commit 29b4c11

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

demos/video/style-transfer/style_transfer.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,20 @@ torch::Tensor eval_model(torch::jit::Module& module, const torch::Tensor& input)
8484
return output;
8585
}
8686

87+
torch::indexing::Slice slice() {
88+
return torch::indexing::Slice();
89+
}
90+
91+
torch::Tensor test_channel(torch::Tensor& input) {
92+
std::cout << "Input sizes: " << input.sizes() << std::endl;
93+
int channel_to_disable = 0;
94+
// auto img = input.select(1, channel_to_disable).zero();
95+
auto output = input.clone();
96+
output.select(1, channel_to_disable).zero_();
97+
// auto output = img;
98+
return output;
99+
}
100+
87101

88102

89103
int main() {
@@ -215,7 +229,7 @@ int run_webcam_model(torch::jit::Module& module, int cam_index, int max_fps, boo
215229

216230

217231
// working?
218-
auto processed_input = prepped_input;
232+
auto processed_input = test_channel(prepped_input);
219233
auto out_processed_input = processed_input.to(torch::kCPU,true);
220234
output_bgr = to_mat(out_processed_input, cv::COLOR_RGB2BGR);
221235

0 commit comments

Comments
 (0)