-
Notifications
You must be signed in to change notification settings - Fork 74.3k
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
[feature] Smarter Handling of Image Data Format #8227
Comments
I agree. It is actually the case that internally XLA is free to permute the physical layout order of Tensor dimensions to improve speed. However, when tensors flow in and out of XLA code from regular TensorFlow ops the data needs to be in row-major layout. The visible |
@cancan101 @prb12 Hi! Is there someone working on this already? If not, I would like to take part in implementation of this feature (yeah, I know this is the serious issue, not like my first one #7948). Could you push me in right direction? As I understood, the point is this: @prb12 Could you please elaborate more on your idea with |
In an ideal world, I think we'd like to not specify |
I also had a thought about that, but I think that's the lesser issue than bothering about creating model twice for training and inference. In most cases, data is in one of these two formats, or can be reshaped in proper format on the fly outside tensorflow. p.s. Maybe I am wrong and most experienced computer vision researchers/developers have other opinion. |
Inference-time models need to be different from training-time models regardless, no? You want to build them with I guess these can be handled in optimization passes, but at least that's not how we're handling it right now. We rebuild our graphs for inference with |
Hi @cancan101 , I'm facing similar problem as you mentioned in your initial post in this thread. I've a trained checkpoint model trained using NCHW format. But I want to convert into a checkpoint with weights so that the model works for NHWC format input images. May I know how to do it. You've mentioned I know how to load a checkpoint file but how do I rebuild the graph for different image input and save a new checkpoint model for the new graph ? It would be great if you can provide some help or any sample/pseudo code. Thanks in advance !!! |
At a basic level, understanding image formats helps you to maintain image quality. Whether an image is just for yourself or destined to be seen by others, you’ll clearly want it to look as good as possible – particularly if it’s designed to represent your brand. It’s also important as some image types aren’t as widely supported as others, and so they won’t be usable or viewable everywhere. Furthermore, some files support certain features that allow them to be displayed correctly, or edited at a later date, while others may not. |
This issue is stale because it has been open for 180 days with no activity. It will be closed if no further activity occurs. Thank you. |
is this issue still open? |
This issue is stale because it has been open for 180 days with no activity. It will be closed if no further activity occurs. Thank you. |
Hi, Thank you for opening this issue. Since this issue has been open for a long time, the code/debug information for this issue may not be relevant with the current state of the code base. The Tensorflow team is constantly improving the framework by fixing bugs and adding new features. We suggest you try the latest TensorFlow version with the latest compatible hardware configuration which could potentially resolve the issue. If you are still facing the issue, please create a new GitHub issue with your latest findings, with all the debugging information which could help us investigate. Please follow the release notes to stay up to date with the latest developments which are happening in the Tensorflow space. |
This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. |
This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. |
Right now the responsibility of choosing image data format (i.e. the representation of batches of image) is that of the data scientist (ie model writer). I suggest there should a solution in TF to move this to the optimizer (XLA perhaps?) or worst cast Op writer.
For some background:
Currently Tensorflow supports
NCHW
andNHWC
(though other formats like CHWN might be possible down the road). Many of the Ops support both formats. That being said, the docs say:This requires the user to have to do some "wrangling" (e.g. loading the checkpoint of weights and re-buidling graph in Python) to map from one image format to another. Further this must be done with some knowledge of the platform on which the graph will be executed (ie which ops are defined, and if both, which is faster)?
Right now model builder must build the model to take in channel order and pass that around. Ideally the model could be written once with enough meta information attached to the graph to allow optimizers after the fact (ie at inference time on other platforms) to choose the best representation. Further even at training time, it would be great if the data scientist didn't need to be concerned with image data format (ie dimension ordering) and could use abstractions for accessing results that took care of data access.
I don't have a clear proposal of how to clean this up, but this seems like a potential pain point, or a the very least results in people leaving performance on the table both when training and at inference.
TL; DR Many data scientists just want to write CNNs without thinking about tensor layouts.
The text was updated successfully, but these errors were encountered: