Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tif support #1274

Closed
wants to merge 1 commit into from
Closed

Conversation

kdionyso
Copy link

This small modification allows .tif files to be read in and used for training/validation/testing. The modification is pretty small and I hope it can be incorporated into master. This will help the remote sensing community to use the timm package for model training. If necessary I can write a small test to demonstrate that it works with .tif files.

@rwightman
Copy link
Collaborator

@kdionyso not opposed to adding, but one issue with tiff, aren't both .tif and .tiff equally common or do you find .tif is most used?

@kdionyso
Copy link
Author

kdionyso commented Jun 13, 2022

Apologies for the very very tardy reply, @rwightman. I believe that ".tif" files are more common in the remote sensing/earth observation community and this is why I recommended adding that capability. There are possibly use cases for ".tiff" files as well, but to be honest I have not come across files with this extension in my line of work. Awesome work by the way :)

@VarIr
Copy link

VarIr commented Jul 6, 2022

It seems .tiff would be the canonical form, judging from specification names: "TIFF/EP (ISO 12234-2), TIFF/IT (ISO 12639),[3][4][5] TIFF-F (RFC 2306) and TIFF-FX (RFC 3949).[6]" (from https://en.wikipedia.org/wiki/TIFF).

In any case, our microscopes create .tiff files (biomedical domain).

@metazool
Copy link

metazool commented Jul 6, 2022

Sounds like it's safest to include both. It would be very useful to us

@rwightman
Copy link
Collaborator

rwightman commented Jul 7, 2022

@VarIr @metazool @kdionyso
I decided to support this a different way, let people change the defaults. So I'll keep the defaults as is for now, but you can easily change them now (before you create a dataset/parser and initiate the file scan).

>>> timm.data.get_img_extensions()
('.png', '.jpg', '.jpeg')
>>> timm.data.add_img_extensions(['.tif', '.tiff'])
>>> timm.data.get_img_extensions()
('.png', '.jpg', '.jpeg', '.tif', '.tiff')
>>> timm.data.set_img_extensions(['.tif', '.tiff'])
>>> timm.data.get_img_extensions()
('.tif', '.tiff')
>>> timm.data.del_img_extensions('.tiff')
>>> timm.data.get_img_extensions()
('.tif',)

bfc0dcc

EDIT this will be merged later today / tomorrow

@rwightman rwightman closed this Jul 7, 2022
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.

5 participants