Skip to content

When I try to calculate the anchor boxes, I get an error due to missing the full size of the image. - #7

Closed
alexandreofbh wants to merge 1 commit into
dlibml:masterfrom
alexandreofbh:master
Closed

When I try to calculate the anchor boxes, I get an error due to missing the full size of the image.#7
alexandreofbh wants to merge 1 commit into
dlibml:masterfrom
alexandreofbh:master

Conversation

@alexandreofbh

Copy link
Copy Markdown

When I try to calculate the boxes, an error occurs. This error occurs because ImageLab doesn't add the total image size to the XML. Now, the program checks if the figure size exists; if not, it iterates through all the figures and gets their size, which is necessary to perform the calculation. For large datasets, the process is slow, but it works perfectly.

… because ImageLab doesn't add the total image size to the XML. Now, the program checks if the figure size exists; if not, it iterates through all the figures and gets their size, which is necessary to perform the calculation. For large datasets, the process is slow, but it works perfectly.
@arrufat

arrufat commented Aug 31, 2025

Copy link
Copy Markdown
Member

If your dataset does not have the width/height metadata, you can add it with

imglab --add-width-height-metadata

This was added precisely for this use case in
davisking/dlib@f0fff72
davisking/dlib#2376 (comment)

@arrufat

arrufat commented Aug 31, 2025

Copy link
Copy Markdown
Member

So, to be clear, the reason why this information should be in the dataset is because, generally, you want to try several settings to find the best bounding boxes. Having to load all the images from the dataset everytime makes it very slow to compute the boxes.

If that solves your issue, you can now close the PR.

@arrufat

arrufat commented Aug 31, 2025

Copy link
Copy Markdown
Member

This makes me think that we should probably use these in imglab to get the image dimensions really quickly.
davisking/dlib#2920

What do you think @davisking, would like a PR that does that?

@alexandreofbh

Copy link
Copy Markdown
Author

The biggest difficulty was that when you don’t have the full size of the figure, the program crashes without indicating the reason.
But yes, it does solve the problem, and thank you very much for the help!

@arrufat

arrufat commented Aug 31, 2025

Copy link
Copy Markdown
Member

Ah, I should probably improve the error message, then I will do that at some point later, let me add an issue so that I don't forget (or people can publicly shame me for not doing it)

@davisking

Copy link
Copy Markdown

@arrufat yeah if you want to make a PR that makes --add-width-height-metadata faster by only loading the sizes that's cool with me.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants