Blocked images larger than a certain size will not render in Image Labeler
Mostrar comentarios más antiguos
I am endeavouring to train a deep learning object detection network. For training data, I have large photomosaics that I would like to label using the Image Labeler app, and then ultimately create a Blocked Image Datastore with a Block Location Set argument to sample blocks from the large training images that are the appropriate input size for the network.
I appreciate that the Image Labeler app can import large images like these as blocked images, but I've found that above a certain size it seems to be unable to render them, and consequently I am unable to work with them in the Image Labeler.
Specifically, when things are working properly, if I import a blocked image into the lmage Labeler and proceed to zoom in from its initial zoom level, after several seconds at most the resolution of the image updates to the new zoom level. But above a certain image size, when I zoom in it just remains 'pixelated' from the previous zoom level's resolution, the resolution never updates to the new zoom level, and eventually after some time (several or more minutes) the MATLAB command window reports a graphics timeout error.
As it stands, my largest training image to not have this issue in Image Labeler is 15887 x 33197 pixels (≈ 527 million pixels), but as of my next size up image (18682 x 34701 pixels ≈ 648 million pixels), it will not render at higher zoom levels.
I'm not sure precisely which hardware resources are used to render images in Image Labeler, but my PC has 64 GB of RAM as well as an NVIDIA GeForce RTX 3060 with 12 GB of VRAM (and yes, I have the Parallel Computing Toolbox).
Any advice/insight?
5 comentarios
Dominique Chabot
el 1 de Mayo de 2023
Editada: Dominique Chabot
el 1 de Mayo de 2023
Have you given the images to the Labeler app in the form of a blockedImageDataStore? If so, what is the block size? If not, in what form have you given them, and what is the numerical format of the pixel values?
If they are not uint8, it is very easy to see a 648 million pixel RGB image straining the resources of a 12 GB card.
Matt J
el 1 de Mayo de 2023
Maybe you could show us the details of the blockedImage representation, e.g.,
blockedImage with properties:
Read only properties
Source: [128x128x27 uint8]
Adapter: [1x1 images.blocked.InMemory]
Size: [128 128 27]
SizeInBlocks: [1 1 1]
ClassUnderlying: "uint8"
Dominique Chabot
el 1 de Mayo de 2023
Respuesta aceptada
Más respuestas (3)
Matt J
el 1 de Mayo de 2023
0 votos
I could of course break the images up into smaller images but that would make my workflow less efficient
Breaking them up for the purposes of network training shouldn't impact your workflow. After the network is trained, you can use the original image size for inference.
1 comentario
Dominique Chabot
el 1 de Mayo de 2023
my understanding has been that it automatically sets the block size based on the size of the image and maybe the zoom level
Perhaps it should, but my guess would be that it chooses it no differently from how the blockedImage constructor chooses it and, as you can see from the object properties, the default SizeInBlocks that it has chosen is [1,1,1]. In other words, the software is assuming that a [34701 18682 3] chunk of data is just fine for the memory resources of your computer. No need to split it up.
Are you able to import a blockedImage object to the app? If so, you should probably import to the workspace as a blockedImage object with the blockSize chosen by you directly, e.g.,
bim = blockedImage(Source, blockSize=[1000,1000]);
3 comentarios
and when I put the images into a regular imds and import them into the Labeler, it doesn't even suggest converting them to blocked images
What if you use the ReadFcn option of the imds to convert the image into a blockedImage (of a size chosen by you)?
imds=imageDataStore(location, ReadFcn=@(fn)blockedImage(fn,[1000,1000]) );
Dominique Chabot
el 1 de Mayo de 2023
Matt J
el 1 de Mayo de 2023
I think we may have exhausted all avenues, but you could always try Tech Support, to see if there's something we've overlooked. If nothing else, they should probably be informed about these limitations.
One other possible workaround is to convert the image to grayscale, e.g., using the ReadFcn property of the imageDataStore, for the purposes of labeling only. I don't know if the loss of color affects your ability to recognize targets for labeling purposes. If not, it will cut down memory requirements by a factor of 3.
I would still recommend you chop up the images in any case. I would expect it to make training go much faster.
Categorías
Más información sobre Blocked Images en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!