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

Change image default dtype from float32 to uint8 #1175

Conversation

vinnamkim
Copy link
Contributor

@vinnamkim vinnamkim commented Oct 19, 2023

Summary

  • Currently, there is discrepancy between the return image data types: ImageFromBytes.data (np.float32), ImageFromNumpy.data (np.float32), and ImageFromFile.data (np.uint8).
  • This makes the data loader based on the Arrow data format (using ImageFromBytes.data) slower since the image preprocessing will be conducted on the np.float32 data (4x larger than np.uint8).
  • This PR forces np.uint8 data to be returned for all Image classes.

How to test

Our existing tests can cover this.

Checklist

  • I have added unit tests to cover my changes.​
  • I have added integration tests to cover my changes.​
  • I have added the description of my changes into CHANGELOG.​
  • I have updated the documentation accordingly

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.
  • I have updated the license header for each file (see an example below).
# Copyright (C) 2023 Intel Corporation
#
# SPDX-License-Identifier: MIT

@vinnamkim vinnamkim added the ENHANCE Enhancement of existing features label Oct 19, 2023
@vinnamkim vinnamkim added this to the 1.5.1 milestone Oct 19, 2023
@vinnamkim vinnamkim changed the title Change image default dtype to uint8 Change image default dtype from float32 to uint8 Oct 19, 2023
Signed-off-by: Kim, Vinnam <[email protected]>
@vinnamkim vinnamkim marked this pull request as ready for review October 19, 2023 08:06
@vinnamkim vinnamkim requested review from a team as code owners October 19, 2023 08:06
@vinnamkim vinnamkim requested review from jihyeonyi and removed request for a team October 19, 2023 08:06
Copy link

@jihyeonyi jihyeonyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vinnamkim vinnamkim merged commit 46a97d7 into openvinotoolkit:releases/1.5.0 Oct 19, 2023
10 of 19 checks passed
yunchu pushed a commit to yunchu/datumaro that referenced this pull request Oct 23, 2023
- Currently, there is discrepancy between the return image data types:
`ImageFromBytes.data` (`np.float32`), `ImageFromNumpy.data`
(`np.float32`), and `ImageFromFile.data` (`np.uint8`).
- This makes the data loader based on the Arrow data format (using
`ImageFromBytes.data`) slower since the image preprocessing will be
conducted on the `np.float32` data (4x larger than `np.uint8`).
- This PR forces `np.uint8` data to be returned for all `Image` classes.

Signed-off-by: Kim, Vinnam <[email protected]>
vinnamkim added a commit that referenced this pull request Jan 23, 2024
)

### Summary

- This is something missed in
#1175

### How to test
I believe the existing tests (`tests/unit/test_images.py`) can cover it.

### Checklist
<!-- Put an 'x' in all the boxes that apply -->
- [ ] I have added unit tests to cover my changes.​
- [ ] I have added integration tests to cover my changes.​
- [ ] I have added the description of my changes into
[CHANGELOG](https://github.com/openvinotoolkit/datumaro/blob/develop/CHANGELOG.md).​
- [ ] I have updated the
[documentation](https://github.com/openvinotoolkit/datumaro/tree/develop/docs)
accordingly

### License

- [ ] I submit _my code changes_ under the same [MIT
License](https://github.com/openvinotoolkit/datumaro/blob/develop/LICENSE)
that covers the project.
  Feel free to contact the maintainers if that's a concern.
- [ ] I have updated the license header for each file (see an example
below).

```python
# Copyright (C) 2023 Intel Corporation
#
# SPDX-License-Identifier: MIT
```

---------

Signed-off-by: Kim, Vinnam <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ENHANCE Enhancement of existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants