1 | initial version |
@Juventi, thanks for the code! I have no problems.
There are my graph postprocessing:
python ~/tensorflow/tensorflow/python/tools/freeze_graph.py \
--input_graph=graph.pb \
--input_checkpoint=tmp.ckpt \
--output_graph=frozen_graph.pb \
--output_node_names=y_pre
python ~/tensorflow/tensorflow/python/tools/optimize_for_inference.py \
--input frozen_graph.pb \
--output opt_graph.pb \
--frozen_graph True \
--input_names inputs_placeholder \
--output_names y_pre
And the invocation:
#include <opencv2/opencv.hpp>
#include <opencv2/dnn.hpp>
int main(int argc, char** argv) {
cv::dnn::Net net = cv::dnn::readNetFromTensorflow("../opt_graph.pb");
cv::Mat input(32, 32, CV_32FC3);
net.setInput(cv::dnn::blobFromImage(input));
net.forward();
return 0;
}
2 | No.2 Revision |
@Juventi, thanks for the code! I have no problems.
There are my graph postprocessing:
python ~/tensorflow/tensorflow/python/tools/freeze_graph.py \
--input_graph=graph.pb \
--input_checkpoint=tmp.ckpt \
--output_graph=frozen_graph.pb \
--output_node_names=y_pre
python ~/tensorflow/tensorflow/python/tools/optimize_for_inference.py \
--input frozen_graph.pb \
--output opt_graph.pb \
--frozen_graph True \
--input_names inputs_placeholder \
--output_names y_pre
And the invocation:
#include <opencv2/opencv.hpp>
#include <opencv2/dnn.hpp>
int main(int argc, char** argv) {
cv::dnn::Net net = cv::dnn::readNetFromTensorflow("../opt_graph.pb");
cv::Mat input(32, 32, CV_32FC3);
net.setInput(cv::dnn::blobFromImage(input));
net.forward();
return 0;
}
Are you sure that the latest OpenCV version is used?