Skip to content

opencv dnn net.forward east  #15979

Closed
Closed

Description

@SpringRainLu
System information (version)
  • OpenCV =>4.12
  • Operating System / Platform => Windows 64 Bit
  • Compiler => PyCharm 2018 CE
Detailed description

i tried to run text detection.py based on my own east model, but it failed at
''outs = net.forward(outNames)''

cv2.error: OpenCV(4.1.1) .\opencv-python\opencv\modules\dnn\src\dnn.cpp:525: error: (-2:Unspecified error)
Can't create layer "resnet_v1_50/conv1/BatchNorm/FusedBatchNormV3" of type "FusedBatchNormV3" in function 'cv::dnn::dnn4_v20190621::LayerData::getLayerInstance'

i saved my model in this:

output_graph = "frozen_east_model_02.pb"
output_graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def,
["feature_fusion/Conv_7/Sigmoid",
"feature_fusion/concat_3"])
tf.train.write_graph(output_graph_def, ".", output_graph, as_text=False)

i have tried to modify model.py , nevertheless it did not work.
https://github.com/argman/EAST/blob/master/model.py Line 150

c1_1 = slim.conv2d(tf.concat([g[i-1], f[i]], axis=3), num_outputs[i], 1)
pi2 = 0.5 * np.pi
angle_map = (slim.conv2d(g[3], 1, 1, activation_fn=tf.nn.sigmoid, normalizer_fn=None) - 0.5) * pi2 # angle is between [-45, 45]
F_geometry = tf.concat([geo_map, angle_map], axis=3)

Steps to reproduce

Activity

  1. alalek commented on Nov 24, 2019

    @alalek
    Member

    What is version of TensorFlow?

  2. SpringRainLu commented on Nov 24, 2019

    @SpringRainLu
    Author

    What is version of TensorFlow?

    tf 1.15.0

  3. dkurt commented on Nov 25, 2019

    @dkurt
    Member

    @SpringRainLu, please take a look at #15986 (WIP for now, we will add some tests soon).

  4. SpringRainLu commented on Nov 25, 2019

    @SpringRainLu
    Author

    Thanks three thousand! @dkurt
    i retried the code in Tensorflow 1.14, and it ran without errors.

  5. mapavia commented on May 4, 2020

    @mapavia

    Thanks three thousand! @dkurt
    i retried the code in Tensorflow 1.14, and it ran without errors.

    Hey @SpringRainLu, what code did you actually retry? Just the samples/dnn/text_detection.py or did you retrain your own east model again?

    I am getting similar errors with my cv2 python code. Works well with pre-trained models from the internet but not with my custom model. I was wondering if this was related.

    networkOutput = tensorflowNet.forward() error: OpenCV(4.1.1) /Users/travis/build/skvark/opencv-python/opencv/modules/dnn/src/dnn.cpp:525: error: (-2:Unspecified error) Can't create layer "FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_0/BatchNorm/FusedBatchNormV3" of type "FusedBatchNormV3" in function 'getLayerInstance'

  6. dkurt commented on May 5, 2020

    @dkurt
    Member

    error: OpenCV(4.1.1)

    @mapavia, Please try newer version of OpenCV

  7. mapavia commented on May 5, 2020

    @mapavia

    error: OpenCV(4.1.1)

    @mapavia, Please try newer version of OpenCV

    I'll try that next time. But I got it working by retraining my model using tensorflow 1.14 instead of 1.15. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions