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!
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.
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.