Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tf_text_graph_faster_rcnn.py - Assertion error #13237

Closed
engineer1982 opened this issue Nov 21, 2018 · 7 comments
Closed

tf_text_graph_faster_rcnn.py - Assertion error #13237

engineer1982 opened this issue Nov 21, 2018 · 7 comments

Comments

@engineer1982
Copy link

System information (version)
  • OpenCV => :3.4.3:
  • Operating System / Platform => :Windows 10 64 bit:
  • Compiler => :Visual Studio 2017:
Detailed description

I used Tensorflow Object Detection to train a "faster_rcnn_inception_resnet_v2_atrous_coco_2018_01_28" in my custom dataset. After trained, it detected well the new classes (just 3). I exported the new trained model to a folder, which contains the files "frozen_inference_graph.pb" and "pipeline.config"

Then, I used "tf_text_graph_mask_rcnn.py" in the following command:

python tf_text_graph_faster_rcnn.py --input faster_rcnn_inception_resnet_v2_atrous_coco_2018_01_28_step19391/frozen_inference_graph.pb --config faster_rcnn_inception_resnet_v2_atrous_coco_2018_01_28_step19391/pipeline.config --output faster_rcnn_inception_resnet_v2_atrous_coco_2018_01_28_step19391/graph.pbtxt

Here follows the output. Seem to run well, but got an error:

Number of classes: 3
Scales: [0.25, 0.5, 1.0, 2.0]
Aspect ratios: [0.5, 1.0, 2.0]
Width stride: 8.000000
Height stride: 8.000000
Features stride: 8.000000
2018-11-21 11:27:27.621794: I tensorflow/tools/graph_transforms/transform_graph.cc:318] Applying sort_by_execution_order
Traceback (most recent call last):
File "tf_text_graph_faster_rcnn.py", line 241, in
createFasterRCNNGraph(args.input, args.config, args.output)
File "tf_text_graph_faster_rcnn.py", line 59, in createFasterRCNNGraph
assert(graph_def.node[0].op == 'Placeholder')
AssertionError

Any ideas about what happened here?

Thank you guys.

@dkurt
Copy link
Member

dkurt commented Nov 21, 2018

@engineer1982, please attach frozen_inference_graph.pb and pipeline.config if it's possible. You can also try the latest state of 3.4 or master branches because we did some fixes recently.

@engineer1982
Copy link
Author

@engineer1982, please attach frozen_inference_graph.pb and pipeline.config if it's possible. You can also try the latest state of 3.4 or master branches because we did some fixes recently.

@dkurt , the .pb file has 216MB. Here goes the google drive link: https://drive.google.com/open?id=1MBeqFKd3jE9codu23cQJpHeahWHXVtiF

@dkurt
Copy link
Member

dkurt commented Nov 22, 2018

@engineer1982, the problem is that OpenCV doesn't support any of _atrous network with dilated convolutions from TensorFlow Object Detection API for now.

@dkurt
Copy link
Member

dkurt commented Jan 18, 2019

@engineer1982, Hi!
Please test the following PR: #13656.

For faster_rcnn_inception_resnet_v2_atrous_coco_2018_01_28 model we need to replace

height_stride: 8
width_stride: 8

to

height_stride: 16
width_stride: 16

However I don't actually know if this is a typo in pipeline.config or our script computes anchors in a wrong way. At least with 16x16 everything looks fine (1024x600 input image):
out

@dkurt dkurt closed this as completed Jan 21, 2019
@engineer1982
Copy link
Author

@engineer1982, Hi!
Please test the following PR: #13656.

For faster_rcnn_inception_resnet_v2_atrous_coco_2018_01_28 model we need to replace

height_stride: 8
width_stride: 8

to

height_stride: 16
width_stride: 16

However I don't actually know if this is a typo in pipeline.config or our script computes anchors in a wrong way. At least with 16x16 everything looks fine (1024x600 input image):
out

Thanks Dimitry! And where do I change it?

@dkurt
Copy link
Member

dkurt commented Jan 22, 2019

@engineer1982, in the config file:

    first_stage_anchor_generator {
      grid_anchor_generator {
        height_stride: 16
        width_stride: 16
        scales: 0.25
        scales: 0.5
        scales: 1.0
        scales: 2.0
        aspect_ratios: 0.5
        aspect_ratios: 1.0
        aspect_ratios: 2.0
      }
    }

@engineer1982
Copy link
Author

Thank you! gonna try it and update here.

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

No branches or pull requests

2 participants