Models: object detection API can not set batch size > 1 for R-FCN training

Created on 19 Jul 2018  Â·  8Comments  Â·  Source: tensorflow/models

when I use object detection API for R-FCN training, I set batch size greater than 1. An error occur: "Cannot batch tensors with different shapes in component 1. First element had shape [600,750,3] and element 1 had shape [901,600,3]."

How can I modify code to support batch size greater than 1? Please help!

Most helpful comment

That's probably because of a keep_aspect_ratio_resizer. That allows for dynamic sizes, hence no batching is permitted.

Use a fixed_shape_resizer instead.

All 8 comments

That's probably because of a keep_aspect_ratio_resizer. That allows for dynamic sizes, hence no batching is permitted.

Use a fixed_shape_resizer instead.

@luowei1107 I have the same issue, have u solved it ?

Thank you for your sloution. It helps me a lot, I can use batch_size 16 for training now.
@varun19299

Thanks. I modify the configs which image_resizer{ keep_aspect_ratio_resizer{min_dimension: 600max_dimension: 1024 }} to image_resizer{ fixed_shape_resizer{height: 600 width: 1024 } to solve it.
@varun19299 @c329686183

@varun19299
I have this query, considering the fact that resizing imaging without respecting the aspect ratio will distort the image, will this impact the performance of the model, especially at the time inference (please consider with respect to Mask RCNN)

Yes, that’s a drawback, but you could probably use another pre-processing step where you could resize with padding / another strategy. Regardless there will be a distortion.

On 06-Sep-2018, at 7:05 PM, Aman Khandelia notifications@github.com wrote:

@varun19299 https://github.com/varun19299
I have this query, considering the fact that resizing imaging without respecting the aspect ratio will distort the image, will this impact the performance of the model, especially at the time inference (please consider with respect to Mask RCNN)

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/tensorflow/models/issues/4831#issuecomment-419094799, or mute the thread https://github.com/notifications/unsubscribe-auth/AUME57GPyiN1QuxIXNGsJ0MSZhv0RRZlks5uYSSqgaJpZM4VV7gy.

I kept the image size fixed and increased the batch size for training, however it has not affected evaluation! Is there any way to increase batch size for evaluation/testing?

@varun19299 could you please tell more about pre-processing steps. is it part of the config, or it must be done in step where we create record files.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kamal4493 picture kamal4493  Â·  3Comments

Mostafaghelich picture Mostafaghelich  Â·  3Comments

dsindex picture dsindex  Â·  3Comments

25b3nk picture 25b3nk  Â·  3Comments

sun9700 picture sun9700  Â·  3Comments