opencv: c++ opencv4.01 called tensorflow inception-v4 model ,readNetFromTensorflow ERROR!
train a tf flowers model with inception-v4,
after got the mode.ckpy , use the code to convert it:
echo “create model.pb over”
cd …
CUDA_VISIBLE_DEVICES=1 python3 -u export_inference_graph.py
–model_name=inception_v4
–output_file=./data/flowers_5/models/infer/flowers.pb
–dataset_name=flowers
–dataset_dir=./data/flowers_5
echo “start create frzee pb”
CUDA_VISIBLE_DEVICES=1 python3 -u /usr/local/lib/python3.5/dist-packages/tensorflow/python/tools/freeze_graph.py
–input_graph=./data/flowers_5/models/infer/flowers.pb
–input_checkpoint=./data/flowers_5/models/model.ckpt-10027
–output_graph=./data/flowers_5/models/infer/my_freeze.pb
–input_binary=True
–output_node_name=InceptionV4/Logits/Predictions
i test the flowers.pb with classify.sh (https://github.com/isiosia/models/tree/lession/slim) it works well
id:[0] name:[daisy] (score = 0.80188) id:[1] name:[dandelion] (score = 0.11308) id:[3] name:[sunflowers] (score = 0.05036) id:[4] name:[tulips] (score = 0.02128) id:[2] name:[roses] (score = 0.01340)
then i use it for vs2015+opencv4.01, with the code
then got the error
load models OpenCV: terminate handler is called! The last OpenCV error is: OpenCV(4.0.1) Error: Assertion failed (scaleMat.type() == CV_32FC1) in cv::dnn::dnn4_v20181221::`anonymous-namespace’::TFImporter::populateNet, file E:\product\opencv-4.0.1\modules\dnn\src\tensorflow\tf_importer.cpp, line 1377
so i dont know where was wrong? how can i make it work in c++ opoencv4.01?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 34 (12 by maintainers)
We really don’t have spare time to download datasets and try to train models using outdated instructions (you point on commits which are modified 2+ years ago).
Reproducer should have:
Ask for help on http://answers.opencv.org if you are not able to provide this.
Could you try add this before mentioned assertion?