[FEATURE] Add support for other dtypes to Image in schema
See original GitHub issue🚨🚨 Feature Request
- A new implementation (Improvement, Extension)
Is your feature request related to a problem?
Currently, users are only able to use Image in schema with dtypes “uint8” and “uint16”. Using other integer and float types raises an error.
If your feature will improve HUB
More freedom for users to use different dtypes in Image.
Description of the possible solution
Modify hub.schema.Image to permit other integer and float dtypes. Also, add a check that ensures that in case the compressor is “png” and dtype other than “uint8” and “uint16” is specified, raise an error. Similarly, if the compressor is “jpeg” and a dtype other than “uint8” is specified, raise an error. The errors should be raised during the constructor call i.e. when _init_ is called.
Teachability, Documentation, Adoption, Migration Strategy After the fix, this code should work:-
schema_1 = {
"image" : hub.schema.Image((500, 500, 3), "float64")
}
while this should raise an error
schema_2 = {
"image" : hub.schema.Image((500, 500, 3), "float32", compressor="png")
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
pandas.DataFrame.convert_dtypes
Convert columns to best possible dtypes using dtypes supporting pd.NA . New in version 1.0.0. ... In the future, as new dtypes are...
Read more >datasets/arrow_dataset.py at main · huggingface ... - GitHub
The largest hub of ready-to-use datasets for ML models with fast, easy-to-use and efficient data manipulation tools - datasets/arrow_dataset.py at main ...
Read more >Overview of Pandas Data Types - Practical Business Python -
This article will discuss the basic pandas data types (aka dtypes ), how they map to python and numpy data types and the...
Read more >How Python type hints simplify Pandas UDFs in Apache Spark ...
In the future, we should consider adding support for other type hint combinations in both Pandas UDFs and Pandas Function APIs. Currently, the ......
Read more >Process - Hugging Face
Reorder rows and split the dataset. Rename and remove columns, and other common column operations. Apply processing functions to each example in a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, I would like to know about all the expected dtypes to be included and any other checks needed for any other format other than the two checks mentioned (for png and jpeg)
Closing due to inactivity.