eragonruan / text-detection-ctpn

text detection mainly based on ctpn model in tensorflow, id card detect, connectionist text proposal network
MIT License
3.43k stars 1.33k forks source link

How do I freeze the model:https://drive.google.com/file/d/1HcZuB_MHqsKhKEKpfF1pEU85CYy4OlWO/view?usp=sharing ? #292

Open LuWei6896 opened 5 years ago

LuWei6896 commented 5 years ago

@eragonruan @banjin-xjy hai,i use inspect_checkpoint.py,the result as below:

tensor_name: BiLSTM/biases tensor_name: BiLSTM/biases/Adam tensor_name: BiLSTM/biases/Adam_1 tensor_name: BiLSTM/biases/ExponentialMovingAverage tensor_name: BiLSTM/bidirectional_rnn/bw/lstm_cell/bias tensor_name: BiLSTM/bidirectional_rnn/bw/lstm_cell/bias/Adam tensor_name: BiLSTM/bidirectional_rnn/bw/lstm_cell/bias/Adam_1 tensor_name: BiLSTM/bidirectional_rnn/bw/lstm_cell/bias/ExponentialMovingAverage tensor_name: BiLSTM/bidirectional_rnn/bw/lstm_cell/kernel tensor_name: BiLSTM/bidirectional_rnn/bw/lstm_cell/kernel/Adam tensor_name: BiLSTM/bidirectional_rnn/bw/lstm_cell/kernel/Adam_1 tensor_name: BiLSTM/bidirectional_rnn/bw/lstm_cell/kernel/ExponentialMovingAverage tensor_name: BiLSTM/bidirectional_rnn/fw/lstm_cell/bias tensor_name: BiLSTM/bidirectional_rnn/fw/lstm_cell/bias/Adam tensor_name: BiLSTM/bidirectional_rnn/fw/lstm_cell/bias/Adam_1 tensor_name: BiLSTM/bidirectional_rnn/fw/lstm_cell/bias/ExponentialMovingAverage tensor_name: BiLSTM/bidirectional_rnn/fw/lstm_cell/kernel tensor_name: BiLSTM/bidirectional_rnn/fw/lstm_cell/kernel/Adam tensor_name: BiLSTM/bidirectional_rnn/fw/lstm_cell/kernel/Adam_1 tensor_name: BiLSTM/bidirectional_rnn/fw/lstm_cell/kernel/ExponentialMovingAverage tensor_name: BiLSTM/weights tensor_name: BiLSTM/weights/Adam tensor_name: BiLSTM/weights/Adam_1 tensor_name: BiLSTM/weights/ExponentialMovingAverage tensor_name: Conv/biases tensor_name: Conv/biases/Adam tensor_name: Conv/biases/Adam_1 tensor_name: Conv/biases/ExponentialMovingAverage tensor_name: Conv/weights tensor_name: Conv/weights/Adam tensor_name: Conv/weights/Adam_1 tensor_name: Conv/weights/ExponentialMovingAverage tensor_name: Variable tensor_name: bbox_pred/biases tensor_name: bbox_pred/biases/Adam tensor_name: bbox_pred/biases/Adam_1 tensor_name: bbox_pred/biases/ExponentialMovingAverage tensor_name: bbox_pred/weights tensor_name: bbox_pred/weights/Adam tensor_name: bbox_pred/weights/Adam_1 tensor_name: bbox_pred/weights/ExponentialMovingAverage tensor_name: beta1_power tensor_name: beta2_power tensor_name: cls_pred/biases tensor_name: cls_pred/biases/Adam tensor_name: cls_pred/biases/Adam_1 tensor_name: cls_pred/biases/ExponentialMovingAverage tensor_name: cls_pred/weights tensor_name: cls_pred/weights/Adam tensor_name: cls_pred/weights/Adam_1 tensor_name: cls_pred/weights/ExponentialMovingAverage tensor_name: global_step tensor_name: vgg_16/conv1/conv1_1/biases tensor_name: vgg_16/conv1/conv1_1/biases/Adam tensor_name: vgg_16/conv1/conv1_1/biases/Adam_1 tensor_name: vgg_16/conv1/conv1_1/biases/ExponentialMovingAverage tensor_name: vgg_16/conv1/conv1_1/weights tensor_name: vgg_16/conv1/conv1_1/weights/Adam tensor_name: vgg_16/conv1/conv1_1/weights/Adam_1 tensor_name: vgg_16/conv1/conv1_1/weights/ExponentialMovingAverage tensor_name: vgg_16/conv1/conv1_2/biases tensor_name: vgg_16/conv1/conv1_2/biases/Adam tensor_name: vgg_16/conv1/conv1_2/biases/Adam_1 tensor_name: vgg_16/conv1/conv1_2/biases/ExponentialMovingAverage tensor_name: vgg_16/conv1/conv1_2/weights tensor_name: vgg_16/conv1/conv1_2/weights/Adam tensor_name: vgg_16/conv1/conv1_2/weights/Adam_1 tensor_name: vgg_16/conv1/conv1_2/weights/ExponentialMovingAverage tensor_name: vgg_16/conv2/conv2_1/biases tensor_name: vgg_16/conv2/conv2_1/biases/Adam tensor_name: vgg_16/conv2/conv2_1/biases/Adam_1 tensor_name: vgg_16/conv2/conv2_1/biases/ExponentialMovingAverage tensor_name: vgg_16/conv2/conv2_1/weights tensor_name: vgg_16/conv2/conv2_1/weights/Adam tensor_name: vgg_16/conv2/conv2_1/weights/Adam_1 tensor_name: vgg_16/conv2/conv2_1/weights/ExponentialMovingAverage tensor_name: vgg_16/conv2/conv2_2/biases tensor_name: vgg_16/conv2/conv2_2/biases/Adam tensor_name: vgg_16/conv2/conv2_2/biases/Adam_1 tensor_name: vgg_16/conv2/conv2_2/biases/ExponentialMovingAverage tensor_name: vgg_16/conv2/conv2_2/weights tensor_name: vgg_16/conv2/conv2_2/weights/Adam tensor_name: vgg_16/conv2/conv2_2/weights/Adam_1 tensor_name: vgg_16/conv2/conv2_2/weights/ExponentialMovingAverage tensor_name: vgg_16/conv3/conv3_1/biases tensor_name: vgg_16/conv3/conv3_1/biases/Adam tensor_name: vgg_16/conv3/conv3_1/biases/Adam_1 tensor_name: vgg_16/conv3/conv3_1/biases/ExponentialMovingAverage tensor_name: vgg_16/conv3/conv3_1/weights tensor_name: vgg_16/conv3/conv3_1/weights/Adam tensor_name: vgg_16/conv3/conv3_1/weights/Adam_1 tensor_name: vgg_16/conv3/conv3_1/weights/ExponentialMovingAverage tensor_name: vgg_16/conv3/conv3_2/biases tensor_name: vgg_16/conv3/conv3_2/biases/Adam tensor_name: vgg_16/conv3/conv3_2/biases/Adam_1 tensor_name: vgg_16/conv3/conv3_2/biases/ExponentialMovingAverage tensor_name: vgg_16/conv3/conv3_2/weights tensor_name: vgg_16/conv3/conv3_2/weights/Adam tensor_name: vgg_16/conv3/conv3_2/weights/Adam_1 tensor_name: vgg_16/conv3/conv3_2/weights/ExponentialMovingAverage tensor_name: vgg_16/conv3/conv3_3/biases tensor_name: vgg_16/conv3/conv3_3/biases/Adam tensor_name: vgg_16/conv3/conv3_3/biases/Adam_1 tensor_name: vgg_16/conv3/conv3_3/biases/ExponentialMovingAverage tensor_name: vgg_16/conv3/conv3_3/weights tensor_name: vgg_16/conv3/conv3_3/weights/Adam tensor_name: vgg_16/conv3/conv3_3/weights/Adam_1 tensor_name: vgg_16/conv3/conv3_3/weights/ExponentialMovingAverage tensor_name: vgg_16/conv4/conv4_1/biases tensor_name: vgg_16/conv4/conv4_1/biases/Adam tensor_name: vgg_16/conv4/conv4_1/biases/Adam_1 tensor_name: vgg_16/conv4/conv4_1/biases/ExponentialMovingAverage tensor_name: vgg_16/conv4/conv4_1/weights tensor_name: vgg_16/conv4/conv4_1/weights/Adam tensor_name: vgg_16/conv4/conv4_1/weights/Adam_1 tensor_name: vgg_16/conv4/conv4_1/weights/ExponentialMovingAverage tensor_name: vgg_16/conv4/conv4_2/biases tensor_name: vgg_16/conv4/conv4_2/biases/Adam tensor_name: vgg_16/conv4/conv4_2/biases/Adam_1 tensor_name: vgg_16/conv4/conv4_2/biases/ExponentialMovingAverage tensor_name: vgg_16/conv4/conv4_2/weights tensor_name: vgg_16/conv4/conv4_2/weights/Adam tensor_name: vgg_16/conv4/conv4_2/weights/Adam_1 tensor_name: vgg_16/conv4/conv4_2/weights/ExponentialMovingAverage tensor_name: vgg_16/conv4/conv4_3/biases tensor_name: vgg_16/conv4/conv4_3/biases/Adam tensor_name: vgg_16/conv4/conv4_3/biases/Adam_1 tensor_name: vgg_16/conv4/conv4_3/biases/ExponentialMovingAverage tensor_name: vgg_16/conv4/conv4_3/weights tensor_name: vgg_16/conv4/conv4_3/weights/Adam tensor_name: vgg_16/conv4/conv4_3/weights/Adam_1 tensor_name: vgg_16/conv4/conv4_3/weights/ExponentialMovingAverage tensor_name: vgg_16/conv5/conv5_1/biases tensor_name: vgg_16/conv5/conv5_1/biases/Adam tensor_name: vgg_16/conv5/conv5_1/biases/Adam_1 tensor_name: vgg_16/conv5/conv5_1/biases/ExponentialMovingAverage tensor_name: vgg_16/conv5/conv5_1/weights tensor_name: vgg_16/conv5/conv5_1/weights/Adam tensor_name: vgg_16/conv5/conv5_1/weights/Adam_1 tensor_name: vgg_16/conv5/conv5_1/weights/ExponentialMovingAverage tensor_name: vgg_16/conv5/conv5_2/biases tensor_name: vgg_16/conv5/conv5_2/biases/Adam tensor_name: vgg_16/conv5/conv5_2/biases/Adam_1 tensor_name: vgg_16/conv5/conv5_2/biases/ExponentialMovingAverage tensor_name: vgg_16/conv5/conv5_2/weights tensor_name: vgg_16/conv5/conv5_2/weights/Adam tensor_name: vgg_16/conv5/conv5_2/weights/Adam_1 tensor_name: vgg_16/conv5/conv5_2/weights/ExponentialMovingAverage tensor_name: vgg_16/conv5/conv5_3/biases tensor_name: vgg_16/conv5/conv5_3/biases/Adam tensor_name: vgg_16/conv5/conv5_3/biases/Adam_1 tensor_name: vgg_16/conv5/conv5_3/biases/ExponentialMovingAverage tensor_name: vgg_16/conv5/conv5_3/weights tensor_name: vgg_16/conv5/conv5_3/weights/Adam tensor_name: vgg_16/conv5/conv5_3/weights/Adam_1 tensor_name: vgg_16/conv5/conv5_3/weights/ExponentialMovingAverage

https://github.com/eragonruan/text-detection-ctpn/blob/banjin-dev/nets/model_train.py there is three uotput node:"bbox_pred"、"cls_pred"、"cls_prob"?

So , which is the output node? Thanks a lot!

LuWei6896 commented 5 years ago

@eragonruan @banjin-xjy i specify the output node as below: model_0/cls_pred/Reshape model_0/cls_pred/Reshape model_0/cls_prob

i got freezed_graph.pb! and I use opencv's readNetFromTensorflow(),there are some error: terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(3.4.3) /home/luwei/ML/opencv3.4.3/opencv-3.4.3/modules/dnn/src/tensorflow/tf_importer.cpp:1279: error: (-2:Unspecified error) Input layer not found: model_0/BiLSTM/bidirectional_rnn/fw/concat/values_0 in function 'populateNet'

liuheng92 commented 5 years ago

why don't you use tensorflow freeze_graph.freeze_graph

LuWei6896 commented 5 years ago

@liuheng92 just this way!But the output of freezed_model have changed!

LuWei6896 commented 5 years ago

@liuheng92 the freezed_model out as below: https://github.com/eragonruan/text-detection-ctpn/issues/294#issue-411331380

liuheng92 commented 5 years ago

@liuheng92 the freezed_model out as below: #294 (comment)

https://github.com/tensorflow/tensorflow/issues/26203