unilm icon indicating copy to clipboard operation
unilm copied to clipboard

Image dimensions

Open lvaleriu opened this issue 6 years ago • 2 comments

When running a training step I get an error at this point:

self.x_position_embeddings(bbox[:, :, 0])

RuntimeError: index out of range: Tried to access index 1091 out of table with 1023 rows

self.x_position_embeddings => Embedding(1024, 768) (config.max_2d_position_embeddings = 1024)

This happens because the bbox batch has values bigger then 1023.

bbox[:, :, 0].
tensor([[   0,  380,  605,  ...,    0,    0,    0],
        [   0,   69,   69,  ..., 1382, 1382, 1000],
        [   0,  171,  387,  ...,    0,    0,    0],
        ...,
        [   0,  495,  495,  ...,    0,    0,    0],
        [   0,  506,  506,  ...,    0,    0,    0],
        [   0,  245,  245,  ...,  206,  206, 1000]])

Is this related to the image size? Should I resize images/annotation boxes to a specific dimension?

Thank you!

`

lvaleriu avatar Mar 30 '20 20:03 lvaleriu

So one of the element of bounding box is greater than 1024.

sibtain-r avatar Mar 31 '20 09:03 sibtain-r

Indeed .. I had many issues with the boxes. Some box coordinates were outside the image. After some cleaning everything went well and the model performs very nice!

lvaleriu avatar Mar 31 '20 15:03 lvaleriu