Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
yq committed Nov 30, 2018
1 parent c2f66ef commit a367577
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/evaluator/test_realdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,14 @@ int main(int argc, char ** argv) {
cp_net.to(device);

for (int i = 0; i < data_n; i++) {

const string img_path = realdata_folder + to_string(i) + ".png";
cv::Mat img = cv::imread(img_path);
if (img.empty()) {
cerr << "Img: " << img_path << " does not exist!" << endl;
exit(-1);
}

cv::Mat img = cv::imread(realdata_folder + to_string(i) + ".png");
cv::resize(img, img, cp_net_imgsize);
Tensor img_tensor = torch::from_blob(img.data, {img.rows, img.cols, 3}, kByte);
img_tensor = img_tensor.permute({2, 0, 1}).toType(kFloat32).div_(255).unsqueeze(0);
Expand Down

0 comments on commit a367577

Please sign in to comment.